patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] examples/eventdev_pipeline: fix segfault on exit
@ 2020-05-05  9:39 Harry van Haaren
  2020-05-07 10:07 ` Zhou, JunX W
  0 siblings, 1 reply; 3+ messages in thread
From: Harry van Haaren @ 2020-05-05  9:39 UTC (permalink / raw)
  To: dev; +Cc: junx.w.zhou, Harry van Haaren, stable, pbhagavatula

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.

Fixes: 085edac2ca38 ("examples/eventdev_pipeline: support Tx adapter")

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>

---

Cc: stable@dpdk.org
Cc: pbhagavatula@caviumnetworks.com
---
 examples/eventdev_pipeline/main.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/examples/eventdev_pipeline/main.c b/examples/eventdev_pipeline/main.c
index d0da51b1c..21958269f 100644
--- a/examples/eventdev_pipeline/main.c
+++ b/examples/eventdev_pipeline/main.c
@@ -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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-stable] [PATCH] examples/eventdev_pipeline: fix segfault on exit
  2020-05-05  9:39 [dpdk-stable] [PATCH] examples/eventdev_pipeline: fix segfault on exit Harry van Haaren
@ 2020-05-07 10:07 ` Zhou, JunX W
  2020-05-11 16:39   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Zhou, JunX W @ 2020-05-07 10:07 UTC (permalink / raw)
  To: Van Haaren, Harry, dev; +Cc: stable, pbhagavatula

Tested-by: Zhou, JunX W <junx.w.zhou@intel.com>

-----Original Message-----
From: Van Haaren, Harry 
Sent: Tuesday, May 5, 2020 5:39 PM
To: dev@dpdk.org
Cc: Zhou, JunX W <junx.w.zhou@intel.com>; Van Haaren, Harry <harry.van.haaren@intel.com>; stable@dpdk.org; pbhagavatula@caviumnetworks.com
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.

Fixes: 085edac2ca38 ("examples/eventdev_pipeline: support Tx adapter")

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>

---

Cc: stable@dpdk.org
Cc: pbhagavatula@caviumnetworks.com
---
 examples/eventdev_pipeline/main.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/examples/eventdev_pipeline/main.c b/examples/eventdev_pipeline/main.c
index d0da51b1c..21958269f 100644
--- a/examples/eventdev_pipeline/main.c
+++ b/examples/eventdev_pipeline/main.c
@@ -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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-stable] [PATCH] examples/eventdev_pipeline: fix segfault on exit
  2020-05-07 10:07 ` Zhou, JunX W
@ 2020-05-11 16:39   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2020-05-11 16:39 UTC (permalink / raw)
  To: Van Haaren, Harry; +Cc: dev, stable, pbhagavatula, Zhou, JunX W

07/05/2020 12:07, Zhou, JunX W:
> From: Van Haaren, Harry 
> > 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.
> > 
> > Fixes: 085edac2ca38 ("examples/eventdev_pipeline: support Tx adapter")
> > 
> > Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
> Tested-by: Zhou, JunX W <junx.w.zhou@intel.com>

Applied, thanks



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-11 16:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-05  9:39 [dpdk-stable] [PATCH] examples/eventdev_pipeline: fix segfault on exit Harry van Haaren
2020-05-07 10:07 ` Zhou, JunX W
2020-05-11 16:39   ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).