From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2680CA04B8; Tue, 5 May 2020 11:38:19 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AB8F91BDAE; Tue, 5 May 2020 11:38:17 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 71BF6A3; Tue, 5 May 2020 11:38:15 +0200 (CEST) IronPort-SDR: IXxi4duiUhaFmcaAvzyYldB/uUlwGL0AQ0/qz8yQ5bA6CWt1PBtOml9PBYWqXDm6CxVRT8P4Ji 3nmITj7MwDmA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 May 2020 02:38:14 -0700 IronPort-SDR: y0msLUvUeOEMmnievI5fbOFrxl66lkDKPy2Fcw/V+xNzkq2bCroRoa6YvDQEnLZr4NobRHarss PwvqxwYgMY6A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,354,1583222400"; d="scan'208";a="434419835" Received: from silpixa00399779.ir.intel.com (HELO silpixa00399779.ger.corp.intel.com) ([10.237.222.209]) by orsmga005.jf.intel.com with ESMTP; 05 May 2020 02:38:13 -0700 From: Harry van Haaren To: dev@dpdk.org Cc: junx.w.zhou@intel.com, Harry van Haaren , stable@dpdk.org, pbhagavatula@caviumnetworks.com Date: Tue, 5 May 2020 10:39:04 +0100 Message-Id: <20200505093904.20616-1-harry.van.haaren@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] examples/eventdev_pipeline: fix segfault on exit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This commit fixes a segfault on exit by using Ctrl^C if the master lcore was also being used as a worker core. The root cause of the issue was that the interrupt handler was cleaning up resources such as the ethdev and eventdev ports, and once the interrupt handler would return, that thread would continue working as an eventdev worker, and dereference the memory which just had free() called on it. Fixed by moving the cleanup code from the interrupt handler to the cleanup stage of main(), which the master thread will execute once it has returned from its worker() functionality. Fixes: 085edac2ca38 ("examples/eventdev_pipeline: support Tx adapter") Signed-off-by: Harry van Haaren --- Cc: stable@dpdk.org Cc: pbhagavatula@caviumnetworks.com --- examples/eventdev_pipeline/main.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/examples/eventdev_pipeline/main.c b/examples/eventdev_pipeline/main.c index d0da51b1c..21958269f 100644 --- a/examples/eventdev_pipeline/main.c +++ b/examples/eventdev_pipeline/main.c @@ -301,12 +301,6 @@ signal_handler(int signum) rte_eal_mp_wait_lcore(); - RTE_ETH_FOREACH_DEV(portid) { - rte_eth_dev_close(portid); - } - - rte_event_dev_stop(0); - rte_event_dev_close(0); } if (signum == SIGTSTP) rte_event_dev_dump(0, stdout); @@ -469,5 +463,14 @@ main(int argc, char **argv) } + RTE_ETH_FOREACH_DEV(portid) { + rte_eth_dev_close(portid); + } + + rte_event_dev_stop(0); + rte_event_dev_close(0); + + rte_eal_cleanup(); + return 0; } -- 2.17.1