From: Joe Damato <joe@dama.to>
To: Koichiro Den <den@valinux.co.jp>
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 01/10] NTB: ntb_transport: Order RX descriptor reads after completion
Date: Fri, 18 Sep 2026 17:36:43 -0700 [thread overview]
Message-ID: <aq3ZG222WqEDp1Je@devvm20253.cco0.facebook.com> (raw)
In-Reply-To: <20260914084838.2158249-2-den@valinux.co.jp>
On Mon, Sep 14, 2026 at 05:48:29PM +0900, Koichiro Den wrote:
> The peer writes payloads and descriptors into a DMA-coherent memory
> window. ntb_process_rxc() checks DESC_DONE_FLAG before consuming the
> descriptor and payload, but coherent memory alone does not order those
> reads on weakly ordered CPUs.
>
> Read the completion word once and issue dma_rmb() after DONE is observed.
> Use the saved word for subsequent transport flag checks.
>
> Fixes: fce8a7bb5b4b ("PCI-Express Non-Transparent Bridge Support")
> Reported-by: Sashiko <sashiko-bot@kernel.org>
> Link: https://lore.kernel.org/r/20260815032932.151F11F000E9@smtp.kernel.org/
> Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> Signed-off-by: Koichiro Den <den@valinux.co.jp>
> ---
> Changes in v4:
> - No changes.
>
> drivers/ntb/ntb_transport.c | 14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
> index f9caa1a653c5..74f4f8c1c7be 100644
> --- a/drivers/ntb/ntb_transport.c
> +++ b/drivers/ntb/ntb_transport.c
> @@ -1609,21 +1609,25 @@ static int ntb_process_rxc(struct ntb_transport_qp *qp)
> {
> struct ntb_payload_header *hdr;
> struct ntb_queue_entry *entry;
> + unsigned int flags;
> void *offset;
>
> offset = qp->rx_buff + qp->rx_max_frame * qp->rx_index;
> hdr = offset + qp->rx_max_frame - sizeof(struct ntb_payload_header);
>
> - dev_dbg(&qp->ndev->pdev->dev, "qp %d: RX ver %u len %d flags %x\n",
> - qp->qp_num, hdr->ver, hdr->len, hdr->flags);
> -
> - if (!(hdr->flags & DESC_DONE_FLAG)) {
> + flags = READ_ONCE(hdr->flags);
> + if (!(flags & DESC_DONE_FLAG)) {
> dev_dbg(&qp->ndev->pdev->dev, "done flag not set\n");
I get why the dev_dbg line above was moved down, but i feel like if this case
is hit, you lose some of the debugability that the debug line intended?
idk maybe this dev_dbg should be something like
dev_dbg(blah->dev, "qp %d: done flag not set, flags %x\n", qp->qp_num, flags)
so that some of the debuggability is still preserved when this case is hit ?
> qp->rx_ring_empty++;
> return -EAGAIN;
> }
>
> - if (hdr->flags & LINK_DOWN_FLAG) {
> + dma_rmb();
> +
> + dev_dbg(&qp->ndev->pdev->dev, "qp %d: RX ver %u len %d flags %x\n",
> + qp->qp_num, hdr->ver, hdr->len, flags);
I guess the above is a nit, so
Reviewed-by: Joe Damato <joe@dama.to>
next prev parent reply other threads:[~2026-09-19 0:36 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 [this message]
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
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=aq3ZG222WqEDp1Je@devvm20253.cco0.facebook.com \
--to=joe@dama.to \
--cc=allenbh@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=dave.jiang@intel.com \
--cc=davem@davemloft.net \
--cc=den@valinux.co.jp \
--cc=edumazet@google.com \
--cc=jdmason@kudzu.us \
--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®