Skip to contentSkip to conversation

RDMA/hfi1: quiesce SDMA asynchronous cleanup on exit

PATCH Applied Hongyan Xu 3 participants 3 messages Sep 28 – Sep 30

Subsystems (2)
lore
Share & tools
lore

Hongyan Xu

author
#0 lore raw

PATCH 1/1 RDMA/hfi1: quiesce SDMA asynchronous cleanup on exit

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")
---
 drivers/infiniband/hw/hfi1/sdma.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/infiniband/hw/hfi1/sdma.c +3 -0
index f253c8ee182d..a71fc8f2d37e 100644
@@ -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);
 	}
 }
 
Signature · 1 line
2.50.1.windows.1
#1 lore raw
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 11 lines

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")

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#2 lore raw
In reply to Hongyan Xu
Quoted 10 lines · Hongyan Xu

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.

[...]

Applied, thanks!

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

      https://git.kernel.org/rdma/rdma/c/a57bf5ee252f5d

Best regards,

Signature · 1 line
Leon Romanovsky <[email protected]>