[21.11] eal: cleanup alarm and hotplug before memory detach

Message ID 20230316114818.99552-1-changfengnan@bytedance.com (mailing list archive)
State Not Applicable, archived
Delegated to: Thomas Monjalon
Headers
Series [21.11] eal: cleanup alarm and hotplug before memory detach |

Checks

Context Check Description
ci/loongarch-compilation warning apply patch failure
ci/checkpatch warning coding style issues
ci/Intel-compilation warning apply issues
ci/iol-testing warning apply patch failure

Commit Message

Fengnan Chang March 16, 2023, 11:48 a.m. UTC
  Alarm and multiprocess hotplug still need access hugepage memory,
if alarm event processed after memory detach, it may cause SEGV.
So cleanup alarm and multiprocess hotplug before memory detach.

Signed-off-by: Fengnan Chang <changfengnan@bytedance.com>
---
 lib/eal/freebsd/eal.c | 2 +-
 lib/eal/linux/eal.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
  

Patch

diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c
index 414aad3dd3..717d1f0b9a 100644
--- a/lib/eal/freebsd/eal.c
+++ b/lib/eal/freebsd/eal.c
@@ -988,9 +988,9 @@  rte_eal_cleanup(void)
 	rte_mp_channel_cleanup();
 	rte_trace_save();
 	eal_trace_fini();
+	rte_eal_alarm_cleanup();
 	/* after this point, any DPDK pointers will become dangling */
 	rte_eal_memory_detach();
-	rte_eal_alarm_cleanup();
 	eal_cleanup_config(internal_conf);
 	return 0;
 }
diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
index e3d34f7b7c..84c42679bf 100644
--- a/lib/eal/linux/eal.c
+++ b/lib/eal/linux/eal.c
@@ -1370,9 +1370,9 @@  rte_eal_cleanup(void)
 	rte_mp_channel_cleanup();
 	rte_trace_save();
 	eal_trace_fini();
+	rte_eal_alarm_cleanup();
 	/* after this point, any DPDK pointers will become dangling */
 	rte_eal_memory_detach();
-	rte_eal_alarm_cleanup();
 	eal_cleanup_config(internal_conf);
 	return 0;
 }