From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9587C433DF for ; Tue, 20 Oct 2020 02:58:58 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A687F222E9 for ; Tue, 20 Oct 2020 02:58:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="hhwqmsA1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A687F222E9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=openbmc-bounces+openbmc=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4CFdcb4HhdzDqKH for ; Tue, 20 Oct 2020 13:58:55 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=198.145.29.99; helo=mail.kernel.org; envelope-from=kuba@kernel.org; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=default header.b=hhwqmsA1; dkim-atps=neutral Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4CFdZw5R8vzDqT1; Tue, 20 Oct 2020 13:57:28 +1100 (AEDT) Received: from kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com (unknown [163.114.132.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 208DF222E9; Tue, 20 Oct 2020 02:57:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603162645; bh=qwSN9blogEZVLec+dCJS+sFeJavpar63X669kQYp8rY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=hhwqmsA1cgEsFROQBL4byLwoaqAmG2QBWW0ddmocqhrtuk7Rr8x6JMM9GM4fq1HPa uzuzs1UkoYq/1DXJb5TuShJqcK5svitoMD+7JZ//UQfv2N59j4olJJIN6NdaZ7Sg2V UoBNpABhyynRdhwZqKJIsWIgo6z7AhEo6VDDiYpA= Date: Mon, 19 Oct 2020 19:57:23 -0700 From: Jakub Kicinski To: Benjamin Herrenschmidt Subject: Re: [PATCH] net: ftgmac100: Fix missing TX-poll issue Message-ID: <20201019195723.41a5591f@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: <1a02e57b6b7d425a19dc59f84091c38ca4edcf47.camel@kernel.crashing.org> References: <20201019073908.32262-1-dylan_hung@aspeedtech.com> <20201019120040.3152ea0b@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> <1a02e57b6b7d425a19dc59f84091c38ca4edcf47.camel@kernel.crashing.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: openbmc@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development list for OpenBMC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, BMC-SW , linux-aspeed , Po-Yu Chuang , netdev@vger.kernel.org, OpenBMC Maillist , Linux Kernel Mailing List , Arnd Bergmann , Dylan Hung , "David S . Miller" Errors-To: openbmc-bounces+openbmc=archiver.kernel.org@lists.ozlabs.org Sender: "openbmc" On Tue, 20 Oct 2020 10:23:41 +1100 Benjamin Herrenschmidt wrote: > On Mon, 2020-10-19 at 12:00 -0700, Jakub Kicinski wrote: > > On Mon, 19 Oct 2020 08:57:03 +0000 Joel Stanley wrote: > > > > diff --git a/drivers/net/ethernet/faraday/ftgmac100.c > > > > b/drivers/net/ethernet/faraday/ftgmac100.c > > > > index 00024dd41147..9a99a87f29f3 100644 > > > > --- a/drivers/net/ethernet/faraday/ftgmac100.c > > > > +++ b/drivers/net/ethernet/faraday/ftgmac100.c > > > > @@ -804,7 +804,8 @@ static netdev_tx_t > > > > ftgmac100_hard_start_xmit(struct sk_buff *skb, > > > > * before setting the OWN bit on the first descriptor. > > > > */ > > > > dma_wmb(); > > > > - first->txdes0 = cpu_to_le32(f_ctl_stat); > > > > + WRITE_ONCE(first->txdes0, cpu_to_le32(f_ctl_stat)); > > > > + READ_ONCE(first->txdes0); > > > > > > I understand what you're trying to do here, but I'm not sure that > > > this > > > is the correct way to go about it. > > > > > > It does cause the compiler to produce a store and then a load. > > > > +1 @first is system memory from dma_alloc_coherent(), right? > > > > You shouldn't have to do this. Is coherent DMA memory broken > > on your platform? > > I suspect the problem is that the HW (and yes this would be a HW bug) > doesn't order the CPU -> memory and the CPU -> MMIO path. > > What I think happens is that the store to txde0 is potentially still in > a buffer somewhere on its way to memory, gets bypassed by the store to > MMIO, causing the MAC to try to read the descriptor, and getting the > "old" data from memory. I see, but in general this sort of a problem should be resolved by adding an appropriate memory barrier. And in fact such barrier should (these days) be implied by a writel (I'm not 100% clear on why this driver uses iowrite, and if it matters). > It's ... fishy, but that isn't the first time an Aspeed chip has that > type of bug (there's a similar one in the USB device controler iirc). Argh.