examples/eventdev_pipeline: fix segfault on exit
PATCH 1/1 examples/eventdev_pipeline: fix segfault on exit
This commit fixes a segfault on exit by using Ctrl^C if the master lcore was also being used as a worker core. The root cause of the issue was that the interrupt handler was cleaning up resources such as the ethdev and eventdev ports, and once the interrupt handler would return, that thread would continue working as an eventdev worker, and dereference the memory which just had free() called on it.
Fixed by moving the cleanup code from the interrupt handler to the cleanup stage of main(), which the master thread will execute once it has returned from its worker() functionality.
---
--- examples/eventdev_pipeline/main.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
examples/eventdev_pipeline/main.c +9 -6
@@ -301,12 +301,6 @@ signal_handler(int signum)rte_eal_mp_wait_lcore (); -RTE_ETH_FOREACH_DEV (portid) { -rte_eth_dev_close (portid); - } - -rte_event_dev_stop (0 ); -rte_event_dev_close (0 ); }if (signum ==SIGTSTP )rte_event_dev_dump (0 , stdout);
@@ -469,5 +463,14 @@ main(int argc, char **argv) } +RTE_ETH_FOREACH_DEV (portid) { +rte_eth_dev_close (portid); + } + +rte_event_dev_stop (0 ); +rte_event_dev_close (0 ); + +rte_eal_cleanup (); +return 0 ; }
Signature · 1 line
2.17.1
-----Original Message-----
From: Van Haaren, Harry
Sent: Tuesday, May 5, 2020 5:39 PM
To: [email protected]
Cc: Zhou, JunX W <[email protected]>; Van Haaren, Harry <[email protected]>; [email protected]; [email protected]
Subject: [PATCH] examples/eventdev_pipeline: fix segfault on exit
This commit fixes a segfault on exit by using Ctrl^C if the master lcore was also being used as a worker core. The root cause of the issue was that the interrupt handler was cleaning up resources such as the ethdev and eventdev ports, and once the interrupt handler would return, that thread would continue working as an eventdev worker, and dereference the memory which just had free() called on it.
Fixed by moving the cleanup code from the interrupt handler to the cleanup stage of main(), which the master thread will execute once it has returned from its worker() functionality.
---
--- examples/eventdev_pipeline/main.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
examples/eventdev_pipeline/main.c +9 -6
@@ -301,12 +301,6 @@ signal_handler(int signum)rte_eal_mp_wait_lcore (); -RTE_ETH_FOREACH_DEV (portid) { -rte_eth_dev_close (portid); - } - -rte_event_dev_stop (0 ); -rte_event_dev_close (0 ); }if (signum ==SIGTSTP )rte_event_dev_dump (0 , stdout);
@@ -469,5 +463,14 @@ main(int argc, char **argv) } +RTE_ETH_FOREACH_DEV (portid) { +rte_eth_dev_close (portid); + } + +rte_event_dev_stop (0 ); +rte_event_dev_close (0 ); + +rte_eal_cleanup (); +return 0 ; }
--
2.17.1
Thomas Monjalon
Applied07/05/2020 12:07, Zhou, JunX W:
Quoted 8 lines
From: Van Haaren, Harry
Quoted 7 lines
This commit fixes a segfault on exit by using Ctrl^C if the master lcore was also being used as a worker core. The root cause of the issue was that the interrupt handler was cleaning up resources such as the ethdev and eventdev ports, and once the interrupt handler would return, that thread would continue working as an eventdev worker, and dereference the memory which just had
free()called on it.
Quoted 8 lines
Quoted 7 lines
Fixed by moving the cleanup code from the interrupt handler to the cleanup stage of
main(), which the master thread will execute once it has returned from itsworker()functionality.Fixes 085edac2ca38 ("examples/eventdev_pipeline: support Tx adapter")Signed-off-by Harry van Haaren <[email protected]>Tested-by Zhou, JunX W <[email protected]>
Applied, thanks