From: Logan Gunthorpe <logang@deltatee.com>
To: Koichiro Den <den@valinux.co.jp>, Jon Mason <jdmason@kudzu.us>,
Dave Jiang <dave.jiang@intel.com>,
Allen Hubbe <allenbh@gmail.com>, Frank Li <Frank.Li@kernel.org>
Cc: fuyuanli <fuyuanli0722@gmail.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Nicholas Bellinger <nab@linux-iscsi.org>,
Joey Zhang <joey.zhang@microchip.com>,
ntb@lists.linux.dev, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH v3 06/15] NTB: ntb_transport: Avoid losing QP link-up requests
Date: Mon, 28 Sep 2026 10:57:12 -0600 [thread overview]
Message-ID: <49bb5e64-4428-4133-b201-e7475fd07f1d@deltatee.com> (raw)
In-Reply-To: <20260928152550.3354675-7-den@valinux.co.jp>
On 2026-09-28 09:25, Koichiro Den wrote:
> ntb_netdev_open() can call ntb_transport_link_up() while the transport
> worker is completing setup on another CPU. Concurrent transport setup
> and a client link-up request can both read the other's flag as false and
> leave QP link work unqueued. The QP then stays down until another link
> event or client link-up request.
>
> This is the store-buffering pattern described in
> tools/memory-model/Documentation/recipes.txt ("Store buffering").
>
> Add a full barrier between the store and load on each side.
>
> Fixes: fce8a7bb5b4b ("PCI-Express Non-Transparent Bridge Support")
> Cc: stable@vger.kernel.org
> Reported-by: Sashiko <sashiko-bot@kernel.org>
> Link: https://lore.kernel.org/r/20260907144701.702E41F00A3A@smtp.kernel.org/
> Signed-off-by: Koichiro Den <den@valinux.co.jp>
Thanks, I find smp_mb calls difficult to understand, but I think these
are correct. I expect I ran into this problem a few times back when I
was working on this code and had no idea the cause or how to fix it.
I have one minor suggestion below for the comment, other than that:
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
> diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
> index 51d9e9969065..d290e5869c21 100644
> --- a/drivers/ntb/ntb_transport.c
> +++ b/drivers/ntb/ntb_transport.c
> @@ -1101,6 +1101,12 @@ static void ntb_transport_link_work(struct work_struct *work)
> /* Publish the link only after every QP has been set up. */
> atomic_set_release(&nt->link_is_up, true);
>
> + /*
> + * Prevent both sides from missing each other's flag. Pairs with
> + * the barrier in ntb_transport_link_up().
> + */
> + smp_mb();
> +
I don't find this comment all that easy to understand. Can we expand it
a little? Maybe something like:
Order the link_is_up store before the client_ready loads below, so
that this path or ntb_transport_link_up() is guaranteed to see the
other's flag. Pairs with smp_mb() in ntb_transport_link_up().
Thanks,
Logan
next prev parent reply other threads:[~2026-09-28 16:57 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 15:25 [PATCH v3 00/15] NTB: ntb_transport: Miscellaneous fixes Koichiro Den
2026-09-28 15:25 ` [PATCH v3 01/15] NTB: ntb_transport: Remove the device debugfs directory Koichiro Den
2026-09-28 15:25 ` [PATCH v3 02/15] NTB: ntb_transport: Start TX offload thread after queue setup Koichiro Den
2026-09-28 15:25 ` [PATCH v3 03/15] NTB: ntb_transport: Make link setup flags atomic Koichiro Den
2026-09-28 15:53 ` Logan Gunthorpe
2026-09-28 15:25 ` [PATCH v3 04/15] NTB: ntb_transport: Avoid deadlock when cancelling link work Koichiro Den
2026-09-28 15:25 ` [PATCH v3 05/15] NTB: ntb_transport: Publish link state after QP setup Koichiro Den
2026-09-28 15:25 ` [PATCH v3 06/15] NTB: ntb_transport: Avoid losing QP link-up requests Koichiro Den
2026-09-28 16:57 ` Logan Gunthorpe [this message]
2026-09-29 1:43 ` Koichiro Den
2026-09-28 15:25 ` [PATCH v3 07/15] NTB: ntb_transport: Clear link state before QP cleanup Koichiro Den
2026-09-28 15:25 ` [PATCH v3 08/15] NTB: ntb_transport: Stop QP work before freeing a queue Koichiro Den
2026-09-28 15:25 ` [PATCH v3 09/15] NTB: ntb_transport: Stop RX tasklet scheduling " Koichiro Den
2026-09-28 15:25 ` [PATCH v3 10/15] NTB: ntb_transport: Drain RX tasklets during link cleanup Koichiro Den
2026-09-28 15:25 ` [PATCH v3 11/15] NTB: ntb_transport: Wait for RX completions before resetting a QP Koichiro Den
2026-09-28 15:25 ` [PATCH v3 12/15] NTB: ntb_transport: Prepare remote RX info accesses for MW teardown Koichiro Den
2026-09-28 15:25 ` [PATCH v3 13/15] NTB: ntb_transport: Clear QP pointers when freeing an MW Koichiro Den
2026-09-28 15:25 ` [PATCH v3 14/15] NTB: ntb_transport: Abort link setup on QP MW allocation failure Koichiro Den
2026-09-28 15:25 ` [PATCH v3 15/15] NTB: ntb_transport: Remove clients before freeing transport resources Koichiro Den
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=49bb5e64-4428-4133-b201-e7475fd07f1d@deltatee.com \
--to=logang@deltatee.com \
--cc=Frank.Li@kernel.org \
--cc=allenbh@gmail.com \
--cc=dave.jiang@intel.com \
--cc=den@valinux.co.jp \
--cc=fuyuanli0722@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jdmason@kudzu.us \
--cc=joey.zhang@microchip.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nab@linux-iscsi.org \
--cc=ntb@lists.linux.dev \
--cc=stable@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
all inboxes | Powered by JetHome®