All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH rdma] RDMA/mlx5: Cancel software CQ notifications before teardown
@ 2026-10-08 14:12 Prathamesh Deshpande
  2026-10-08 14:24 ` sashiko-bot
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Prathamesh Deshpande @ 2026-10-08 14:12 UTC (permalink / raw)
  To: Leon Romanovsky, Jason Gunthorpe
  Cc: Prathamesh Deshpande, Doug Ledford, Haggai Eran, linux-rdma,
	linux-kernel

GSI completions queue notify_work to invoke the CQ completion handler.
CQ destruction drains hardware events and core polling, but does not
cancel this software notifier. Queued or running work can therefore
access a freed CQ, or restart polling after ib_free_cq() has drained it.

Cancel notify_work in the pre-destroy callback, before core polling is
stopped and CQ memory is released. Skip user CQs, which do not initialize
this work item.

Fixes: 25361e02c448 ("IB/mlx5: Generate completions in software")
Signed-off-by: Prathamesh Deshpande <prathameshdeshpande7@gmail.com>
---
 drivers/infiniband/hw/mlx5/cq.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/infiniband/hw/mlx5/cq.c b/drivers/infiniband/hw/mlx5/cq.c
index 49b4bf148a4a..1653b2747f5f 100644
--- a/drivers/infiniband/hw/mlx5/cq.c
+++ b/drivers/infiniband/hw/mlx5/cq.c
@@ -1117,6 +1117,9 @@ int mlx5_ib_pre_destroy_cq(struct ib_cq *cq)
 	struct mlx5_ib_dev *dev = to_mdev(cq->device);
 	struct mlx5_ib_cq *mcq = to_mcq(cq);
 
+	if (!cq->uobject)
+		cancel_work_sync(&mcq->notify_work);
+
 	return mlx5_core_destroy_cq(dev->mdev, &mcq->mcq);
 }
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-10-12  7:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-08 14:12 [PATCH rdma] RDMA/mlx5: Cancel software CQ notifications before teardown Prathamesh Deshpande
2026-10-08 14:24 ` sashiko-bot
2026-10-12  7:53 ` Leon Romanovsky
2026-10-12  7:54 ` Leon Romanovsky

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.