patches for DPDK stable branches
 help / color / mirror / Atom feed
From: <psatheesh@marvell.com>
To: Nithin Dabilpuram <ndabilpuram@marvell.com>,
	Kiran Kumar K <kirankumark@marvell.com>,
	Sunil Kumar Kori <skori@marvell.com>,
	Satha Rao <skoteshwar@marvell.com>,
	Harman Kalra <hkalra@marvell.com>
Cc: <dev@dpdk.org>, Satheesh Paul <psatheesh@marvell.com>, <stable@dpdk.org>
Subject: [dpdk-dev] [PATCH] common/cnxk: fix flow aging cleanup
Date: Wed, 8 May 2024 16:27:13 +0530	[thread overview]
Message-ID: <20240508105713.3207940-1-psatheesh@marvell.com> (raw)

From: Satheesh Paul <psatheesh@marvell.com>

The aged flows poll thread is not stopped before NPC cleanup
resulting in a segmentation fault. Fixing this by stopping
aged flows poll thread before proceeding with NPC cleanup.

Fixes: 357f5ebc8a24 ("common/cnxk: support flow aging")
Cc: stable@dpdk.org

Signed-off-by: Satheesh Paul <psatheesh@marvell.com>
Reviewed-by: Kiran Kumar K <kirankumark@marvell.com>
---
 drivers/common/cnxk/roc_npc.c       | 5 +++--
 drivers/common/cnxk/roc_npc_aging.c | 8 +++++---
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/common/cnxk/roc_npc.c b/drivers/common/cnxk/roc_npc.c
index d6ad3756bb..37e1a6a7ef 100644
--- a/drivers/common/cnxk/roc_npc.c
+++ b/drivers/common/cnxk/roc_npc.c
@@ -389,6 +389,8 @@ roc_npc_fini(struct roc_npc *roc_npc)
 	struct npc *npc = roc_npc_to_npc_priv(roc_npc);
 	int rc;
 
+	npc_aging_ctrl_thread_destroy(roc_npc);
+
 	rc = npc_flow_free_all_resources(npc);
 	if (rc) {
 		plt_err("Error when deleting NPC MCAM entries, counters");
@@ -1810,8 +1812,7 @@ roc_npc_flow_destroy(struct roc_npc *roc_npc, struct roc_npc_flow *flow)
 	if (flow->has_age_action)
 		npc_age_flow_list_entry_delete(roc_npc, flow);
 
-	if (roc_npc->flow_age.age_flow_refcnt == 0 &&
-		plt_thread_is_valid(roc_npc->flow_age.aged_flows_poll_thread))
+	if (roc_npc->flow_age.age_flow_refcnt == 0)
 		npc_aging_ctrl_thread_destroy(roc_npc);
 
 done:
diff --git a/drivers/common/cnxk/roc_npc_aging.c b/drivers/common/cnxk/roc_npc_aging.c
index e0f2dc2291..15f6e61d76 100644
--- a/drivers/common/cnxk/roc_npc_aging.c
+++ b/drivers/common/cnxk/roc_npc_aging.c
@@ -303,9 +303,11 @@ npc_aging_ctrl_thread_destroy(struct roc_npc *roc_npc)
 	struct roc_npc_flow_age *flow_age;
 
 	flow_age = &roc_npc->flow_age;
-	flow_age->aged_flows_get_thread_exit = true;
-	plt_thread_join(flow_age->aged_flows_poll_thread, NULL);
-	npc_aged_flows_bitmap_free(roc_npc);
+	if (plt_thread_is_valid(flow_age->aged_flows_poll_thread)) {
+		flow_age->aged_flows_get_thread_exit = true;
+		plt_thread_join(flow_age->aged_flows_poll_thread, NULL);
+		npc_aged_flows_bitmap_free(roc_npc);
+	}
 }
 
 void *
-- 
2.39.2


             reply	other threads:[~2024-05-08 10:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-08 10:57 psatheesh [this message]
2024-05-27  6:08 ` Jerin Jacob

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=20240508105713.3207940-1-psatheesh@marvell.com \
    --to=psatheesh@marvell.com \
    --cc=dev@dpdk.org \
    --cc=hkalra@marvell.com \
    --cc=kirankumark@marvell.com \
    --cc=ndabilpuram@marvell.com \
    --cc=skori@marvell.com \
    --cc=skoteshwar@marvell.com \
    --cc=stable@dpdk.org \
    /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;
as well as URLs for NNTP newsgroup(s).