DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Liang, Cunming" <cunming.liang@intel.com>
To: Matthew Hall <mhall@mhcomputing.net>, "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH 1/3] rte_interrupts: add rte_eal_intr_exit to	shut down IRQ thread
Date: Wed, 9 Mar 2016 09:05:02 +0000	[thread overview]
Message-ID: <D0158A423229094DA7ABF71CF2FA0DA3154CCB6C@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <1455399524-3252-1-git-send-email-mhall@mhcomputing.net>

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
> 
> 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.
> 
> Signed-off-by: Matthew Hall <mhall@mhcomputing.net>
> ---
>  lib/librte_eal/common/include/rte_eal.h      |  9 +++++++++
>  lib/librte_eal/linuxapp/eal/eal_interrupts.c | 11 +++++++++++
>  2 files changed, 20 insertions(+)
> 
> 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);
> 
>  /**
> + * 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. 
I don't think you're going to gracefully exit intr thread but leave all other 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 time, 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 != 0)
>  			RTE_LOG(ERR, EAL,
>  			"Failed to set thread name for interrupt handling\n");
> +
> +int
> +rte_eal_intr_exit(void)
> +{
> +	int ret = 0;
> +
> +	ret = pthread_cancel(intr_thread);
> +	if (ret != 0) {
> +		RTE_LOG(ERR, EAL,
> +			"Failed to cancel thread for interrupt handling\n");
> +		return -ret;
>  	}
> 
>  	return -ret;
> --
> 2.5.0

  parent reply	other threads:[~2016-03-09  9:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-13 21:38 Matthew Hall
2016-02-13 21:38 ` [dpdk-dev] [PATCH 2/3] eal_interrupts: mark EAL interrupt thread as a daemon thread Matthew Hall
2016-02-13 21:38 ` [dpdk-dev] [PATCH 3/3] rte_epoll_wait: allow EINTR to be passed to caller Matthew Hall
2016-02-28 21:17 ` [dpdk-dev] [PATCH 1/3] rte_interrupts: add rte_eal_intr_exit to shut down IRQ thread Thomas Monjalon
2016-03-08 15:09   ` Thomas Monjalon
2016-03-09  9:05 ` Liang, Cunming [this message]
2016-03-17 22:55 ` [dpdk-dev] [dpdk-dev, " Matthew Hall
2016-03-21  7:58   ` Liang, Cunming
2016-03-22  7:39     ` Matthew Hall
2016-03-23  3:24       ` Liang, Cunming
2016-07-08 17:36         ` Thomas Monjalon
2016-07-11  4:07           ` Liang, Cunming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=D0158A423229094DA7ABF71CF2FA0DA3154CCB6C@shsmsx102.ccr.corp.intel.com \
    --to=cunming.liang@intel.com \
    --cc=dev@dpdk.org \
    --cc=mhall@mhcomputing.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).