Received: by 10.213.65.68 with SMTP id h4csp624731imn; Fri, 23 Mar 2018 11:56:17 -0700 (PDT) X-Google-Smtp-Source: AG47ELvtxfHEXwAg2kJ/vNmm2S95VJMr44xQZYXRECqEEoAWvibG+W2+LIhUuQUHClF75JA+bdEH X-Received: by 10.99.143.69 with SMTP id r5mr7854744pgn.159.1521831377083; Fri, 23 Mar 2018 11:56:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521831377; cv=none; d=google.com; s=arc-20160816; b=Ut4G9aIVwau+JqbqwX61qzYX/v7ejTbFYxURjDFpVGegDAjad2x3fFFBWN2I3TrIGo Q/59Qjys+2WG5SrNT5hpB4y8AH+g8tjalkatK8NojfN5DfBwmh7QackQ27aJBlv2O76h fKhNQOxxNrFDMreYCIZuKn3dKxGY/KeR6VSbNH6keIo5vgMxEEcIK6Db8qiA1BHmRKRj AdgSwfUI+ZARTqYh41A8rfNuPWumyk/GjpT+23R1XO6KBQ3oL9hGPpzlOvPx9NJmnHip TckJTv7jwjfIBzRD+5g2gP1m4B8m2M3JbCl9BVxKrW/jXtPl3IB9Yqw8e13DVXJLB1Rr bUzA== 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=GVjBgSvvJKqoRXfAvkHGP29CrRO6TAbAqshwt9XODAs=; b=ha4ygj7TPbowb04IrZa60tUMIYUaSC5j1RykWNww5XXGXTATpNGnR5wvv6Ym80wkIt WgGtTUeVx3sGbTwpZBXu5/VftWKxCaNCjZQFjYKsbtbho9L+rIiktlrAdy+pmrg+LY7Z mqru7kHbJZ+LOvi4PBlFEMjV5i8mCJTL6lAaXLH+GRonD2j16cQLgU6y/ALACkeUF/11 +6AK3PLbK5glPw/uhyHxKpf4ff+jigEmEUp/5PFrR9HChYi7/1GTPYQPs0Qeloq6dBOx Yd4bLGlUe6SHCPpdwj3aFvmOQCEqESad9tg9Mrdyl+XEor0wcZNcEwRtoZDECn32pDG2 s/Zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=L5UbFcOA; dkim=pass header.i=@codeaurora.org header.s=default header.b=V2vQ6I4C; 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 e90-v6si9165275plb.456.2018.03.23.11.56.02; Fri, 23 Mar 2018 11:56:17 -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=L5UbFcOA; dkim=pass header.i=@codeaurora.org header.s=default header.b=V2vQ6I4C; 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 S1752097AbeCWSxL (ORCPT + 99 others); Fri, 23 Mar 2018 14:53:11 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:46084 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751932AbeCWSxH (ORCPT ); Fri, 23 Mar 2018 14:53:07 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 97847602FC; Fri, 23 Mar 2018 18:53:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521831186; bh=klfabD5wCBvt8l6DUv/ZN12/bSgmBkjuX3761cnXuHw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L5UbFcOAk2cpWMDEI+OJTON7Th9nT2llTHsw+8Qg3QIBYHaAnHq+3gBUUeYs9NklB Nu7Cxv5mjM/q1ik/M81nXTrti3/x/MKV3eWNR1wlppletIRFCpLFKobGAIY1dmtkKT hOH/s0utHmaaZ7wmF6+BqirBgvGT1BDss1gPNzsk= 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 F305E6085F; Fri, 23 Mar 2018 18:53:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521831185; bh=klfabD5wCBvt8l6DUv/ZN12/bSgmBkjuX3761cnXuHw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V2vQ6I4CyJFhZSRM3Ra6O+zYdAgHIL7JrZHGULGIaV6DWfdHSoiTRJwL4Presb+aL uiLboo5INh5+5udOx1XAfUAw7VMSqfkjwdMvLhcv9Itkb/QmZ0q98o/mSjjsU5uvRs Es0OcruFqXGyDVRXA0Yn1NFQVQnfk50B++wOagSA= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org F305E6085F 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: jeffrey.t.kirsher@intel.com Cc: netdev@vger.kernel.org, timur@codeaurora.org, sulrich@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Sinan Kaya , intel-wired-lan@lists.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 1/7] i40e/i40evf: Eliminate duplicate barriers on weakly-ordered archs Date: Fri, 23 Mar 2018 14:52:54 -0400 Message-Id: <1521831180-25014-2-git-send-email-okaya@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521831180-25014-1-git-send-email-okaya@codeaurora.org> References: <1521831180-25014-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. Since code already has an explicit barrier call, changing writel() to writel_relaxed(). Signed-off-by: Sinan Kaya --- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 14 ++++++++++---- drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 4 ++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c index c6972bd..d970350 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c @@ -186,7 +186,13 @@ static int i40e_program_fdir_filter(struct i40e_fdir_filter *fdir_data, /* Mark the data descriptor to be watched */ first->next_to_watch = tx_desc; - writel(tx_ring->next_to_use, tx_ring->tail); + writel_relaxed(tx_ring->next_to_use, tx_ring->tail); + + /* We need this if more than one processor can write to our tail + * at a time, it synchronizes IO on IA64/Altix systems + */ + mmiowb(); + return 0; dma_fail: @@ -1529,7 +1535,7 @@ static inline void i40e_release_rx_desc(struct i40e_ring *rx_ring, u32 val) * such as IA-64). */ wmb(); - writel(val, rx_ring->tail); + writel_relaxed(val, rx_ring->tail); } /** @@ -2412,7 +2418,7 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget) */ wmb(); - writel(xdp_ring->next_to_use, xdp_ring->tail); + writel_relaxed(xdp_ring->next_to_use, xdp_ring->tail); } rx_ring->skb = skb; @@ -3437,7 +3443,7 @@ static inline int i40e_tx_map(struct i40e_ring *tx_ring, struct sk_buff *skb, /* notify HW of packet */ if (netif_xmit_stopped(txring_txq(tx_ring)) || !skb->xmit_more) { - writel(i, tx_ring->tail); + writel_relaxed(i, tx_ring->tail); /* we need this if more than one processor can write to our tail * at a time, it synchronizes IO on IA64/Altix systems diff --git a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c index 1ae112f..5db5c50c 100644 --- a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c @@ -810,7 +810,7 @@ static inline void i40e_release_rx_desc(struct i40e_ring *rx_ring, u32 val) * such as IA-64). */ wmb(); - writel(val, rx_ring->tail); + writel_relaxed(val, rx_ring->tail); } /** @@ -2379,7 +2379,7 @@ static inline void i40evf_tx_map(struct i40e_ring *tx_ring, struct sk_buff *skb, /* notify HW of packet */ if (netif_xmit_stopped(txring_txq(tx_ring)) || !skb->xmit_more) { - writel(i, tx_ring->tail); + writel_relaxed(i, tx_ring->tail); /* we need this if more than one processor can write to our tail * at a time, it synchronizes IO on IA64/Altix systems -- 2.7.4