]> git.droids-corp.org - dpdk.git/commitdiff
trace: fix crash when exiting
authorChengwen Feng <fengchengwen@huawei.com>
Fri, 17 Jun 2022 02:29:10 +0000 (10:29 +0800)
committerDavid Marchand <david.marchand@redhat.com>
Tue, 21 Jun 2022 09:11:00 +0000 (11:11 +0200)
Bug scenario:
1. start testpmd:
  $ dpdk-testpmd -l 4-6 -a 0000:7d:00.0 --trace=.* -- -i
2. quit testpmd and then observed segment fault:
  Bye...
  Segmentation fault (core dumped)

The root cause is that rte_trace_save() and eal_trace_fini() access
the huge pages which were cleanup by rte_eal_memory_detach().

This patch moves rte_trace_save() and eal_trace_fini() before
rte_eal_memory_detach() to fix the bug.

Fixes: dfbc61a2f9a6 ("mem: detach memsegs on cleanup")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Tested-by: Jerin Jacob <jerinj@marvell.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
lib/eal/freebsd/eal.c
lib/eal/linux/eal.c

index a6b20960f2d5f5c790eaf8daddc89fc801c47b4e..26fbc91b267f1830be2efcaf211705f09b9941eb 100644 (file)
@@ -893,11 +893,11 @@ rte_eal_cleanup(void)
                eal_get_internal_configuration();
        rte_service_finalize();
        rte_mp_channel_cleanup();
+       rte_trace_save();
+       eal_trace_fini();
        /* after this point, any DPDK pointers will become dangling */
        rte_eal_memory_detach();
        rte_eal_alarm_cleanup();
-       rte_trace_save();
-       eal_trace_fini();
        eal_cleanup_config(internal_conf);
        return 0;
 }
index 1ef263434abec8a8e64c86f79099cdcddf38b667..c6f205619797076b39f960644acf8847d7f2a863 100644 (file)
@@ -1266,13 +1266,13 @@ rte_eal_cleanup(void)
        vfio_mp_sync_cleanup();
 #endif
        rte_mp_channel_cleanup();
+       rte_trace_save();
+       eal_trace_fini();
        /* after this point, any DPDK pointers will become dangling */
        rte_eal_memory_detach();
        eal_mp_dev_hotplug_cleanup();
        rte_eal_malloc_heap_cleanup();
        rte_eal_alarm_cleanup();
-       rte_trace_save();
-       eal_trace_fini();
        eal_cleanup_config(internal_conf);
        rte_eal_log_cleanup();
        return 0;