examples/l3fwd-power: fix early shutdown
authorHarneet Singh <harneet.singh@intel.com>
Fri, 29 Oct 2021 14:05:56 +0000 (14:05 +0000)
committerDavid Marchand <david.marchand@redhat.com>
Tue, 16 Nov 2021 15:22:26 +0000 (16:22 +0100)
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")
Fixes: 613ce6691c0d ("examples/l3fwd-power: implement proper shutdown")
Cc: stable@dpdk.org
Signed-off-by: Harneet Singh <harneet.singh@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
examples/l3fwd-power/main.c

index 6988a0e..b8b3be2 100644 (file)
@@ -2540,9 +2540,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)
@@ -2550,6 +2547,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();