mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Koichiro Den <den@valinux.co.jp>
To: Joe Damato <joe@dama.to>
Cc: Jon Mason <jdmason@kudzu.us>, Dave Jiang <dave.jiang@intel.com>,
	 Allen Hubbe <allenbh@gmail.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	 "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	 Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	ntb@lists.linux.dev,  netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v4 03/10] NTB: ntb_transport: Order RX entry completion
Date: Sat, 19 Sep 2026 21:53:41 +0900	[thread overview]
Message-ID: <wecjjkz7m4uk737tymgpk4y3o2a5a2tpkepojyyosgrmonuib6@mtmqftofk2w2> (raw)
In-Reply-To: <aq3hD4D+VfMUd7vq@devvm20253.cco0.facebook.com>

On Fri, Sep 18, 2026 at 06:10:39PM -0700, Joe Damato wrote:
> On Mon, Sep 14, 2026 at 05:48:31PM +0900, Koichiro Den wrote:
> > RX entries are added to rx_post_q before their fields are filled in.
> > The overflow path sets DONE without a write barrier, and
> > ntb_complete_rxc() has no read barrier after checking DONE. A concurrent
> > completion can therefore consume stale entry fields.
> > 
> > Publish DONE with release ordering and check it with acquire ordering in
> > ntb_complete_rxc(). Use the same publication rule in the copy callback.
> > 
> > Fixes: da2e5ae56164 ("NTB: Fix ntb_transport out-of-order RX update")
> > Cc: stable@vger.kernel.org
> > Reported-by: Sashiko <sashiko-bot@kernel.org>
> > Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260904052134.2970111-1-den%40valinux.co.jp?part=3
> > Signed-off-by: Koichiro Den <den@valinux.co.jp>
> > ---
> > Changes in v4:
> >   - New patch (Sashiko)
> > 
> >  drivers/ntb/ntb_transport.c | 9 ++++++---
> >  1 file changed, 6 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
> > index 3f497a62673f..b69e8ac8047d 100644
> > --- a/drivers/ntb/ntb_transport.c
> > +++ b/drivers/ntb/ntb_transport.c
> 
> [...]
> 
> > -	entry->flags |= DESC_DONE_FLAG;
> > +	/* Pair with the acquire load in ntb_complete_rxc(). */
> > +	smp_store_release(&entry->flags, entry->flags | DESC_DONE_FLAG);
>                                           ^^^^^^^^^^^
> 
> 
> >  
> >  	ntb_complete_rxc(entry->qp);
> >  }
> > @@ -1664,7 +1666,8 @@ static int ntb_process_rxc(struct ntb_transport_qp *qp)
> >  		qp->rx_err_oflow++;
> >  
> >  		entry->len = -EIO;
> > -		entry->flags |= DESC_DONE_FLAG;
> > +		/* Pair with the acquire load in ntb_complete_rxc(). */
> > +		smp_store_release(&entry->flags, entry->flags | DESC_DONE_FLAG);
>                                                  ^^^^^^^^^^^^
> 
> are these two smp_store_release lines right? i am asking because it looks like
> they do a load ? i honestly have no idea if there is a race here but it looks
> sus to me

There are no concurrent writers to entry->flags here, so I think the plain load
on the right hand side is fine.

Best regards,
Koichiro

  reply	other threads:[~2026-09-19 12:53 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-14  8:48 [PATCH net-next v4 00/10] net: ntb_netdev: Preserve checksum offload across NTB Koichiro Den
2026-09-14  8:48 ` [PATCH net-next v4 01/10] NTB: ntb_transport: Order RX descriptor reads after completion Koichiro Den
2026-09-19  0:36   ` Joe Damato
2026-09-19 12:37     ` Koichiro Den
2026-09-14  8:48 ` [PATCH net-next v4 02/10] NTB: ntb_transport: Use little-endian shared fields Koichiro Den
2026-09-19  0:54   ` Joe Damato
2026-09-19 13:06     ` Koichiro Den
2026-09-14  8:48 ` [PATCH net-next v4 03/10] NTB: ntb_transport: Order RX entry completion Koichiro Den
2026-09-19  1:10   ` Joe Damato
2026-09-19 12:53     ` Koichiro Den [this message]
2026-09-14  8:48 ` [PATCH net-next v4 04/10] NTB: ntb_transport: Keep local QP link requests separate Koichiro Den
2026-09-17 20:49   ` netdev-bot+sashiko
2026-09-14  8:48 ` [PATCH net-next v4 05/10] NTB: ntb_transport: Exchange client capabilities at link-up Koichiro Den
2026-09-17 20:49   ` netdev-bot+sashiko
2026-09-14  8:48 ` [PATCH net-next v4 06/10] NTB: ntb_transport: Add per-payload client metadata Koichiro Den
2026-09-14  8:48 ` [PATCH net-next v4 07/10] net: ntb_netdev: Reject short RX frames Koichiro Den
2026-09-19  1:14   ` Joe Damato
2026-09-14  8:48 ` [PATCH net-next v4 08/10] net: ntb_netdev: Factor out RX statistics update Koichiro Den
2026-09-14  8:48 ` [PATCH net-next v4 09/10] net: ntb_netdev: Introduce an optional packet header, ntb_netdev_hdr Koichiro Den
2026-09-17 20:49   ` netdev-bot+sashiko
2026-09-14  8:48 ` [PATCH net-next v4 10/10] net: ntb_netdev: Preserve CHECKSUM_PARTIAL across NTB Koichiro Den
2026-09-17 20:49   ` netdev-bot+sashiko

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=wecjjkz7m4uk737tymgpk4y3o2a5a2tpkepojyyosgrmonuib6@mtmqftofk2w2 \
    --to=den@valinux.co.jp \
    --cc=allenbh@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=dave.jiang@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jdmason@kudzu.us \
    --cc=joe@dama.to \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=ntb@lists.linux.dev \
    --cc=pabeni@redhat.com \
    /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

all inboxes | Powered by JetHome®