Received: by 10.213.65.68 with SMTP id h4csp650228imn; Fri, 16 Mar 2018 14:34:27 -0700 (PDT) X-Google-Smtp-Source: AG47ELv9kWGOHt+whERV+etbtLPzmafqasqfPHde5BaJwHMDPGceVAAmYo4MIlgOU2spWaTWIMZX X-Received: by 10.101.100.9 with SMTP id a9mr2641280pgv.209.1521236067021; Fri, 16 Mar 2018 14:34:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521236066; cv=none; d=google.com; s=arc-20160816; b=IMzLkAXkuFVRVpr+Qca9Nk7I7il4egSOkpZhETFdR70+bRlvZUCJaZ8/EzyYIwJ19E inB7YkL6ur1mgbpdHmvjQp5LbmRg9aye74pLnZz10/6q1P7AV4uf3zc5Z2nLSLCstNes S9kl9EmbWIT1zpfnQnRXMgAFs4vmUcnu2j9kbIlGc3MCRrak21my9a+d7qrWCO66dtZF Ltn62Vwh6xTn+Wsi5CAPoof7E7uZYPFXsYQCuT/tQLY7dl9Jpt4lkDY+/iqH1f/f1R0t vYpBq/z3iEin2Aw8/O6x9raE+Yw2yMFfW93obkOHw6s8GFfkl6La9gnEAdUgsaIRXh1S ISSQ== 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=l5bw4XnH1pp3lapIyZovM4bRWJTZpayyHyuJSrHSALU=; b=A68Zb6JnNGjWXNwz5ZC3OpMtZg70ycZJg3Tke6WmrvXF6XWmC0zkJqOy01RnPScIBL 72ekQq8HoDWDiEx9bgRCfgOJp4+qQWGcRhRe3GTK11yxTEjB9MzCtaWnUA6oK/qzFR4T iO3fShrtHrSBlN0g/liTt/55wWkcdu81PJsCnCQmX8ZeVxK4eYnH3TN7aWH8JjH7QL39 XdK2RfLq0ZR0u66BhAr4hpbPtPAO7Qxn4ZgSpElSYF0LPGbhuAiTyI5vafTrW8sPWnbi 1aN/temoBFps9SadQFp6gKS4sV5Eol/8mujqpOElOtQQw1g0KF8udkE7WOlqeM9HczR0 +dUQ== 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 e26si5579848pgn.364.2018.03.16.14.33.54; Fri, 16 Mar 2018 14:34:26 -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 S1751630AbeCPVcR (ORCPT + 99 others); Fri, 16 Mar 2018 17:32:17 -0400 Received: from linode.aoot.com ([69.164.194.13]:54398 "EHLO linode.aoot.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750991AbeCPVcN (ORCPT ); Fri, 16 Mar 2018 17:32:13 -0400 X-Greylist: delayed 1622 seconds by postgrey-1.27 at vger.kernel.org; Fri, 16 Mar 2018 17:32:13 EDT Received: from stevoacer (47-221-140-100.gtwncmta03.res.dyn.suddenlink.net [47.221.140.100]) by linode.aoot.com (Postfix) with ESMTP id B7C558326; Fri, 16 Mar 2018 16:05:10 -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> In-Reply-To: <1521216991-28706-19-git-send-email-okaya@codeaurora.org> Subject: RE: [PATCH v3 18/18] infiniband: cxgb4: Eliminate duplicate barriers on weakly-ordered archs Date: Fri, 16 Mar 2018 16:05:10 -0500 Message-ID: <003601d3bd6a$783d6970$68b83c50$@opengridcomputing.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQE6mTD+J/QLr4bfMbM+wOAMMt4Q1AI7R6hepPPFF3A= Content-Language: en-us Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > Code includes wmb() followed by writel(). writel() already has a barrier on > some architectures like arm64. > > This ends up CPU observing two barriers back to back before executing the > register write. > > Since code already has an explicit barrier call, changing writel() to > writel_relaxed(). > > Signed-off-by: Sinan Kaya NAK - This isn't correct for PowerPC. For PowerPC, writeX_relaxed() is just writeX(). I was just looking at this with Chelsio developers, and they said the writeX() should be replaced with __raw_writeX(), not writeX_relaxed(), to get rid of the extra barrier for all architectures. Also, t4.h:pio_copy() needs to use __raw_writeq() to enable the write combining fastpath for ARM and PowerPC. The code as it stands doesn't achieve any write combining on PowerPC at least. And the writel()s at the end of the ring functions (the non bar2 udb path) needs a mmiowb() afterwards if you're going to use __raw_writeX() there. However that path is only used for very old hardware (T4), so I wouldn't worry about them. Steve. > --- > drivers/infiniband/hw/cxgb4/t4.h | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/infiniband/hw/cxgb4/t4.h > b/drivers/infiniband/hw/cxgb4/t4.h > index 8369c7c..7a48c9e 100644 > --- a/drivers/infiniband/hw/cxgb4/t4.h > +++ b/drivers/infiniband/hw/cxgb4/t4.h > @@ -477,15 +477,15 @@ 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); > + writel_relaxed(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); > + writel_relaxed(QID_V(wq->sq.qid) | PIDX_V(inc), wq->db); > } > > static inline void t4_ring_rq_db(struct t4_wq *wq, u16 inc, > @@ -502,15 +502,15 @@ 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); > + writel_relaxed(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); > + writel_relaxed(QID_V(wq->rq.qid) | PIDX_V(inc), wq->db); > } > > static inline int t4_wq_in_error(struct t4_wq *wq) > -- > 2.7.4