Received: by 10.213.65.68 with SMTP id h4csp354987imn; Sat, 17 Mar 2018 06:26:35 -0700 (PDT) X-Google-Smtp-Source: AG47ELsuEZ/EMgCtEEI6VTUXrqQLSPOc2Pa7Beede79jXBnjQaHWx9hW8lNuMZzzUYC1qyLuyOBw X-Received: by 10.101.90.203 with SMTP id d11mr4100578pgt.20.1521293195104; Sat, 17 Mar 2018 06:26:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521293195; cv=none; d=google.com; s=arc-20160816; b=MCOIjbsBnknYv/fjYa6HO1sEon0UJQ9uO5tSQc6Reu9AQGHL7mfhLrBJrZylTwpheg mxibYhJLhfN6Yx3nC7W5zvk6sB8pw+jjrkldEIBbgCvojs62ZozSB2qngU5r1zdRKNsQ IUOvuclweiz/40jlOY/9o7zzpzZiL83NzDXBHB0UlooYE6ashVa5eNaDz9Rh2+9dOjbQ TT9aipxWPikdtKQBCUT57URpyidr1vqa7PP1V04za2/7aHAGq1J3olElnrZ5WrNRINuu iLuU2FZYeeZ8MiC9s5ziebCzVtjpz0smSwpI/Y+mACoinYcGgxebdStQhcSZtlwVBTCw 1qvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language:thread-index :content-transfer-encoding:mime-version:message-id:date:subject :in-reply-to:references:cc:to:from:arc-authentication-results; bh=wYWtWwGjy6Kn5i8MlCY9t4dJTlTVQ/lBrHPd3RebEkg=; b=qH6Lema4KKelmGw71dcoGcRUzq5V4oG80nkNUaOeBFFffVNFX8iidCPbjNE3hQZ0JK 4oebDDOCWuifGusJceJzvaXtp0gCeFs9fHKgYWuTRsXe8tT7YAudyVrJ+/yzVX47pIQn pqE2KcB07BhHkL3ziHvNOU/deClkcDrTkya/uvDZUsNRWfeEeiljG7dC0DCc8L0nj7r6 7tqc2vXUS2yFjt1+M9C9SCW+0D4u09Z9EBZnu0ptbPDW0BL+Fk6VEwyZW93hd+KSdh77 fGf2z1hZIMeUEkyjxvlyU4SFQkYy5KGDxhK9t1MgevDqRcg0GLhqBVv5mmrQWhouZUZ0 iYQg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g5si6725716pgo.211.2018.03.17.06.25.41; Sat, 17 Mar 2018 06:26:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752774AbeCQNXR convert rfc822-to-8bit (ORCPT + 99 others); Sat, 17 Mar 2018 09:23:17 -0400 Received: from linode.aoot.com ([69.164.194.13]:54778 "EHLO linode.aoot.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752603AbeCQNXP (ORCPT ); Sat, 17 Mar 2018 09:23:15 -0400 Received: from stevoacer (47-221-140-100.gtwncmta03.res.dyn.suddenlink.net [47.221.140.100]) by linode.aoot.com (Postfix) with ESMTP id AC4578326; Sat, 17 Mar 2018 08:23:14 -0500 (CDT) From: "Steve Wise" To: "'Sinan Kaya'" , , , Cc: , , "'Steve Wise'" , "'Doug Ledford'" , "'Jason Gunthorpe'" , , , "'Michael Werner'" , "'Casey Leedom'" References: <1521216991-28706-1-git-send-email-okaya@codeaurora.org> <1521216991-28706-19-git-send-email-okaya@codeaurora.org> <003601d3bd6a$783d6970$68b83c50$@opengridcomputing.com> <83387f6e-adcb-14e9-2c22-96abf9493cc6@codeaurora.org> <004501d3bd7b$505e70f0$f11b52d0$@opengridcomputing.com> <740c7d45-450e-c9b3-ceed-7bc7fcefbc5a@codeaurora.org> <71e37a55-537b-d75a-cfde-f188b7cfce8e@codeaurora.org> <1f5e3b14-05a1-08d0-c0cb-00805526448d@codeaurora.org> In-Reply-To: <1f5e3b14-05a1-08d0-c0cb-00805526448d@codeaurora.org> Subject: RE: [PATCH v3 18/18] infiniband: cxgb4: Eliminate duplicate barriers on weakly-ordered archs Date: Sat, 17 Mar 2018 08:23:13 -0500 Message-ID: <001d01d3bdf3$1a607cf0$4f2176d0$@opengridcomputing.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQE6mTD+J/QLr4bfMbM+wOAMMt4Q1AI7R6heAYll0hoCDc6xewHk8BZpAb3SUpMC4LP1TwG8iMu8pJYfrdA= Content-Language: en-us Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > On 3/17/2018 12:03 AM, Sinan Kaya wrote: > > On 3/16/2018 11:40 PM, Sinan Kaya wrote: > >> I'll change writel_relaxed() with __raw_writel() in the series like you > suggested > >> and also look at your other comments. > > > > I spoke too soon. > > > > Now that I realized, code needs to follow one of the following patterns > for correctness > > > > 1) > > wmb() > > writel()/writel_relaxed() > > > > or > > > > 2) > > wmb() > > __raw_wrltel() > > mmiowb() > > > > but definitely not > > > > wmb() > > __raw_wrltel() > > > > Since #1 == #2, I'll stick to my current implementation of writel_relaxed() > > > > Changing writel() to writel_relaxed() or __raw_writel() isn't enough. > PowerPC needs mmiowb() > > for correctness. ARM's mmiowb() implementation is empty. > > > > So, there is no one size fits all solution with the current state of affairs. > > > > > > I think I finally got what you mean. > > Code seems to have > > wmb() > writel()/writeq() > wmb() > > this can be safely replaced with > > wmb() > __raw_writel()/__raw_writeq() > wmb() > > This will work on all arches. Below is the new version. Let me know if this is > OK. > > +++ b/drivers/infiniband/hw/cxgb4/t4.h > @@ -457,7 +457,7 @@ static inline void pio_copy(u64 __iomem *dst, u64 > *src) > int count = 8; > > while (count) { > - writeq(*src, dst); > + __raw_writeq(*src, dst); > src++; > dst++; > count--; > @@ -477,15 +477,16 @@ static inline void t4_ring_sq_db(struct t4_wq *wq, > u16 inc, union t4_wr *wqe) > (u64 *)wqe); > } else { > pr_debug("DB wq->sq.pidx = %d\n", wq->sq.pidx); > - writel(PIDX_T5_V(inc) | QID_V(wq->sq.bar2_qid), > - wq->sq.bar2_va + SGE_UDB_KDOORBELL); > + __raw_writel(PIDX_T5_V(inc) | QID_V(wq->sq.bar2_qid), > + wq->sq.bar2_va + SGE_UDB_KDOORBELL); > } > > /* Flush user doorbell area writes. */ > wmb(); > return; > } > - writel(QID_V(wq->sq.qid) | PIDX_V(inc), wq->db); > + __raw_writel(QID_V(wq->sq.qid) | PIDX_V(inc), wq->db); > + mmiowmb() > } > > static inline void t4_ring_rq_db(struct t4_wq *wq, u16 inc, > @@ -502,15 +503,16 @@ static inline void t4_ring_rq_db(struct t4_wq *wq, > u16 inc, > (void *)wqe); > } else { > pr_debug("DB wq->rq.pidx = %d\n", wq->rq.pidx); > - writel(PIDX_T5_V(inc) | QID_V(wq->rq.bar2_qid), > - wq->rq.bar2_va + SGE_UDB_KDOORBELL); > + __raw_writel(PIDX_T5_V(inc) | QID_V(wq->rq.bar2_qid), > + wq->rq.bar2_va + SGE_UDB_KDOORBELL); > } > > /* Flush user doorbell area writes. */ > wmb(); > return; > } > - writel(QID_V(wq->rq.qid) | PIDX_V(inc), wq->db); > + __raw_writel(QID_V(wq->rq.qid) | PIDX_V(inc), wq->db); > + mmiowmb(); > } > > Yes, this is what chelsio recommended to me. Reviewed-by: Steve Wise