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 1E7D9A00C5; Thu, 7 May 2020 12:08:06 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 545051DB99; Thu, 7 May 2020 12:08:05 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id E36181DB8B; Thu, 7 May 2020 12:08:03 +0200 (CEST) IronPort-SDR: EZnpHkAngtlXp74CYTxKUNHLRxHdBqVoyKXMKi/3/necF7Whc/yRRTCnNcduGzah0J+1Cr8tii PMiuYZps3B0Q== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 May 2020 03:08:01 -0700 IronPort-SDR: sdELas3go2aaVGeSaSH7MEEsgRR6uZPFr0n/+o/Bm2jQxEctb9R9Dj3K00bB4mEV3+7E7c8uCn 8MDdmD79xAwg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,363,1583222400"; d="scan'208";a="296479916" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga008.jf.intel.com with ESMTP; 07 May 2020 03:08:00 -0700 Received: from fmsmsx112.amr.corp.intel.com (10.18.116.6) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 7 May 2020 03:08:00 -0700 Received: from cdsmsx101.ccr.corp.intel.com (172.17.3.36) by FMSMSX112.amr.corp.intel.com (10.18.116.6) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 7 May 2020 03:08:00 -0700 Received: from cdsmsx102.ccr.corp.intel.com ([169.254.2.168]) by CDSMSX101.ccr.corp.intel.com ([169.254.1.113]) with mapi id 14.03.0439.000; Thu, 7 May 2020 18:07:56 +0800 From: "Zhou, JunX W" To: "Van Haaren, Harry" , "dev@dpdk.org" CC: "stable@dpdk.org" , "pbhagavatula@caviumnetworks.com" Thread-Topic: [PATCH] examples/eventdev_pipeline: fix segfault on exit Thread-Index: AQHWIsDqbVCqcLzu60aCnk3a2bhTt6icaKPw Date: Thu, 7 May 2020 10:07:56 +0000 Message-ID: References: <20200505093904.20616-1-harry.van.haaren@intel.com> In-Reply-To: <20200505093904.20616-1-harry.van.haaren@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.17.6.105] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [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" Tested-by: Zhou, JunX W -----Original Message----- From: Van Haaren, Harry=20 Sent: Tuesday, May 5, 2020 5:39 PM To: dev@dpdk.org Cc: Zhou, JunX W ; Van Haaren, Harry ; stable@dpdk.org; pbhagavatula@caviumnetworks.com Subject: [PATCH] examples/eventdev_pipeline: fix segfault on exit This commit fixes a segfault on exit by using Ctrl^C if the master lcore wa= s also being used as a worker core. The root cause of the issue was that th= e interrupt handler was cleaning up resources such as the ethdev and eventd= ev ports, and once the interrupt handler would return, that thread would co= ntinue 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) =20 rte_eal_mp_wait_lcore(); =20 - RTE_ETH_FOREACH_DEV(portid) { - rte_eth_dev_close(portid); - } - - rte_event_dev_stop(0); - rte_event_dev_close(0); } if (signum =3D=3D SIGTSTP) rte_event_dev_dump(0, stdout); @@ -469,5 +463,14 @@ main(int argc, char **argv) =20 } =20 + 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