[dpdk-dev] [PATCH 04/14] eal: cleanup threads

Stephen Hemminger stephen at networkplumber.org
Sat Jan 4 02:33:31 CET 2020


When rte_eal_cleanup is called it should stop all the child threads
and close the pipes between threads.

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
 lib/librte_eal/linux/eal/eal.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c
index a1b928820b11..d98a2afe85da 100644
--- a/lib/librte_eal/linux/eal/eal.c
+++ b/lib/librte_eal/linux/eal/eal.c
@@ -1319,11 +1319,24 @@ mark_freeable(const struct rte_memseg_list *msl, const struct rte_memseg *ms,
 int
 rte_eal_cleanup(void)
 {
+	int i;
+
 	/* if we're in a primary process, we need to mark hugepages as freeable
 	 * so that finalization can release them back to the system.
 	 */
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
 		rte_memseg_walk(mark_freeable, NULL);
+
+	RTE_LCORE_FOREACH_SLAVE(i) {
+		pthread_cancel(lcore_config[i].thread_id);
+		pthread_join(lcore_config[i].thread_id, NULL);
+
+		close(lcore_config[i].pipe_master2slave[0]);
+		close(lcore_config[i].pipe_master2slave[1]);
+		close(lcore_config[i].pipe_slave2master[0]);
+		close(lcore_config[i].pipe_slave2master[1]);
+	}
+
 	rte_service_finalize();
 	rte_eal_alarm_cleanup();
 	rte_mp_channel_cleanup();
-- 
2.20.1



More information about the dev mailing list