Skip to contentSkip to conversation

net: octeontx2-af: quiesce devlink health work on teardown

PATCH Applied Hongyan Xu 3 participants 3 messages Sep 28 – Oct 2

Subsystems (3)
lore
Share & tools
lore

Hongyan Xu

author
#0 lore raw

PATCH 1/1 net: octeontx2-af: quiesce devlink health work on teardown

NPA and NIX interrupt handlers queue health-reporting work whose containers are freed by rvu_health_reporters_destroy(). Interrupt unregistration does not drain queued work. In addition, each reporter setup creates a workqueue in the same field, leaking the NPA queue and leaving no teardown handle for work queued on it.

Initialize work before later allocations can fail, share one workqueue, unregister each set of interrupts, and cancel its work before freeing the reporters. Destroy the shared workqueue once both reporter sets are gone.

Fixes f1168d1e207c ("octeontx2-af: Add devlink health reporters for NPA")
Fixes 5ed66306eab6 ("octeontx2-af: Add devlink health reporters for NIX")
---
 .../marvell/octeontx2/af/rvu_devlink.c        | 46 +++++++++++++------
 1 file changed, 32 insertions(+), 14 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c +32 -14
index d63c3d33775a..c7c7230dc588 100644
@@ -505,6 +505,11 @@ static int rvu_nix_register_reporters(struct rvu_devlink *rvu_dl)
 		return -ENOMEM;
 
 	rvu_reporters->nix_event_ctx = nix_event_context;
+	INIT_WORK(&rvu_reporters->intr_work, rvu_nix_intr_work);
+	INIT_WORK(&rvu_reporters->gen_work, rvu_nix_gen_work);
+	INIT_WORK(&rvu_reporters->err_work, rvu_nix_err_work);
+	INIT_WORK(&rvu_reporters->ras_work, rvu_nix_ras_work);
+
 	rvu_reporters->rvu_hw_nix_intr_reporter =
 		devlink_health_reporter_create(rvu_dl->dl,
 					       &rvu_hw_nix_intr_reporter_ops,
@@ -545,15 +550,11 @@ static int rvu_nix_register_reporters(struct rvu_devlink *rvu_dl)
 		return PTR_ERR(rvu_reporters->rvu_hw_nix_ras_reporter);
 	}
 
-	rvu_dl->devlink_wq = create_workqueue("rvu_devlink_wq");
+	if (!rvu_dl->devlink_wq)
+		rvu_dl->devlink_wq = create_workqueue("rvu_devlink_wq");
 	if (!rvu_dl->devlink_wq)
 		return -ENOMEM;
 
-	INIT_WORK(&rvu_reporters->intr_work, rvu_nix_intr_work);
-	INIT_WORK(&rvu_reporters->gen_work, rvu_nix_gen_work);
-	INIT_WORK(&rvu_reporters->err_work, rvu_nix_err_work);
-	INIT_WORK(&rvu_reporters->ras_work, rvu_nix_ras_work);
-
 	return 0;
 }
 
@@ -582,6 +583,13 @@ static void rvu_nix_health_reporters_destroy(struct rvu_devlink *rvu_dl)
 
 	if (!nix_reporters->rvu_hw_nix_ras_reporter)
 		return;
+
+	rvu_nix_unregister_interrupts(rvu);
+	cancel_work_sync(&nix_reporters->intr_work);
+	cancel_work_sync(&nix_reporters->gen_work);
+	cancel_work_sync(&nix_reporters->err_work);
+	cancel_work_sync(&nix_reporters->ras_work);
+
 	if (!IS_ERR_OR_NULL(nix_reporters->rvu_hw_nix_intr_reporter))
 		devlink_health_reporter_destroy(nix_reporters->rvu_hw_nix_intr_reporter);
 
@@ -594,7 +602,6 @@ static void rvu_nix_health_reporters_destroy(struct rvu_devlink *rvu_dl)
 	if (!IS_ERR_OR_NULL(nix_reporters->rvu_hw_nix_ras_reporter))
 		devlink_health_reporter_destroy(nix_reporters->rvu_hw_nix_ras_reporter);
 
-	rvu_nix_unregister_interrupts(rvu);
 	kfree(rvu_dl->rvu_nix_health_reporter->nix_event_ctx);
 	kfree(rvu_dl->rvu_nix_health_reporter);
 }
@@ -1059,6 +1066,11 @@ static int rvu_npa_register_reporters(struct rvu_devlink *rvu_dl)
 		return -ENOMEM;
 
 	rvu_reporters->npa_event_ctx = npa_event_context;
