Re: [PATCH v4] RDMA/siw: publish QP after initialization
From: Jason Gunthorpe
Date: Thu Jul 02 2026 - 13:41:57 EST
On Tue, Jun 30, 2026 at 02:00:40PM +0800, Ruoyu Wang wrote:
> siw_create_qp() currently calls siw_qp_add() before the queues, CQ
> pointers, state, completion, and device list entry are ready. A QPN
> lookup can therefore reach a QP that is still being constructed.
>
> Move siw_qp_add() to the end of siw_create_qp(), after QP
> initialization and before adding the QP to the siw device list.
>
> Fixes: f29dd55b0236 ("rdma/siw: queue pair methods")
> Suggested-by: Bernard Metzler <bernard.metzler@xxxxxxxxx>
> Signed-off-by: Ruoyu Wang <ruoyuw560@xxxxxxxxx>
> Acked-by: Bernard Metzler <bernard.metzler@xxxxxxxxx>
> ---
> Changes in v4:
> - Move `if (udata->outlen < sizeof(uresp))` into the second `if (udata)`
> clause, right before ib_copy_to_udata() (Bernard Metzler).
> - Move INIT_LIST_HEAD(&qp->devq) to just before spin_lock_irqsave(),
> close to list_add_tail() where it logically belongs (Bernard Metzler).
>
> Changes in v3:
> - Move siw_qp_add()/xa_alloc() to the end of siw_create_qp().
> - Drop the QPN reservation helper from v2.
>
> drivers/infiniband/sw/siw/siw_verbs.c | 57 ++++++++++++++++----------
> 1 file changed, 35 insertions(+), 22 deletions(-)
Applied to for-rc, thanks
Jason