Re: [PATCH v2 10/14] NTB: ntb_transport: Wait for RX completions before resetting a QP

From: Logan Gunthorpe

Date: Fri Sep 18 2026 - 13:22:26 EST




On 2026-09-09 22:08, Koichiro Den wrote:
> Transport link cleanup can free an MW still used by RX DMA or its
> completion path. QP-only cleanup retains the MW, but can restart RX
> on ring slots whose old completion callbacks have not yet cleared
> the headers.
>
> Wait for rx_post_q to empty before resetting the QP. ntb_complete_rxc()
> finishes its MW accesses before removing each entry under ntb_rx_q_lock,
> so cleanup can free the MW without racing with these RX accesses.
> Using dmaengine_terminate_sync() instead would not work with drivers
> such as IOAT that lack the required ops. Cookie-based waits would
> not work with DMA_COMPLETION_NO_ORDER either.
>
> DMA teardown in ntb_transport_free_queue() is unchanged.
>
> Fixes: 9143595a7e05 ("NTB: ntb_transport: Free MWs in ntb_transport_link_cleanup()")
> Cc: stable@xxxxxxxxxxxxxxx
> Reported-by: Sashiko <sashiko-bot@xxxxxxxxxx>
> Link: https://lore.kernel.org/r/20260907144257.767281F00A3A@xxxxxxxxxxxxxxx/
> Signed-off-by: Koichiro Den <den@xxxxxxxxxxxxx>

Looks good to me,

Reviewed-by: Logan Gunthorpe <logang@xxxxxxxxxxxx>