+	INIT_WORK(&rvu_reporters->intr_work, rvu_npa_intr_work);
+	INIT_WORK(&rvu_reporters->err_work, rvu_npa_err_work);
+	INIT_WORK(&rvu_reporters->gen_work, rvu_npa_gen_work);
+	INIT_WORK(&rvu_reporters->ras_work, rvu_npa_ras_work);
+
 	rvu_reporters->rvu_hw_npa_intr_reporter =
 		devlink_health_reporter_create(rvu_dl->dl,
 					       &rvu_hw_npa_intr_reporter_ops,
@@ -1099,15 +1111,11 @@ static int rvu_npa_register_reporters(struct rvu_devlink *rvu_dl)
 		return PTR_ERR(rvu_reporters->rvu_hw_npa_ras_reporter);
 	}
 
-	rvu_dl->devlink_wq = create_workqueue("rvu_devlink_wq");
+	if (!rvu_dl->devlink_wq)
+		rvu_dl->devlink_wq = create_workqueue("rvu_devlink_wq");
 	if (!rvu_dl->devlink_wq)
 		return -ENOMEM;
 
-	INIT_WORK(&rvu_reporters->intr_work, rvu_npa_intr_work);
-	INIT_WORK(&rvu_reporters->err_work, rvu_npa_err_work);
-	INIT_WORK(&rvu_reporters->gen_work, rvu_npa_gen_work);
-	INIT_WORK(&rvu_reporters->ras_work, rvu_npa_ras_work);
-
 	return 0;
 }
 
@@ -1136,6 +1144,13 @@ static void rvu_npa_health_reporters_destroy(struct rvu_devlink *rvu_dl)
 
 	if (!npa_reporters->rvu_hw_npa_ras_reporter)
 		return;
+
+	rvu_npa_unregister_interrupts(rvu);
+	cancel_work_sync(&npa_reporters->intr_work);
+	cancel_work_sync(&npa_reporters->gen_work);
+	cancel_work_sync(&npa_reporters->err_work);
+	cancel_work_sync(&npa_reporters->ras_work);
+
 	if (!IS_ERR_OR_NULL(npa_reporters->rvu_hw_npa_intr_reporter))
 		devlink_health_reporter_destroy(npa_reporters->rvu_hw_npa_intr_reporter);
 
@@ -1148,7 +1163,6 @@ static void rvu_npa_health_reporters_destroy(struct rvu_devlink *rvu_dl)
 	if (!IS_ERR_OR_NULL(npa_reporters->rvu_hw_npa_ras_reporter))
 		devlink_health_reporter_destroy(npa_reporters->rvu_hw_npa_ras_reporter);
 
-	rvu_npa_unregister_interrupts(rvu);
 	kfree(rvu_dl->rvu_npa_health_reporter->npa_event_ctx);
 	kfree(rvu_dl->rvu_npa_health_reporter);
 }
@@ -1176,6 +1190,10 @@ static void rvu_health_reporters_destroy(struct rvu *rvu)
 	rvu_dl = rvu->rvu_dl;
 	rvu_npa_health_reporters_destroy(rvu_dl);
 	rvu_nix_health_reporters_destroy(rvu_dl);
+	if (rvu_dl->devlink_wq) {
+		destroy_workqueue(rvu_dl->devlink_wq);
+		rvu_dl->devlink_wq = NULL;
+	}
 }
 
 /* Devlink Params APIs */
Signature · 1 line
2.50.1.windows.1
#1 lore raw
This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:

Hi!

This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:

- How the issue was discovered, e.g. hit in production, hit during development, syzbot report, manual code inspection, LLM or static analysis tool scan.

- Whether the issue was actually triggered, or is only theoretical (e.g. found by code inspection). If it was triggered please include the symptoms, like the stack trace or error messages.

- What hardware the change was tested on. For driver fixes please mention the device (and if relevant firmware version) used for testing, or say that the change was not tested on real hardware.

Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account. If the series needs another revision for other reasons, please include the information in the commit messages then.

The evaluation is done by an LLM so it may be wrong, if you think that is the case please reply and explain.

#2 lore raw
In reply to Hongyan Xu
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 6 lines · On Mon, 28 Sep 2026 21:41:29 +0800 you wrote:

NPA and NIX interrupt handlers queue health-reporting work whose containers are freed by rvu_health_reporters_destroy(). Interrupt unregistration does not drain queued work. In addition, each reporter setup creates a workqueue in the same field, leaking the NPA queue and leaving no teardown handle for work queued on it.

Quoted 6 lines

Initialize work before later allocations can fail, share one workqueue, unregister each set of interrupts, and cancel its work before freeing the reporters. Destroy the shared workqueue once both reporter sets are gone.

[...]

Here is the summary with links:
- [net] net: octeontx2-af: quiesce devlink health work on teardown

    https://git.kernel.org/netdev/net-next/c/1b7bc043cd1b

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html