* [PATCH] IB/hfi1: Shutdown self-rearming timers before freeing
@ 2026-09-30 7:04 Runyu Xiao
2026-09-30 7:24 ` sashiko-bot
2026-09-30 13:25 ` Leon Romanovsky
0 siblings, 2 replies; 3+ messages in thread
From: Runyu Xiao @ 2026-09-30 7:04 UTC (permalink / raw)
To: Dennis Dalessandro
Cc: Jason Gunthorpe, Leon Romanovsky, linux-rdma, linux-kernel,
stable, Runyu Xiao, Jianhao Xu
The HFI1 receive error and synthetic counter timers rearm themselves from
their callbacks. Their cleanup paths use timer_delete_sync(), which only
waits for a running callback and does not prevent a concurrent or
subsequent rearm.
Use timer_shutdown_sync() when releasing these timers. This prevents a
callback from enqueueing either timer after cleanup begins, before the
containing hfi1_devdata is freed.
Preserve the existing work cancellation and workqueue destruction ordering
for synthetic counters.
Fixes: 7724105686e7 ("IB/hfi1: add driver files")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
---
drivers/infiniband/hw/hfi1/chip.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/infiniband/hw/hfi1/chip.c b/drivers/infiniband/hw/hfi1/chip.c
index 592e330e74bf1..faa724ca33bd7 100644
--- a/drivers/infiniband/hw/hfi1/chip.c
+++ b/drivers/infiniband/hw/hfi1/chip.c
@@ -5567,7 +5567,7 @@ static int init_rcverr(struct hfi1_devdata *dd)
static void free_rcverr(struct hfi1_devdata *dd)
{
if (dd->rcverr_timer.function)
- timer_delete_sync(&dd->rcverr_timer);
+ timer_shutdown_sync(&dd->rcverr_timer);
}
static void handle_rxe_err(struct hfi1_devdata *dd, u32 unused, u64 reg)
@@ -12300,7 +12300,7 @@ static void free_cntrs(struct hfi1_devdata *dd)
int i;
if (dd->synth_stats_timer.function)
- timer_delete_sync(&dd->synth_stats_timer);
+ timer_shutdown_sync(&dd->synth_stats_timer);
cancel_work_sync(&dd->update_cntr_work);
ppd = (struct hfi1_pportdata *)(dd + 1);
for (i = 0; i < dd->num_pports; i++, ppd++) {
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] IB/hfi1: Shutdown self-rearming timers before freeing
2026-09-30 7:04 [PATCH] IB/hfi1: Shutdown self-rearming timers before freeing Runyu Xiao
@ 2026-09-30 7:24 ` sashiko-bot
2026-09-30 13:25 ` Leon Romanovsky
1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-09-30 7:24 UTC (permalink / raw)
To: Runyu Xiao; +Cc: linux-rdma
> The HFI1 receive error and synthetic counter timers rearm themselves from
> their callbacks. Their cleanup paths use timer_delete_sync(), which only
> waits for a running callback and does not prevent a concurrent or
> subsequent rearm.
>
> Use timer_shutdown_sync() when releasing these timers. This prevents a
> callback from enqueueing either timer after cleanup begins, before the
> containing hfi1_devdata is freed.
>
> Preserve the existing work cancellation and workqueue destruction ordering
> for synthetic counters.
>
> Fixes: 7724105686e7 ("IB/hfi1: add driver files")
> Cc: stable@vger.kernel.org
> Assisted-by: LLM
> Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260930070455.2934286-1-runyu.xiao@seu.edu.cn?part=1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] IB/hfi1: Shutdown self-rearming timers before freeing
2026-09-30 7:04 [PATCH] IB/hfi1: Shutdown self-rearming timers before freeing Runyu Xiao
2026-09-30 7:24 ` sashiko-bot
@ 2026-09-30 13:25 ` Leon Romanovsky
1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2026-09-30 13:25 UTC (permalink / raw)
To: Dennis Dalessandro, Runyu Xiao
Cc: Jason Gunthorpe, linux-rdma, linux-kernel, stable, Jianhao Xu
On Wed, 30 Sep 2026 15:04:55 +0800, Runyu Xiao wrote:
> The HFI1 receive error and synthetic counter timers rearm themselves from
> their callbacks. Their cleanup paths use timer_delete_sync(), which only
> waits for a running callback and does not prevent a concurrent or
> subsequent rearm.
>
> Use timer_shutdown_sync() when releasing these timers. This prevents a
> callback from enqueueing either timer after cleanup begins, before the
> containing hfi1_devdata is freed.
>
> [...]
Applied, thanks!
[1/1] IB/hfi1: Shutdown self-rearming timers before freeing
https://git.kernel.org/rdma/rdma/c/9d3259e41ccd50
Best regards,
--
Leon Romanovsky <leon@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-09-30 13:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-30 7:04 [PATCH] IB/hfi1: Shutdown self-rearming timers before freeing Runyu Xiao
2026-09-30 7:24 ` sashiko-bot
2026-09-30 13:25 ` Leon Romanovsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox