Skip to contentSkip to conversation

RDMA/hfi1: shut down the trap timer before unregistering

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: shut down the trap timer before unregistering

MAD processing arms a trap timer embedded in each hfi1_ibport. Device unregistration does not stop the timer, so its callback can run after the port and its containing hfi1_devdata have been released.

Shut down every port timer before unregistering the IB device. The shutdown form also prevents a concurrent path from rearming the timer.

Fixes bf90aadd630c ("IB/hfi1: Send MAD traps until repressed")
---
 drivers/infiniband/hw/hfi1/verbs.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/infiniband/hw/hfi1/verbs.c +4 -0
index e569b647d611..0ef3b1a89a53 100644
@@ -1888,6 +1888,10 @@ err_verbs_txreq:
 void hfi1_unregister_ib_device(struct hfi1_devdata *dd)
 {
 	struct hfi1_ibdev *dev = &dd->verbs_dev;
+	int i;
+
+	for (i = 0; i < dd->num_pports; i++)
+		timer_shutdown_sync(&dd->pport[i].ibport_data.rvp.trap_timer);
 
 	hfi1_verbs_unregister_sysfs(dd);
 
Signature · 1 line
2.50.1.windows.1
#1 lore raw
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 9 lines

MAD processing arms a trap timer embedded in each hfi1_ibport. Device unregistration does not stop the timer, so its callback can run after the port and its containing hfi1_devdata have been released.

Shut down every port timer before unregistering the IB device. The shutdown form also prevents a concurrent path from rearming the timer.

Fixes bf90aadd630c ("IB/hfi1: Send MAD traps until repressed")

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 8 lines · Hongyan Xu

MAD processing arms a trap timer embedded in each hfi1_ibport. Device unregistration does not stop the timer, so its callback can run after the port and its containing hfi1_devdata have been released.

Shut down every port timer before unregistering the IB device. The shutdown form also prevents a concurrent path from rearming the timer.

[...]

Applied, thanks!

[1/1] RDMA/hfi1: shut down the trap timer before unregistering

      https://git.kernel.org/rdma/rdma/c/23baaac7287bd6

Best regards,

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