[PATCH] RDMA/hfi1: quiesce SDMA asynchronous cleanup on exit

From: Hongyan Xu

Date: Mon Sep 28 2026 - 10:07:56 EST


The SDMA state reference and completion cover the software cleanup
tasklet, but not the hardware cleanup tasklet, err_halt_worker, or
flush_worker. Queued instances can therefore access an SDMA engine after
per_sdma is released.

After the state machine has stopped, cancel err_halt_worker first
because it can publish the hardware cleanup tasklet. Then kill that
tasklet and drain the remaining flush work.

Fixes: 7724105686e7 ("IB/hfi1: add driver files")
Signed-off-by: Hongyan Xu <getshell@xxxxxxxxxx>
---
drivers/infiniband/hw/hfi1/sdma.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/infiniband/hw/hfi1/sdma.c b/drivers/infiniband/hw/hfi1/sdma.c
index f253c8ee182d..a71fc8f2d37e 100644
--- a/drivers/infiniband/hw/hfi1/sdma.c
+++ b/drivers/infiniband/hw/hfi1/sdma.c
@@ -1569,6 +1569,9 @@ void sdma_exit(struct hfi1_devdata *dd)
* it is not running.
*/
sdma_finalput(&sde->state);
+ cancel_work_sync(&sde->err_halt_worker);
+ tasklet_kill(&sde->sdma_hw_clean_up_task);
+ cancel_work_sync(&sde->flush_worker);
}
}

--
2.50.1.windows.1