From patchwork Fri Mar 16 16:16:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 10289177 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 16DE8601A0 for ; Fri, 16 Mar 2018 16:38:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0636F20856 for ; Fri, 16 Mar 2018 16:38:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EF0C528EF1; Fri, 16 Mar 2018 16:38:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4B22320856 for ; Fri, 16 Mar 2018 16:38:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=L+Q/jr2kW8w2XGpz9Y1w5y4FZWoT9n0MLrMWdrY2tZI=; b=oUV78asuZkfhZM RpVE7LnOJ1rcn4Ph8mplPuzQ8i7wj9QnBmzkx1Jh8p6NnhdDxxbgRpyVeqttm/Ks0GzSWMUG9rAwh MHU6b0C+QyKUA5ccXf42sLK190hs4mnEg5RL/lRj4U1prWJ6e2kJ8rIsTaVU+B6x6WKGyxqs+2Ljl 1hwVt6/2Hv4EbJ4hmMnHrSFpbiZbxW2Kb9EyliSJXjqtJM2AlEVBabW79NM7mEKJU44JzZpzUMIlS DkyO1L1PYjjSFJjBkXpRRvbgFrRRtKQI9SUJtOnikNOb8p+R2roQzhk44QzoxLPZH3iAJ8nmleZBC dlSWgbXPDTMJEGJHXbjA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ewsMb-00070r-Jj; Fri, 16 Mar 2018 16:37:53 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ews2t-0006g0-RN for linux-arm-kernel@bombadil.infradead.org; Fri, 16 Mar 2018 16:17:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=emb4F8n1r43OJwdBQy6OVkOxsO9y1Zfd89c2P7SKkV0=; b=S9M75lqlyrQuD2B6jdGwfMcc5i PmpMgG03VQoUbFxjCNw9EIBYVwru1dLjdeStrs1pMH1ij5AS7QBWL9njhDv9PU6YTKTMljEYRdQgu hiPZJM1WRelY+MF4+1LRwr+UhSUWXbnNjSfmqRWUzjgT4WbeKg5SJfdKj8jKwxH5I+28yIbQH4a2O 4pFUkard0pADFf5qpSTfAEAdZ3fM+9uDmTMhlp3ePT/ypQ4rntC7l6lPP2PtqCeBLOxhuXmj24EqQ idTH3Ll1l286UZ7c0yhUaNRL/zKkJGDrINy1bFq9EAnjwNYj1Q4XpsQroUTK3wyMEMX1SvxsseMJZ P55FQstA==; Received: from smtp.codeaurora.org ([198.145.29.96]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ews2q-0005TL-CS for linux-arm-kernel@lists.infradead.org; Fri, 16 Mar 2018 16:17:30 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 4BC5D60F8E; Fri, 16 Mar 2018 16:17:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521217036; bh=hZzOBaCuBDjbm4EKNUOexnxorUpOIiaDiek79f8gFfE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NyNDJxX4mFG/3KS2PCp/pptGgjgpqECcKmCTTcsC+/iPVPITkHMYpKEaA/lMx1O7u 9QQGdadiyMisURb5P/5WlaBy5fkWmY5WyLYCA5vi63l9SsdtXC5QDppqXXxnN44DFo kdiJeAYKkH8CMin0wBroKNMDoDGhE/hTh56JfVcg= Received: from drakthul.qualcomm.com (global_nat1_iad_fw.qualcomm.com [129.46.232.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: okaya@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 46B5660F78; Fri, 16 Mar 2018 16:17:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521217035; bh=hZzOBaCuBDjbm4EKNUOexnxorUpOIiaDiek79f8gFfE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cocHY8RWqR6cFPhf6BF5WwOdt+LiMI234Bp1h9Jn+NCoWD6BUaHbzBStYQKOdwmc6 2KHPER6rax5IOOn3ijfkW8MaNO1zGM7fV5W3gokHjEVaD+HD12jrbBVOO+79T1KPpn x70QlEf/d2vAvekMKD5IXbd1fxuAvYNEAHTwTmow= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 46B5660F78 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=okaya@codeaurora.org From: Sinan Kaya To: netdev@vger.kernel.org, timur@codeaurora.org, sulrich@codeaurora.org Subject: [PATCH v3 17/18] RDMA/i40iw: Eliminate duplicate barriers on weakly-ordered archs Date: Fri, 16 Mar 2018 12:16:30 -0400 Message-Id: <1521216991-28706-18-git-send-email-okaya@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521216991-28706-1-git-send-email-okaya@codeaurora.org> References: <1521216991-28706-1-git-send-email-okaya@codeaurora.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180316_161728_687901_392774C7 X-CRM114-Status: GOOD ( 14.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Faisal Latif , linux-rdma@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Sinan Kaya , Jason Gunthorpe , Doug Ledford , Shiraz Saleem , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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. Create a new wrapper function with relaxed write operator. Use the new wrapper when a write is following a wmb(). Since code already has an explicit barrier call, changing writel() to writel_relaxed(). Signed-off-by: Sinan Kaya --- drivers/infiniband/hw/i40iw/i40iw_ctrl.c | 6 ++++-- drivers/infiniband/hw/i40iw/i40iw_osdep.h | 1 + drivers/infiniband/hw/i40iw/i40iw_uk.c | 2 +- drivers/infiniband/hw/i40iw/i40iw_utils.c | 11 +++++++++++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/hw/i40iw/i40iw_ctrl.c b/drivers/infiniband/hw/i40iw/i40iw_ctrl.c index c74fd33..47f473e 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_ctrl.c +++ b/drivers/infiniband/hw/i40iw/i40iw_ctrl.c @@ -706,9 +706,11 @@ static void i40iw_sc_ccq_arm(struct i40iw_sc_cq *ccq) wmb(); /* make sure shadow area is updated before arming */ if (ccq->dev->is_pf) - i40iw_wr32(ccq->dev->hw, I40E_PFPE_CQARM, ccq->cq_uk.cq_id); + i40iw_wr32_relaxed(ccq->dev->hw, I40E_PFPE_CQARM, + ccq->cq_uk.cq_id); else - i40iw_wr32(ccq->dev->hw, I40E_VFPE_CQARM1, ccq->cq_uk.cq_id); + i40iw_wr32_relaxed(ccq->dev->hw, I40E_VFPE_CQARM1, + ccq->cq_uk.cq_id); } /** diff --git a/drivers/infiniband/hw/i40iw/i40iw_osdep.h b/drivers/infiniband/hw/i40iw/i40iw_osdep.h index f27be3e..e06f4b9 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_osdep.h +++ b/drivers/infiniband/hw/i40iw/i40iw_osdep.h @@ -213,5 +213,6 @@ void i40iw_hw_stats_start_timer(struct i40iw_sc_vsi *vsi); void i40iw_hw_stats_stop_timer(struct i40iw_sc_vsi *vsi); #define i40iw_mmiowb() mmiowb() void i40iw_wr32(struct i40iw_hw *hw, u32 reg, u32 value); +void i40iw_wr32_relaxed(struct i40iw_hw *hw, u32 reg, u32 value); u32 i40iw_rd32(struct i40iw_hw *hw, u32 reg); #endif /* _I40IW_OSDEP_H_ */ diff --git a/drivers/infiniband/hw/i40iw/i40iw_uk.c b/drivers/infiniband/hw/i40iw/i40iw_uk.c index 8afa5a6..7f0ebed 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_uk.c +++ b/drivers/infiniband/hw/i40iw/i40iw_uk.c @@ -723,7 +723,7 @@ static void i40iw_cq_request_notification(struct i40iw_cq_uk *cq, wmb(); /* make sure WQE is populated before valid bit is set */ - writel(cq->cq_id, cq->cqe_alloc_reg); + writel_relaxed(cq->cq_id, cq->cqe_alloc_reg); } /** diff --git a/drivers/infiniband/hw/i40iw/i40iw_utils.c b/drivers/infiniband/hw/i40iw/i40iw_utils.c index ddc1056..99aa6f8 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_utils.c +++ b/drivers/infiniband/hw/i40iw/i40iw_utils.c @@ -125,6 +125,17 @@ inline void i40iw_wr32(struct i40iw_hw *hw, u32 reg, u32 value) } /** + * i40iw_wr32_relaxed - write 32 bits to hw register without ordering + * @hw: hardware information including registers + * @reg: register offset + * @value: vvalue to write to register + */ +inline void i40iw_wr32_relaxed(struct i40iw_hw *hw, u32 reg, u32 value) +{ + writel_relaxed(value, hw->hw_addr + reg); +} + +/** * i40iw_rd32 - read a 32 bit hw register * @hw: hardware information including registers * @reg: register offset