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 4EAE7A00C2; Fri, 17 Jun 2022 04:36:09 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6D92B4281B; Fri, 17 Jun 2022 04:35:55 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id B6C3F410D2 for ; Fri, 17 Jun 2022 04:35:51 +0200 (CEST) Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4LPNNs62mmzSgsh; Fri, 17 Jun 2022 10:32:29 +0800 (CST) Received: from localhost.localdomain (10.67.165.24) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 17 Jun 2022 10:35:37 +0800 From: Chengwen Feng To: , , CC: , , Subject: [PATCH v3 1/4] eal: fix segment fault when exit trace Date: Fri, 17 Jun 2022 10:29:10 +0800 Message-ID: <20220617022913.47564-2-fengchengwen@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220617022913.47564-1-fengchengwen@huawei.com> References: <20220607120014.49823-1-fengchengwen@huawei.com> <20220617022913.47564-1-fengchengwen@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpeml500024.china.huawei.com (7.185.36.10) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Bug scenario: 1. start testpmd: dpdk-testpmd -l 4-6 -a 0000:7d:00.0 --trace=.* -- -i 2. quit testpmd and then observed segment fault: Bye... Segmentation fault (core dumped) The root cause is that rte_trace_save() and eal_trace_fini() access the huge pages which were cleanup by rte_eal_memory_detach(). This patch moves rte_trace_save() and eal_trace_fini() before rte_eal_memory_detach() to fix the bug. Fixes: dfbc61a2f9a6 ("mem: detach memsegs on cleanup") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng Tested-by: Jerin Jacob Reviewed-by: David Marchand --- lib/eal/freebsd/eal.c | 4 ++-- lib/eal/linux/eal.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c index a6b20960f2..26fbc91b26 100644 --- a/lib/eal/freebsd/eal.c +++ b/lib/eal/freebsd/eal.c @@ -893,11 +893,11 @@ rte_eal_cleanup(void) eal_get_internal_configuration(); rte_service_finalize(); rte_mp_channel_cleanup(); + rte_trace_save(); + eal_trace_fini(); /* after this point, any DPDK pointers will become dangling */ rte_eal_memory_detach(); rte_eal_alarm_cleanup(); - rte_trace_save(); - eal_trace_fini(); eal_cleanup_config(internal_conf); return 0; } diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c index 1ef263434a..c6f2056197 100644 --- a/lib/eal/linux/eal.c +++ b/lib/eal/linux/eal.c @@ -1266,13 +1266,13 @@ rte_eal_cleanup(void) vfio_mp_sync_cleanup(); #endif rte_mp_channel_cleanup(); + rte_trace_save(); + eal_trace_fini(); /* after this point, any DPDK pointers will become dangling */ rte_eal_memory_detach(); eal_mp_dev_hotplug_cleanup(); rte_eal_malloc_heap_cleanup(); rte_eal_alarm_cleanup(); - rte_trace_save(); - eal_trace_fini(); eal_cleanup_config(internal_conf); rte_eal_log_cleanup(); return 0; -- 2.33.0