From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2F56F43FDF for ; Wed, 8 May 2024 12:57:23 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 26F1243579; Wed, 8 May 2024 12:57:23 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 4D653432C4; Wed, 8 May 2024 12:57:21 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4489OOTU007954; Wed, 8 May 2024 03:57:20 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding:content-type; s=pfpt0220; bh=NrmXG5m0 ibmFXyxQg9yIy4pd985+IETTqFKjwk7tT3A=; b=HwBqysowLKT3HxLbiwE5I/CA GSyIDn4OdnOfeHi+b4OVYJxcJ1azBGtkxJzVOvuFeFSgErzy6iFUFploUTYgxqrL 8LnKqqv8O0f7M5qnv3UIjKPYoPhk6+tANgjyFgDojyo/QBeNDdpETvcQBD39oDv5 Q1XPbE1ISr6SNeeZnu6hk1mQKs39SEZpEFAKgg+MLU1NVzIBCNzH9X0bRfcbXWaI lv8BjGRgjcZGJcQqINfJ9wR5Wz9603yHQvnwWq4AKdAqi18IaQ+OCwwB8R3CPAB3 FuaOChmC557w3bH1O9ulus5x3mzz8Rr4LwEy+43kHpk0Ao7Rdzv6AKu4Nic4vQ== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3xysfnjya7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 May 2024 03:57:20 -0700 (PDT) Received: from DC5-EXCH05.marvell.com (10.69.176.209) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 8 May 2024 03:57:19 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Wed, 8 May 2024 03:57:19 -0700 Received: from cavium-OptiPlex-3070-BM17.. (unknown [10.28.34.33]) by maili.marvell.com (Postfix) with ESMTP id 8A3D83F7091; Wed, 8 May 2024 03:57:16 -0700 (PDT) From: To: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , Harman Kalra CC: , Satheesh Paul , Subject: [dpdk-dev] [PATCH] common/cnxk: fix flow aging cleanup Date: Wed, 8 May 2024 16:27:13 +0530 Message-ID: <20240508105713.3207940-1-psatheesh@marvell.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: u1njhzXOIxtx9jmXVp580kZTlmi3AaJs X-Proofpoint-GUID: u1njhzXOIxtx9jmXVp580kZTlmi3AaJs X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-05-08_07,2024-05-08_01,2023-05-22_02 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org From: Satheesh Paul 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 Reviewed-by: Kiran Kumar K --- 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