Hi Vipin Varghese, 
Thank you for your feedback! 

Yes we need graceful exit, directly calling eal_cleanup from secondary was not 
working, we can do the following workaround to use `eal_cleanup`.

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index b7affa6da9..5ef6008a3c 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -4347,7 +4347,12 @@ monitor_primary(void *arg __rte_unused)
                 * is no longer valid. Calling any cleanup code is going to
                 * run into use after free.
                 */
+               int ret;
                fprintf(stderr, "\nPrimary process is no longer active, 
exiting...\n");
+               ret = rte_eal_cleanup();
+               if (ret != 0)
+               rte_exit(EXIT_FAILURE,
+                        "EAL cleanup failed: %s\n", strerror(-ret));
                exit(EXIT_FAILURE);
        }
 }
diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
index 52efb8626b..087a4b1137 100644
--- a/lib/eal/linux/eal.c
+++ b/lib/eal/linux/eal.c
@@ -1333,9 +1333,12 @@ rte_eal_cleanup(void)
 #ifdef VFIO_PRESENT
        vfio_mp_sync_cleanup();
 #endif
-       rte_mp_channel_cleanup();
+       if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
+               rte_mp_channel_cleanup();
+               rte_eal_alarm_cleanup();
+       }
+
        eal_bus_cleanup();
-       rte_eal_alarm_cleanup();
        rte_trace_save();
        eal_trace_fini();
        eal_mp_dev_hotplug_cleanup();

If Stephen and others are agree, I can supersede this patch with 
the newer ones containing cleanup changes.

Thank you, 
Best Regards,
Khadem 

Reply via email to