From: Joel Stanley <joel@jms.id.au>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Jakub Kicinski <kuba@kernel.org>,
"David S . Miller" <davem@davemloft.net>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Dylan Hung <dylan_hung@aspeedtech.com>,
Networking <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
linux-aspeed <linux-aspeed@lists.ozlabs.org>,
Andrew Jeffery <andrew@aj.id.au>
Subject: Re: [PATCH] net: ftgmac100: Ensure tx descriptor updates are visible
Date: Thu, 22 Oct 2020 06:35:27 +0000 [thread overview]
Message-ID: <CACPK8Xe2AGRGCsbcmAixeKOD2phO9pXdSKqs5Y4Cx7z4TeVbvw@mail.gmail.com> (raw)
In-Reply-To: <CAK8P3a3gz4rMSkvZZ+TPaBx3B1yHXcUVFDdMFQMGUtEi4xXzyg@mail.gmail.com>
On Wed, 21 Oct 2020 at 12:40, Arnd Bergmann <arnd@kernel.org> wrote:
>
> On Wed, Oct 21, 2020 at 12:39 PM Joel Stanley <joel@jms.id.au> wrote:
>
> >
> > diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
> > index 331d4bdd4a67..15cdfeb135b0 100644
> > --- a/drivers/net/ethernet/faraday/ftgmac100.c
> > +++ b/drivers/net/ethernet/faraday/ftgmac100.c
> > @@ -653,6 +653,11 @@ static bool ftgmac100_tx_complete_packet(struct ftgmac100 *priv)
> > ftgmac100_free_tx_packet(priv, pointer, skb, txdes, ctl_stat);
> > txdes->txdes0 = cpu_to_le32(ctl_stat & priv->txdes0_edotr_mask);
> >
> > + /* Ensure the descriptor config is visible before setting the tx
> > + * pointer.
> > + */
> > + smp_wmb();
> > +
> > priv->tx_clean_pointer = ftgmac100_next_tx_pointer(priv, pointer);
> >
> > return true;
> > @@ -806,6 +811,11 @@ static netdev_tx_t ftgmac100_hard_start_xmit(struct sk_buff *skb,
> > dma_wmb();
> > first->txdes0 = cpu_to_le32(f_ctl_stat);
> >
> > + /* Ensure the descriptor config is visible before setting the tx
> > + * pointer.
> > + */
> > + smp_wmb();
> > +
>
> Shouldn't these be paired with smp_rmb() on the reader side?
Now that I've read memory-barriers.txt, yes, they should.
On my clarification of the description of the patch, I thought it was
about making sure that the txdes0 store (and thus setting of the
ownership bit) happens before the reader side checks that bit.
But we're not, we're making sure all of the writes to the descriptor
happen before updating the pointer, so when the reader side loads the
ownership bit in txdes0, it sees that store to txdes0 at that pointer.
I'll add in the read side barrier(s) and send a v2.
Cheers,
Joel
next prev parent reply other threads:[~2020-10-22 6:35 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
2020-10-21 12:40 ` Arnd Bergmann
2020-10-22 6:35 ` Joel Stanley [this message]
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=CACPK8Xe2AGRGCsbcmAixeKOD2phO9pXdSKqs5Y4Cx7z4TeVbvw@mail.gmail.com \
--to=joel@jms.id.au \
--cc=andrew@aj.id.au \
--cc=arnd@kernel.org \
--cc=benh@kernel.crashing.org \
--cc=davem@davemloft.net \
--cc=dylan_hung@aspeedtech.com \
--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).