From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 75C5E28BF for ; Wed, 9 Mar 2016 10:05:06 +0100 (CET) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP; 09 Mar 2016 01:05:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,310,1455004800"; d="scan'208";a="62700047" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga004.fm.intel.com with ESMTP; 09 Mar 2016 01:05:05 -0800 Received: from fmsmsx152.amr.corp.intel.com (10.18.125.5) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 9 Mar 2016 01:05:05 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.110.15) by FMSMSX152.amr.corp.intel.com (10.18.125.5) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 9 Mar 2016 01:05:05 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.232]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.132]) with mapi id 14.03.0248.002; Wed, 9 Mar 2016 17:05:03 +0800 From: "Liang, Cunming" To: Matthew Hall , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH 1/3] rte_interrupts: add rte_eal_intr_exit to shut down IRQ thread Thread-Index: AQHRZqb7/PLsuNWKeka6K+gweJa73J9Q8MPw Date: Wed, 9 Mar 2016 09:05:02 +0000 Message-ID: References: <1455399524-3252-1-git-send-email-mhall@mhcomputing.net> In-Reply-To: <1455399524-3252-1-git-send-email-mhall@mhcomputing.net> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH 1/3] rte_interrupts: add rte_eal_intr_exit to shut down IRQ thread X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Mar 2016 09:05:07 -0000 Hi Mattew, > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Matthew Hall > Sent: Sunday, February 14, 2016 5:39 AM > To: dev@dpdk.org > Subject: [dpdk-dev] [PATCH 1/3] rte_interrupts: add rte_eal_intr_exit to = shut > down IRQ thread >=20 > There is no good way to shut down this thread from an application signal > handler. Here we add an rte_eal_intr_exit() function to allow this. >=20 > Signed-off-by: Matthew Hall > --- > lib/librte_eal/common/include/rte_eal.h | 9 +++++++++ > lib/librte_eal/linuxapp/eal/eal_interrupts.c | 11 +++++++++++ > 2 files changed, 20 insertions(+) >=20 > diff --git a/lib/librte_eal/common/include/rte_eal.h > b/lib/librte_eal/common/include/rte_eal.h > index d2816a8..1533eeb 100644 > --- a/lib/librte_eal/common/include/rte_eal.h > +++ b/lib/librte_eal/common/include/rte_eal.h > @@ -165,6 +165,15 @@ int rte_eal_init(int argc, char **argv); > typedef void (*rte_usage_hook_t)(const char * prgname); >=20 > /** > + * Shut down the EAL interrupt thread. > + * > + * This function can be called from a signal handler during application > + * shutdown. > + * > + */ > +int rte_eal_intr_exit(void); I'm trying to understand the motivation.=20 I don't think you're going to gracefully exit intr thread but leave all oth= er eal threads live. We don't have API to new launch intr thread again. So I guess your app is using own pthread(none EAL thread), you're trying to= safely shutdown the whole application by your signal handler. For this purpose, the device shall close safely(turn off intr) during the t= ime, intr thread still wait but no event will be raised. In this view, it seems not necessary to have this new. Can you explain more= detail for the purpose? Thanks. > + > +/** > * Add application usage routine callout from the eal_usage() routine. > * > * This function allows the application to include its usage message > diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c > b/lib/librte_eal/linuxapp/eal/eal_interrupts.c > index b33ccdb..aa332a1 100644 > --- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c > +++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c > @@ -892,6 +892,17 @@ rte_eal_intr_init(void) > if (ret_1 !=3D 0) > RTE_LOG(ERR, EAL, > "Failed to set thread name for interrupt handling\n"); > + > +int > +rte_eal_intr_exit(void) > +{ > + int ret =3D 0; > + > + ret =3D pthread_cancel(intr_thread); > + if (ret !=3D 0) { > + RTE_LOG(ERR, EAL, > + "Failed to cancel thread for interrupt handling\n"); > + return -ret; > } >=20 > return -ret; > -- > 2.5.0