From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6064EC47247 for ; Tue, 5 May 2020 09:38:19 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id D6B6C20675 for ; Tue, 5 May 2020 09:38:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D6B6C20675 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org 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