Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp168617ybk; Thu, 14 May 2020 20:01:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBujRrjR1zLIdqWgUZj1sgVAH7I/XKMlj+aWjNw6uUHd2XmB5jrt9FsXcE6v82m1Gg4Ce7 X-Received: by 2002:a17:906:c113:: with SMTP id do19mr929877ejc.286.1589511660597; Thu, 14 May 2020 20:01:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589511660; cv=none; d=google.com; s=arc-20160816; b=u2y+SVs57Bjqo3OhD/fr+o9mloogpCbWYds333/+iLfq1SW1sEsGdPYw++Xs5ypFd4 FKrZv/njgRSiRi6sElGmNc79Za8ebVFkQ1iIJ225Zs3ZWBFEW/RkRGdFtOWO6rW/xlZG SVomQTrjVvhKxqz2KD9E/j0joRCvnajGLJA/YuF+/+nh/tTCEcxPktUNc5Qe2/GyvsCa Iz9TmDqbnVdVgkJohRWGe3mK2XfTbtnbd8r9miaJjE6LmdfoSbFZcY03IyLmpOilXb4E FG0Qj5ojtUnZQZmR5sdhfjOVNaTsOrSjBTl4Wj8W/DBDrM0QrnGYmJZXfo091FDA/N3G WKjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from; bh=PsmiL1oa7H1oci4V5e3jxhigBpjNSIBjHclQfUPKotM=; b=p5t8dLAjmdrz+YZFjsP5aY1+/p1MRAUYMdaNd411wSvcR7E/sEy35QKlrGgd0bjjDa /gltAQ6JbqSYHDrEYbr5i3kWLph8V3ViRnsPKRtVV6FT+M98XRg60RZU7QcwTPJahJVG yjQH3WjSrEy0jOjOYhfCqlth1CBlnDHpKOeOC/hGX7et1JLufA7++Mx2jhYWrjuq8k38 jqLkhW/UAjJh07tcKS7YM9/1nDq2kbxGHHY+nPz55gm3RptLEDoPwjOwatfLdbRx/qez BRIrBeFUCYUpw064Ar1DFs3lUquEfPItDWiSwIiENmHPeUs+ea4Jo1LmlU/q2py/2QmI S6CQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=toshiba.co.jp Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i2si452685ejg.45.2020.05.14.20.00.38; Thu, 14 May 2020 20:01:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=toshiba.co.jp Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727854AbgEOB6D (ORCPT + 99 others); Thu, 14 May 2020 21:58:03 -0400 Received: from mo-csw1514.securemx.jp ([210.130.202.153]:60968 "EHLO mo-csw.securemx.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727029AbgEOB6D (ORCPT ); Thu, 14 May 2020 21:58:03 -0400 Received: by mo-csw.securemx.jp (mx-mo-csw1514) id 04F1vpEE019955; Fri, 15 May 2020 10:57:51 +0900 X-Iguazu-Qid: 34trWq5axJpfcHTLpk X-Iguazu-QSIG: v=2; s=0; t=1589507870; q=34trWq5axJpfcHTLpk; m=w5eBYxUhChjcH2wqSnG8reWK/fF+ZPfw05MuqPGwb3Q= Received: from imx12.toshiba.co.jp (imx12.toshiba.co.jp [61.202.160.132]) by relay.securemx.jp (mx-mr1513) id 04F1vmF5022340; Fri, 15 May 2020 10:57:49 +0900 Received: from enc02.toshiba.co.jp ([61.202.160.51]) by imx12.toshiba.co.jp with ESMTP id 04F1vm6H012841; Fri, 15 May 2020 10:57:48 +0900 (JST) Received: from hop101.toshiba.co.jp ([133.199.85.107]) by enc02.toshiba.co.jp with ESMTP id 04F1vmkV011077; Fri, 15 May 2020 10:57:48 +0900 From: Punit Agrawal To: Alexander Duyck Cc: Netdev , intel-wired-lan , daniel.sangorrin@toshiba.co.jp, Jeff Kirsher , "David S. Miller" , LKML Subject: Re: [RFC] e1000e: Relax condition to trigger reset for ME workaround References: <20200512044347.3810257-1-punit1.agrawal@toshiba.co.jp> Date: Fri, 15 May 2020 10:57:47 +0900 In-Reply-To: (Alexander Duyck's message of "Thu, 14 May 2020 07:57:31 -0700") X-TSB-HOP: ON Message-ID: <87v9kym02s.fsf@kokedama.swc.toshiba.co.jp> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Alexander Duyck writes: > On Mon, May 11, 2020 at 9:45 PM Punit Agrawal > wrote: >> >> It's an error if the value of the RX/TX tail descriptor does not match >> what was written. The error condition is true regardless the duration >> of the interference from ME. But the code only performs the reset if >> E1000_ICH_FWSM_PCIM2PCI_COUNT (2000) iterations of 50us delay have >> transpired. The extra condition can lead to inconsistency between the >> state of hardware as expected by the driver. >> >> Fix this by dropping the check for number of delay iterations. >> >> Signed-off-by: Punit Agrawal >> Cc: Jeff Kirsher >> Cc: "David S. Miller" >> Cc: intel-wired-lan@lists.osuosl.org >> Cc: netdev@vger.kernel.org >> Cc: linux-kernel@vger.kernel.org >> --- >> Hi, >> >> The issue was noticed through code inspection while backporting the >> workaround for TDT corruption. Sending it out as an RFC as I am not >> familiar with the hardware internals of the e1000e. >> >> Another unresolved question is the inherent racy nature of the >> workaround - the ME could block access again after releasing the >> device (i.e., BIT(E1000_ICH_FWSM_PCIM2PCI) clear) but before the >> driver performs the write. Has this not been a problem? >> >> Any feedback on the patch or the more information on the issues >> appreciated. >> >> Thanks, >> Punit >> >> drivers/net/ethernet/intel/e1000e/netdev.c | 8 ++++---- >> 1 file changed, 4 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c >> index 177c6da80c57..5ed4d7ed35b3 100644 >> --- a/drivers/net/ethernet/intel/e1000e/netdev.c >> +++ b/drivers/net/ethernet/intel/e1000e/netdev.c >> @@ -607,11 +607,11 @@ static void e1000e_update_rdt_wa(struct e1000_ring *rx_ring, unsigned int i) >> { >> struct e1000_adapter *adapter = rx_ring->adapter; >> struct e1000_hw *hw = &adapter->hw; >> - s32 ret_val = __ew32_prepare(hw); >> >> + __ew32_prepare(hw); >> writel(i, rx_ring->tail); >> >> - if (unlikely(!ret_val && (i != readl(rx_ring->tail)))) { >> + if (unlikely(i != readl(rx_ring->tail))) { >> u32 rctl = er32(RCTL); >> >> ew32(RCTL, rctl & ~E1000_RCTL_EN); >> @@ -624,11 +624,11 @@ static void e1000e_update_tdt_wa(struct e1000_ring *tx_ring, unsigned int i) >> { >> struct e1000_adapter *adapter = tx_ring->adapter; >> struct e1000_hw *hw = &adapter->hw; >> - s32 ret_val = __ew32_prepare(hw); >> >> + __ew32_prepare(hw); >> writel(i, tx_ring->tail); >> >> - if (unlikely(!ret_val && (i != readl(tx_ring->tail)))) { >> + if (unlikely(i != readl(tx_ring->tail))) { >> u32 tctl = er32(TCTL); >> >> ew32(TCTL, tctl & ~E1000_TCTL_EN); > > You are eliminating the timeout check in favor of just verifying if > the write succeeded or not. Seems pretty straight forward to me. > > One other change you may consider making would be to drop the return > value from __ew32_prepare since it doesn't appear to be used anywhere, > make the function static, and maybe get rid of the prototype in > e1000.h. > > Reviewed-by: Alexander Duyck Thanks! I will send out an update dropping the return and the prototype.