examples/l3fwd-power: fix ctrl+c issue

Message ID 20211029140556.1913267-1-harneet.singh@intel.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series examples/l3fwd-power: fix ctrl+c issue |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/github-robot: build success github build: passed
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing fail Testing issues
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS

Commit Message

Harneet Singh Oct. 29, 2021, 2:05 p.m. UTC
  Currently, EAL init cannot be interrupted with SIGINT because the
signal  handler is already overridden by the time EAL init happens.

Fix it by moving signal handler installation to after EAL
initialization, to allow SIGNIT to interrupt EAL initialization.

Fixes: d7937e2e3d12 ("power: initial import")
Cc: stable@dpdk.org

Signed-off-by: Harneet Singh <harneet.singh@intel.com>
  

Comments

Burakov, Anatoly Oct. 29, 2021, 3:50 p.m. UTC | #1
On 29-Oct-21 3:05 PM, Harneet Singh wrote:
> Currently, EAL init cannot be interrupted with SIGINT because the
> signal  handler is already overridden by the time EAL init happens.
> 
> Fix it by moving signal handler installation to after EAL
> initialization, to allow SIGNIT to interrupt EAL initialization.
> 
> Fixes: d7937e2e3d12 ("power: initial import")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Harneet Singh <harneet.singh@intel.com>
> 
> diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
> index 21c79567b1..002ba011c3 100644
> --- a/examples/l3fwd-power/main.c
> +++ b/examples/l3fwd-power/main.c
> @@ -2532,9 +2532,6 @@ main(int argc, char **argv)
>   	uint16_t portid;
>   	const char *ptr_strings[NUM_TELSTATS];
>   
> -	/* catch SIGINT and restore cpufreq governor to ondemand */
> -	signal(SIGINT, signal_exit_now);
> -
>   	/* init EAL */
>   	ret = rte_eal_init(argc, argv);
>   	if (ret < 0)
> @@ -2542,6 +2539,9 @@ main(int argc, char **argv)
>   	argc -= ret;
>   	argv += ret;
>   
> +	/* catch SIGINT and restore cpufreq governor to ondemand */
> +	signal(SIGINT, signal_exit_now);
> +
>   	/* init RTE timer library to be used late */
>   	rte_timer_subsystem_init();
>   
> 

Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
  
David Marchand Nov. 16, 2021, 2:24 p.m. UTC | #2
On Fri, Oct 29, 2021 at 5:50 PM Burakov, Anatoly
<anatoly.burakov@intel.com> wrote:
> On 29-Oct-21 3:05 PM, Harneet Singh wrote:
> > Currently, EAL init cannot be interrupted with SIGINT because the
> > signal handler is already overridden by the time EAL init happens.
> >
> > Fix it by moving signal handler installation to after EAL
> > initialization, to allow SIGNIT to interrupt EAL initialization.
> >
> > Fixes: d7937e2e3d12 ("power: initial import")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Harneet Singh <harneet.singh@intel.com>
> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>

Applied, thanks.
  

Patch

diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index 21c79567b1..002ba011c3 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -2532,9 +2532,6 @@  main(int argc, char **argv)
 	uint16_t portid;
 	const char *ptr_strings[NUM_TELSTATS];
 
-	/* catch SIGINT and restore cpufreq governor to ondemand */
-	signal(SIGINT, signal_exit_now);
-
 	/* init EAL */
 	ret = rte_eal_init(argc, argv);
 	if (ret < 0)
@@ -2542,6 +2539,9 @@  main(int argc, char **argv)
 	argc -= ret;
 	argv += ret;
 
+	/* catch SIGINT and restore cpufreq governor to ondemand */
+	signal(SIGINT, signal_exit_now);
+
 	/* init RTE timer library to be used late */
 	rte_timer_subsystem_init();