[dpdk-stable] [PATCH v2] eal/service: fix exit by resetting service lcores

Harry van Haaren harry.van.haaren at intel.com
Wed Mar 11 15:39:27 CET 2020


This commit releases all service cores from their role,
returning them to ROLE_RTE on rte_service_finalize().

This may fix an issue relating to the service cores causing
a race-condition on eal_cleanup(), where the service core
could still be executing while the main thread has already
free-d the service memory, leading to a segfault.

Fixes: 21698354c832 ("service: introduce service cores concept")
Cc: stable at dpdk.org

Reported-by: David Marchand <david.marchand at redhat.com>
Reported-by: Aaron Conole <aconole at redhat.com>
Signed-off-by: David Marchand <david.marchand at redhat.com>
Signed-off-by: Harry van Haaren <harry.van.haaren at intel.com>
Acked-by: Aaron Conole <aconole at redhat.com>

---

v2:
- Added rte_eal_mp_wait_lcore() after reset (David)
- Added Signed-off and Acked from mailing list (David, Aaron)

---
 lib/librte_eal/common/rte_service.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c
index 7e537b8cd..b0b78baab 100644
--- a/lib/librte_eal/common/rte_service.c
+++ b/lib/librte_eal/common/rte_service.c
@@ -122,6 +122,9 @@ rte_service_finalize(void)
 	if (!rte_service_library_initialized)
 		return;
 
+	rte_service_lcore_reset_all();
+	rte_eal_mp_wait_lcore();
+
 	rte_free(rte_services);
 	rte_free(lcore_states);
 
-- 
2.17.1



More information about the stable mailing list