mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hongyan Xu <getshell@seu.edu.cn>
To: sgoutham@marvell.com, rkannoth@marvell.com
Cc: gakula@marvell.com, sbhatta@marvell.com, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, jianhao.xu@seu.edu.cn,
	Hongyan Xu <getshell@seu.edu.cn>
Subject: [PATCH net] net: octeontx2-af: quiesce devlink health work on teardown
Date: Mon, 28 Sep 2026 21:41:29 +0800	[thread overview]
Message-ID: <20260928134129.145-1-getshell@seu.edu.cn> (raw)

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")
Signed-off-by: Hongyan Xu <getshell@seu.edu.cn>
---
 .../marvell/octeontx2/af/rvu_devlink.c        | 46 +++++++++++++------
 1 file changed, 32 insertions(+), 14 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c
index d63c3d33775a..c7c7230dc588 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c
@@ -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 */
-- 
2.50.1.windows.1


             reply	other threads:[~2026-09-28 13:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-28 13:41 Hongyan Xu [this message]
2026-09-28 13:46 ` netdev-bot+sinfo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260928134129.145-1-getshell@seu.edu.cn \
    --to=getshell@seu.edu.cn \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=gakula@marvell.com \
    --cc=jianhao.xu@seu.edu.cn \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rkannoth@marvell.com \
    --cc=sbhatta@marvell.com \
    --cc=sgoutham@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®