From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: David Laight <David.Laight@aculab.com>,
Joel Stanley <joel@jms.id.au>, Jakub Kicinski <kuba@kernel.org>,
"David S . Miller" <davem@davemloft.net>,
Dylan Hung <dylan_hung@aspeedtech.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-aspeed@lists.ozlabs.org" <linux-aspeed@lists.ozlabs.org>
Subject: Re: [PATCH] net: ftgmac100: Ensure tx descriptor updates are visible
Date: Thu, 22 Oct 2020 18:37:58 +1100 [thread overview]
Message-ID: <ef0d576f4eba266b60586b93c6ace79ed3cc7096.camel@kernel.crashing.org> (raw)
In-Reply-To: <dca2ce4487024eba9398426af86c761d@AcuMS.aculab.com>
On Wed, 2020-10-21 at 08:18 +0000, David Laight wrote:
> From: Benjamin Herrenschmidt
> > Sent: 21 October 2020 01:00
> >
> > On Wed, 2020-10-21 at 08:36 +1030, Joel Stanley wrote:
> > > We must ensure the tx descriptor updates are visible before updating
> > > the tx pointer.
> > >
> > > This resolves the tx hangs observed on the 2600 when running iperf:
> >
> > To clarify the comment here. This doesn't ensure they are visible to
> > the hardware but to other CPUs. This is the ordering vs start_xmit and
> > tx_complete.
>
> You need two barriers.
> 1) after making the data buffers available before transferring
> the descriptor ownership to the device.
> 2) after transferring the ownership before 'kicking' the mac engine.
>
> The first is needed because the mac engine can poll the descriptors
> at any time (eg on completing the previous transmit).
> This stops it transmitting garbage.
>
> The second makes sure it finds the descriptor you've just set.
> This stops delays before sending the packet.
> (But it will get sent later.)
The above is unrelated to this patch. This isn't about fixing any
device <-> CPU ordering or interaction but purely about ensuring proper
ordering between start_xmit and tx packet cleanup. IE. We are looking
at two different issues with this driver.
> For (2) dma_wmb() is the documented barrier.
>
> I'm not sure which barrier you need for (1).
> smp_wmb() would be right if the reader were another cpu,
> but it is (at most) a compile barrier on UP kernels.
> So you need something stronger than smp_wmb().
There should already be sufficient barriers for that in the driver
(except for the HW bug mentioned earlier).
> On a TSO system (which yours probably is) a compile barrier
> is probably sufficient, but if memory writes can get re-ordered
> it needs to be a stronger barrier - but not necessarily as strong
> as dma_wmb().
>
> David
>
> -
> Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
> Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2020-10-22 7:38 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-20 22:06 [PATCH] net: ftgmac100: Ensure tx descriptor updates are visible Joel Stanley
2020-10-21 0:00 ` Benjamin Herrenschmidt
2020-10-21 3:37 ` Joel Stanley
2020-10-21 8:18 ` David Laight
2020-10-22 7:37 ` Benjamin Herrenschmidt [this message]
2020-10-21 12:40 ` Arnd Bergmann
2020-10-22 6:35 ` Joel Stanley
2020-10-22 7:41 ` Benjamin Herrenschmidt
2020-10-28 4:47 ` Joel Stanley
2020-10-28 10:51 ` Arnd Bergmann
-- strict thread matches above, loose matches on Subject: below --
2024-08-22 7:30 Jacky Chou
2024-08-26 13:10 ` patchwork-bot+netdevbpf
2024-09-09 5:44 ` Joel Stanley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ef0d576f4eba266b60586b93c6ace79ed3cc7096.camel@kernel.crashing.org \
--to=benh@kernel.crashing.org \
--cc=David.Laight@aculab.com \
--cc=davem@davemloft.net \
--cc=dylan_hung@aspeedtech.com \
--cc=joel@jms.id.au \
--cc=kuba@kernel.org \
--cc=linux-aspeed@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).