[dpdk-dev] [PATCH 1/3] rte_interrupts: add rte_eal_intr_exit to shut down IRQ thread

Liang, Cunming cunming.liang at intel.com
Wed Mar 9 10:05:02 CET 2016


Hi Mattew,

> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Matthew Hall
> Sent: Sunday, February 14, 2016 5:39 AM
> To: dev at 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 at 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



More information about the dev mailing list