From: Dave Jiang <dave.jiang@intel.com>
To: Koichiro Den <den@valinux.co.jp>, Jon Mason <jdmason@kudzu.us>,
Allen Hubbe <allenbh@gmail.com>, Frank Li <Frank.Li@kernel.org>,
Logan Gunthorpe <logang@deltatee.com>
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 08/15] NTB: ntb_transport: Stop QP work before freeing a queue
Date: Fri, 9 Oct 2026 16:11:58 -0700 [thread overview]
Message-ID: <3cacaab6-c90a-44ee-b357-65ffbd1b8ade@intel.com> (raw)
In-Reply-To: <20260928152550.3354675-9-den@valinux.co.jp>
On 9/28/26 8:25 AM, Koichiro Den wrote:
> ntb_transport_free_queue() cancels qp->link_work but not qp->link_cleanup.
> A peer link-down message can queue cleanup while ntb_netdev is freeing
> the QP. Cleanup can then requeue link work after the queue resources
> have been freed.
>
> Disable and wait for cleanup, then link work, before freeing resources.
> Unlike cancel, disable also prevents the RX tasklet and transport link
> setup from queuing more work. Enable the works only after queue creation
> succeeds.
>
> Clear client_ready first so RX completions and transport link setup see
> that the client is no longer ready. Clear link_is_up and active after
> the workers stop, since link work can set both back to true.
>
> Fixes: 7b4f2d3c3b82 ("NTB: No sleeping in interrupt context")
> Cc: stable@vger.kernel.org
> Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
> Signed-off-by: Koichiro Den <den@valinux.co.jp>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> ---
> Changes in v3:
> - Clear client_ready with atomic_set().
> - Carry over Reviewed-by.
>
> v2: https://lore.kernel.org/r/20260910040836.3792333-8-den@valinux.co.jp/
>
> drivers/ntb/ntb_transport.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
> index 571d633c4f0b..556e1d255284 100644
> --- a/drivers/ntb/ntb_transport.c
> +++ b/drivers/ntb/ntb_transport.c
> @@ -1239,6 +1239,8 @@ static int ntb_transport_init_queue(struct ntb_transport_ctx *nt,
>
> INIT_DELAYED_WORK(&qp->link_work, ntb_qp_link_work);
> INIT_WORK(&qp->link_cleanup, ntb_qp_link_cleanup_work);
> + disable_delayed_work(&qp->link_work);
> + disable_work(&qp->link_cleanup);
>
> spin_lock_init(&qp->ntb_rx_q_lock);
> spin_lock_init(&qp->ntb_tx_free_q_lock);
> @@ -2152,6 +2154,9 @@ ntb_transport_create_queue(void *data, struct device *client_dev,
> }
> }
>
> + enable_work(&qp->link_cleanup);
> + enable_delayed_work(&qp->link_work);
> +
> ntb_db_clear(qp->ndev, qp_bit);
> ntb_db_clear_mask(qp->ndev, qp_bit);
>
> @@ -2197,6 +2202,10 @@ void ntb_transport_free_queue(struct ntb_transport_qp *qp)
>
> pdev = qp->ndev->pdev;
>
> + atomic_set(&qp->client_ready, false);
> + disable_work_sync(&qp->link_cleanup);
> + disable_delayed_work_sync(&qp->link_work);
> + qp->link_is_up = false;
> qp->active = false;
>
> if (qp->tx_offload_thread) {
> @@ -2244,8 +2253,6 @@ void ntb_transport_free_queue(struct ntb_transport_qp *qp)
> ntb_db_set_mask(qp->ndev, qp_bit);
> tasklet_kill(&qp->rxc_db_work);
>
> - cancel_delayed_work_sync(&qp->link_work);
> -
> qp->cb_data = NULL;
> qp->rx_handler = NULL;
> qp->tx_handler = NULL;
next prev parent reply other threads:[~2026-10-09 23:12 UTC|newest]
Thread overview: 23+ 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-10-09 23:08 ` Dave Jiang
2026-09-28 15:25 ` [PATCH v3 04/15] NTB: ntb_transport: Avoid deadlock when cancelling link work Koichiro Den
2026-10-09 23:09 ` Dave Jiang
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
2026-09-29 1:43 ` Koichiro Den
2026-10-09 23:11 ` Dave Jiang
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-10-09 23:11 ` Dave Jiang [this message]
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=3cacaab6-c90a-44ee-b357-65ffbd1b8ade@intel.com \
--to=dave.jiang@intel.com \
--cc=Frank.Li@kernel.org \
--cc=allenbh@gmail.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=logang@deltatee.com \
--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®