DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] [v1 1/1] examples/kni: fix SIGTERM signal handling
@ 2020-02-04  8:42 vattunuru
  2020-02-04 13:37 ` Ferruh Yigit
  2020-02-06 11:53 ` [dpdk-dev] [PATCH] [v2 1/1] examples/kni: add " vattunuru
  0 siblings, 2 replies; 4+ messages in thread
From: vattunuru @ 2020-02-04  8:42 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, david.marchand, thomas, Vamsi Attunuru, stable

From: Vamsi Attunuru <vattunuru@marvell.com>

Current KNI example application is not handling SIGTERM
signal when application is killed without passing any
specific signal in kill command.

Patch uses the existing signal handler for SIGTERM as well
for graceful application exit.

Fixes: 13c4ebd65a77 ("examples: minor changes")
Cc: stable@dpdk.org

Signed-off-by: Vamsi Attunuru <vattunuru@marvell.com>
---
 examples/kni/main.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/examples/kni/main.c b/examples/kni/main.c
index 5f713e6..29fc37e 100644
--- a/examples/kni/main.c
+++ b/examples/kni/main.c
@@ -176,9 +176,13 @@ signal_handler(int signum)
 		return;
 	}
 
-	/* When we receive a RTMIN or SIGINT signal, stop kni processing */
-	if (signum == SIGRTMIN || signum == SIGINT){
-		printf("\nSIGRTMIN/SIGINT received. KNI processing stopping.\n");
+	/*
+	 * When we receive a RTMIN or SIGINT or SIGTERM signal,
+	 * stop kni processing
+	 */
+	if (signum == SIGRTMIN || signum == SIGINT || signum == SIGTERM) {
+		printf("\nSIGRTMIN/SIGINT/SIGTERM received. "
+			"KNI processing stopping.\n");
 		rte_atomic32_inc(&kni_stop);
 		return;
         }
@@ -1006,6 +1010,7 @@ main(int argc, char** argv)
 	signal(SIGUSR2, signal_handler);
 	signal(SIGRTMIN, signal_handler);
 	signal(SIGINT, signal_handler);
+	signal(SIGTERM, signal_handler);
 
 	/* Initialise EAL */
 	ret = rte_eal_init(argc, argv);
-- 
2.8.4


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH] [v1 1/1] examples/kni: fix SIGTERM signal handling
  2020-02-04  8:42 [dpdk-dev] [PATCH] [v1 1/1] examples/kni: fix SIGTERM signal handling vattunuru
@ 2020-02-04 13:37 ` Ferruh Yigit
  2020-02-06 11:53 ` [dpdk-dev] [PATCH] [v2 1/1] examples/kni: add " vattunuru
  1 sibling, 0 replies; 4+ messages in thread
From: Ferruh Yigit @ 2020-02-04 13:37 UTC (permalink / raw)
  To: vattunuru, dev; +Cc: david.marchand, thomas, stable

On 2/4/2020 8:42 AM, vattunuru@marvell.com wrote:
> From: Vamsi Attunuru <vattunuru@marvell.com>
> 
> Current KNI example application is not handling SIGTERM
> signal when application is killed without passing any
> specific signal in kill command.
> 
> Patch uses the existing signal handler for SIGTERM as well
> for graceful application exit.
> 
> Fixes: 13c4ebd65a77 ("examples: minor changes")
> Cc: stable@dpdk.org

Hi Vamsi,

No concern adding SIGTERM handling, although you can use 'kill' to send
supported signal (or just C-c (SIGINT)), it doesn't hurt to handle SIGTERM too
but that is not a fix.

Can you please reword to commit log to say SIGTERM handling added? Feel free to
add my ack on to it.

