Received: by 10.213.65.68 with SMTP id h4csp66378imn; Mon, 19 Mar 2018 19:51:29 -0700 (PDT) X-Google-Smtp-Source: AG47ELviIKsMFrdeFTKjyQihlvSZmHMlYSQAGVf1Uafmx7e3fd/fUwyO1/QoWFIkaWPw/7vlmXyl X-Received: by 10.101.82.198 with SMTP id z6mr10721743pgp.41.1521514289063; Mon, 19 Mar 2018 19:51:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521514289; cv=none; d=google.com; s=arc-20160816; b=TyNAUMD2feW1HyMHWDlQLdJ6iVXJDiFWiwhMWH81INzCqAXqB6eYz1QeoxFBpTrz7S qrS6ayEKg2WoqohOOvwoEiPF2t6k60FJgqEO6b1khGysmqlk5zFtgnff8iUIE5q7VuyK iGm5DHDGtRvlKf0/omS37OEn1Yc27/8VxNuC+ghGt8P9u96oAwcSJ9hNCYtDxrv+6ZkS WCiivVVUMJThuIYDY/ywuVPM9z0ILA9CZvNSez5h5cSQ0yD5XDqDKJCNq1DRKUCdRC3f QFxLRyV5Gw3OSnzwqwW0G4FQ7xM1meGeFkr+wuKQWY+w248uECmVVr56wGxDUtAywQSv C3TQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=emb4F8n1r43OJwdBQy6OVkOxsO9y1Zfd89c2P7SKkV0=; b=X2uoF11Wqmuay64LST1xLR+kFyun9vwuOKtlLBXkBTaW0GeYlkm+HZjXVHq5tfYiJA TUXqXweIZ6LsFywoE6VjKca/CVUPqawOIU3u+IGygyz9iSX0h6ush0ugMlXn5VWI/eVn 2BYz1tV2gN/r0v/WSMIL8Y/43ghZJyQahrUUkbS7r+jzGyIb+9NrZaLodnQZoksdZ/Is fS+lQu0rYvApEkPJdTSovemc4+6U+kXNpPoYkgnPi3/D9XQk17bqIdraehta5uvOGUEj KOpsVP4QiuxXhkDFYA/PU7JdC1wpRNsU1eP6bKoPzFFPdKyVD1b0rXq3BNCIjn1Gx1Ar dhyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=Q4qk55ue; dkim=pass header.i=@codeaurora.org header.s=default header.b=La1QGd7s; 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 l13si485155pgn.346.2018.03.19.19.51.15; Mon, 19 Mar 2018 19:51:29 -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; dkim=pass header.i=@codeaurora.org header.s=default header.b=Q4qk55ue; dkim=pass header.i=@codeaurora.org header.s=default header.b=La1QGd7s; 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 S1751945AbeCTCuC (ORCPT + 99 others); Mon, 19 Mar 2018 22:50:02 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:55974 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751249AbeCTCsA (ORCPT ); Mon, 19 Mar 2018 22:48:00 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 31E8560FF4; Tue, 20 Mar 2018 02:48:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521514080; bh=hZzOBaCuBDjbm4EKNUOexnxorUpOIiaDiek79f8gFfE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q4qk55ue86xdgNLKyMD7vQFAi890LCR3+5t1Tw9VfcQYuGB+5UsGocdK4LJZ9vchi cJCXaLQfCTGrJ4AXY4yPPVzOI6PKu/NCpIjmodp0vwQfppfDitJmbMn1uh5vZQQJ57 5H2JqyGb9sGUywLC0GvZ5UVrOYju1Qe+s9KCnTSk= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 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 F36E6610D5; Tue, 20 Mar 2018 02:47:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521514079; bh=hZzOBaCuBDjbm4EKNUOexnxorUpOIiaDiek79f8gFfE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=La1QGd7s8YhosHti7bhuxigsINPhvbyDvxvKElz4l4uEqAL5GJROYohPcSCRHGOXx T9IFKkFOJ87MbiTBvXhGOJK5N3Z8UXvhGvVMpGi/ix54R148RC8RAnoXQDvSyi2Gaa spi+1eaWH9IKIIJroEHNqXaRBzMm1/8z7fAIP2yE= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org F36E6610D5 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: linux-rdma@vger.kernel.org, timur@codeaurora.org, sulrich@codeaurora.org Cc: linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Sinan Kaya , Faisal Latif , Shiraz Saleem , Doug Ledford , Jason Gunthorpe , linux-kernel@vger.kernel.org Subject: [PATCH v4 3/6] RDMA/i40iw: Eliminate duplicate barriers on weakly-ordered archs Date: Mon, 19 Mar 2018 22:47:45 -0400 Message-Id: <1521514068-8856-4-git-send-email-okaya@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521514068-8856-1-git-send-email-okaya@codeaurora.org> References: <1521514068-8856-1-git-send-email-okaya@codeaurora.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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. 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 -- 2.7.4