[v3,4/8] eal: cleanup threads
diff mbox series

Message ID 20200428235827.15383-5-stephen@networkplumber.org
State New
Delegated to: Thomas Monjalon
Headers show
Series
  • eal: cleanup resources on shutdown
Related show

Checks

Context Check Description
ci/Intel-compilation fail Compilation issues
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger April 28, 2020, 11:58 p.m. UTC
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@networkplumber.org>
Acked-by: Aaron Conole <aconole@redhat.com>
---
 lib/librte_eal/linux/eal.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Patch
diff mbox series

diff --git a/lib/librte_eal/linux/eal.c b/lib/librte_eal/linux/eal.c
index 7458592f4950..27b768b15c4a 100644
--- a/lib/librte_eal/linux/eal.c
+++ b/lib/librte_eal/linux/eal.c
@@ -1327,11 +1327,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();