> 
> Signed-off-by: Vamsi Attunuru <vattunuru@marvell.com>
> ---
>  examples/kni/main.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/examples/kni/main.c b/examples/kni/main.c
> index 5f713e6..29fc37e 100644
> --- a/examples/kni/main.c
> +++ b/examples/kni/main.c
> @@ -176,9 +176,13 @@ signal_handler(int signum)
>  		return;
>  	}
>  
> -	/* When we receive a RTMIN or SIGINT signal, stop kni processing */
> -	if (signum == SIGRTMIN || signum == SIGINT){
> -		printf("\nSIGRTMIN/SIGINT received. KNI processing stopping.\n");
> +	/*
> +	 * When we receive a RTMIN or SIGINT or SIGTERM signal,
> +	 * stop kni processing
> +	 */
> +	if (signum == SIGRTMIN || signum == SIGINT || signum == SIGTERM) {
> +		printf("\nSIGRTMIN/SIGINT/SIGTERM received. "
> +			"KNI processing stopping.\n");
>  		rte_atomic32_inc(&kni_stop);
>  		return;
>          }
> @@ -1006,6 +1010,7 @@ main(int argc, char** argv)
>  	signal(SIGUSR2, signal_handler);
>  	signal(SIGRTMIN, signal_handler);
>  	signal(SIGINT, signal_handler);
> +	signal(SIGTERM, signal_handler);
>  
>  	/* Initialise EAL */
>  	ret = rte_eal_init(argc, argv);
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-dev] [PATCH] [v2 1/1] examples/kni: add SIGTERM signal handling
  2020-02-04  8:42 [dpdk-dev] [PATCH] [v1 1/1] examples/kni: fix SIGTERM signal handling vattunuru
  2020-02-04 13:37 ` Ferruh Yigit
@ 2020-02-06 11:53 ` vattunuru
  2020-02-13 17:36   ` David Marchand
  1 sibling, 1 reply; 4+ messages in thread
From: vattunuru @ 2020-02-06 11:53 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, david.marchand, thomas, Vamsi Attunuru

From: Vamsi Attunuru <vattunuru@marvell.com>

SIGTERM handling is added for graceful application exit.
Useful when application is terminated without specifying
any signal on 'kill' command.

Signed-off-by: Vamsi Attunuru <vattunuru@marvell.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
v2 Change:
* Changed commit log

 examples/kni/main.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/examples/kni/main.c b/examples/kni/main.c
index 5f713e6..29fc37e 100644
--- a/examples/kni/main.c
+++ b/examples/kni/main.c
@@ -176,9 +176,13 @@ signal_handler(int signum)
 		return;
 	}
 
-	/* When we receive a RTMIN or SIGINT signal, stop kni processing */
-	if (signum == SIGRTMIN || signum == SIGINT){
-		printf("\nSIGRTMIN/SIGINT received. KNI processing stopping.\n");
+	/*
+	 * When we receive a RTMIN or SIGINT or SIGTERM signal,
+	 * stop kni processing
+	 */
+	if (signum == SIGRTMIN || signum == SIGINT || signum == SIGTERM) {
+		printf("\nSIGRTMIN/SIGINT/SIGTERM received. "
+			"KNI processing stopping.\n");
 		rte_atomic32_inc(&kni_stop);
 		return;
         }
@@ -1006,6 +1010,7 @@ main(int argc, char** argv)
 	signal(SIGUSR2, signal_handler);
 	signal(SIGRTMIN, signal_handler);
 	signal(SIGINT, signal_handler);
+	signal(SIGTERM, signal_handler);
 
 	/* Initialise EAL */
 	ret = rte_eal_init(argc, argv);
-- 
2.8.4


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH] [v2 1/1] examples/kni: add SIGTERM signal handling
  2020-02-06 11:53 ` [dpdk-dev] [PATCH] [v2 1/1] examples/kni: add " vattunuru
@ 2020-02-13 17:36   ` David Marchand
  0 siblings, 0 replies; 4+ messages in thread
From: David Marchand @ 2020-02-13 17:36 UTC (permalink / raw)
  To: Vamsi Attunuru; +Cc: dev, Yigit, Ferruh, Thomas Monjalon

On Thu, Feb 6, 2020 at 12:54 PM <vattunuru@marvell.com> wrote:
>
> From: Vamsi Attunuru <vattunuru@marvell.com>
>
> SIGTERM handling is added for graceful application exit.
> Useful when application is terminated without specifying
> any signal on 'kill' command.
>
> Signed-off-by: Vamsi Attunuru <vattunuru@marvell.com>
> Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>

Applied, thanks.


--
David Marchand


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-02-13 17:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-04  8:42 [dpdk-dev] [PATCH] [v1 1/1] examples/kni: fix SIGTERM signal handling vattunuru
2020-02-04 13:37 ` Ferruh Yigit
2020-02-06 11:53 ` [dpdk-dev] [PATCH] [v2 1/1] examples/kni: add " vattunuru
2020-02-13 17:36   ` David Marchand

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).