DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev]  [PATCH] app/eventdev: use proper teardown sequence
@ 2018-07-17 14:33 Pavan Nikhilesh
  2018-07-18 17:36 ` Jerin Jacob
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Pavan Nikhilesh @ 2018-07-17 14:33 UTC (permalink / raw)
  To: jerin.jacob, santosh.shukla; +Cc: dev, Pavan Nikhilesh

Use proper teardown sequence when SIGINT is caught to prevent
eventdev from going into undefined state.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
---
 app/test-eventdev/evt_main.c             | 6 +++++-
 app/test-eventdev/test_pipeline_common.c | 1 -
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/app/test-eventdev/evt_main.c b/app/test-eventdev/evt_main.c
index 57bb94570..bc25fb386 100644
--- a/app/test-eventdev/evt_main.c
+++ b/app/test-eventdev/evt_main.c
@@ -25,8 +25,12 @@ signal_handler(int signum)
 				signum);
 		/* request all lcores to exit from the main loop */
 		*(int *)test->test_priv = true;
-		rte_wmb();
 
+		if (test->ops.ethdev_destroy)
+			test->ops.ethdev_destroy(test, &opt);
+
+		rte_event_dev_stop(opt.dev_id);
+		rte_wmb();
 		rte_eal_mp_wait_lcore();
 
 		if (test->ops.test_result)
diff --git a/app/test-eventdev/test_pipeline_common.c b/app/test-eventdev/test_pipeline_common.c
index 719518ff3..70fd04517 100644
--- a/app/test-eventdev/test_pipeline_common.c
+++ b/app/test-eventdev/test_pipeline_common.c
@@ -476,7 +476,6 @@ pipeline_eventdev_destroy(struct evt_test *test, struct evt_options *opt)
 {
 	RTE_SET_USED(test);
 
-	rte_event_dev_stop(opt->dev_id);
 	rte_event_dev_close(opt->dev_id);
 }
 
-- 
2.18.0

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

* Re: [dpdk-dev] [PATCH] app/eventdev: use proper teardown sequence
  2018-07-17 14:33 [dpdk-dev] [PATCH] app/eventdev: use proper teardown sequence Pavan Nikhilesh
@ 2018-07-18 17:36 ` Jerin Jacob
  2018-07-19 11:41 ` [dpdk-dev] [PATCH v2] " Pavan Nikhilesh
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Jerin Jacob @ 2018-07-18 17:36 UTC (permalink / raw)
  To: Pavan Nikhilesh; +Cc: santosh.shukla, dev

-----Original Message-----
> Date: Tue, 17 Jul 2018 20:03:07 +0530
> From: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> To: jerin.jacob@caviumnetworks.com, santosh.shukla@caviumnetworks.com
> Cc: dev@dpdk.org, Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> Subject: [dpdk-dev] [PATCH] app/eventdev: use proper teardown sequence
> X-Mailer: git-send-email 2.18.0
> 
> Use proper teardown sequence when SIGINT is caught to prevent
> eventdev from going into undefined state.
> 
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> ---
>  app/test-eventdev/evt_main.c             | 6 +++++-
>  app/test-eventdev/test_pipeline_common.c | 1 -
>  2 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/app/test-eventdev/evt_main.c b/app/test-eventdev/evt_main.c
> index 57bb94570..bc25fb386 100644
> --- a/app/test-eventdev/evt_main.c
> +++ b/app/test-eventdev/evt_main.c
> @@ -25,8 +25,12 @@ signal_handler(int signum)
>  				signum);
>  		/* request all lcores to exit from the main loop */
>  		*(int *)test->test_priv = true;
> -		rte_wmb();
>  
> +		if (test->ops.ethdev_destroy)
> +			test->ops.ethdev_destroy(test, &opt);

I think, stopping the producer should be enough to have proper tear down
sequence, as, When producer stops, the dequeue eventually will not have the
events and it will exit properly. 


> +
> +		rte_event_dev_stop(opt.dev_id);
> +		rte_wmb();
>  		rte_eal_mp_wait_lcore();
>  
>  		if (test->ops.test_result)
> diff --git a/app/test-eventdev/test_pipeline_common.c b/app/test-eventdev/test_pipeline_common.c
> index 719518ff3..70fd04517 100644
> --- a/app/test-eventdev/test_pipeline_common.c
> +++ b/app/test-eventdev/test_pipeline_common.c
> @@ -476,7 +476,6 @@ pipeline_eventdev_destroy(struct evt_test *test, struct evt_options *opt)
>  {
>  	RTE_SET_USED(test);
>  
> -	rte_event_dev_stop(opt->dev_id);
>  	rte_event_dev_close(opt->dev_id);
>  }
>  
> -- 
> 2.18.0
> 

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

* [dpdk-dev]  [PATCH v2] app/eventdev: use proper teardown sequence
  2018-07-17 14:33 [dpdk-dev] [PATCH] app/eventdev: use proper teardown sequence Pavan Nikhilesh
  2018-07-18 17:36 ` Jerin Jacob
@ 2018-07-19 11:41 ` Pavan Nikhilesh
  2018-07-24 11:01 ` [dpdk-dev] [PATCH v3] " Pavan Nikhilesh
  2018-07-24 12:14 ` [dpdk-dev] [PATCH v4] " Pavan Nikhilesh
  3 siblings, 0 replies; 7+ messages in thread
From: Pavan Nikhilesh @ 2018-07-19 11:41 UTC (permalink / raw)
  To: jerin.jacob; +Cc: dev, Pavan Nikhilesh

Use proper teardown sequence when SIGINT is caught to prevent
eventdev from going into undefined state.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
---
 v2 Changes:
 - Only stopping the ethdev(producer) is sufficient.(Jerin)

 app/test-eventdev/evt_main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/app/test-eventdev/evt_main.c b/app/test-eventdev/evt_main.c
index 57bb94570..18941f0ca 100644
--- a/app/test-eventdev/evt_main.c
+++ b/app/test-eventdev/evt_main.c
@@ -27,6 +27,9 @@ signal_handler(int signum)
 		*(int *)test->test_priv = true;
 		rte_wmb();

+		if (test->ops.ethdev_destroy)
+			test->ops.ethdev_destroy(test, &opt);
+
 		rte_eal_mp_wait_lcore();

 		if (test->ops.test_result)
@@ -35,9 +38,6 @@ signal_handler(int signum)
 		if (test->ops.eventdev_destroy)
 			test->ops.eventdev_destroy(test, &opt);

-		if (test->ops.ethdev_destroy)
-			test->ops.ethdev_destroy(test, &opt);
-
 		if (test->ops.mempool_destroy)
 			test->ops.mempool_destroy(test, &opt);

--
2.18.0

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

* [dpdk-dev]  [PATCH v3] app/eventdev: use proper teardown sequence
  2018-07-17 14:33 [dpdk-dev] [PATCH] app/eventdev: use proper teardown sequence Pavan Nikhilesh
  2018-07-18 17:36 ` Jerin Jacob
  2018-07-19 11:41 ` [dpdk-dev] [PATCH v2] " Pavan Nikhilesh
@ 2018-07-24 11:01 ` Pavan Nikhilesh
  2018-07-24 12:14 ` [dpdk-dev] [PATCH v4] " Pavan Nikhilesh
  3 siblings, 0 replies; 7+ messages in thread
From: Pavan Nikhilesh @ 2018-07-24 11:01 UTC (permalink / raw)
  To: jerin.jacob; +Cc: dev, Pavan Nikhilesh

Use proper teardown sequence when SIGINT is caught to prevent
eventdev from going into undefined state.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
---

 v3 Changes:
 - Segregate ethdev_stop and close to prevent possible SEGFAULT.
 - handle early shutdown.
 v2 Changes:
 - Only stopping the ethdev(producer) is sufficient.(Jerin)

 app/test-eventdev/evt_main.c             | 40 +++++++++++++++---------
 app/test-eventdev/test_perf_common.c     |  1 -
 app/test-eventdev/test_pipeline_common.c |  1 -
 3 files changed, 25 insertions(+), 17 deletions(-)

diff --git a/app/test-eventdev/evt_main.c b/app/test-eventdev/evt_main.c
index 57bb94570..0d5028c17 100644
--- a/app/test-eventdev/evt_main.c
+++ b/app/test-eventdev/evt_main.c
@@ -20,29 +20,39 @@ struct evt_test *test;
 static void
 signal_handler(int signum)
 {
-	if (signum == SIGINT || signum == SIGTERM) {
+	int i;
+	static uint8_t once;
+
+	if ((signum == SIGINT || signum == SIGTERM) && !once) {
+		once = true;
 		printf("\nSignal %d received, preparing to exit...\n",
 				signum);
-		/* request all lcores to exit from the main loop */
-		*(int *)test->test_priv = true;
-		rte_wmb();

-		rte_eal_mp_wait_lcore();
+		if (test != NULL) {
+			/* request all lcores to exit from the main loop */
+			*(int *)test->test_priv = true;
+			rte_wmb();
+
+			if (test->ops.ethdev_destroy)
+				test->ops.ethdev_destroy(test, &opt);

-		if (test->ops.test_result)
-			test->ops.test_result(test, &opt);
+			rte_eal_mp_wait_lcore();

-		if (test->ops.eventdev_destroy)
-			test->ops.eventdev_destroy(test, &opt);
+			if (test->ops.test_result)
+				test->ops.test_result(test, &opt);

-		if (test->ops.ethdev_destroy)
-			test->ops.ethdev_destroy(test, &opt);
+			RTE_ETH_FOREACH_DEV(i)
+				rte_eth_dev_close(i);

-		if (test->ops.mempool_destroy)
-			test->ops.mempool_destroy(test, &opt);
+			if (test->ops.eventdev_destroy)
+				test->ops.eventdev_destroy(test, &opt);

-		if (test->ops.test_destroy)
-			test->ops.test_destroy(test, &opt);
+			if (test->ops.mempool_destroy)
+				test->ops.mempool_destroy(test, &opt);
+
+			if (test->ops.test_destroy)
+				test->ops.test_destroy(test, &opt);
+		}

 		/* exit with the expected status */
 		signal(signum, SIG_DFL);
diff --git a/app/test-eventdev/test_perf_common.c b/app/test-eventdev/test_perf_common.c
index d00f91802..6d39f98e0 100644
--- a/app/test-eventdev/test_perf_common.c
+++ b/app/test-eventdev/test_perf_common.c
@@ -743,7 +743,6 @@ void perf_ethdev_destroy(struct evt_test *test, struct evt_options *opt)
 		RTE_ETH_FOREACH_DEV(i) {
 			rte_event_eth_rx_adapter_stop(i);
 			rte_eth_dev_stop(i);
-			rte_eth_dev_close(i);
 		}
 	}
 }
diff --git a/app/test-eventdev/test_pipeline_common.c b/app/test-eventdev/test_pipeline_common.c
index 719518ff3..96e7c9882 100644
--- a/app/test-eventdev/test_pipeline_common.c
+++ b/app/test-eventdev/test_pipeline_common.c
@@ -467,7 +467,6 @@ pipeline_ethdev_destroy(struct evt_test *test, struct evt_options *opt)
 	RTE_ETH_FOREACH_DEV(i) {
 		rte_event_eth_rx_adapter_stop(i);
 		rte_eth_dev_stop(i);
-		rte_eth_dev_close(i);
 	}
 }

--
2.18.0

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

* [dpdk-dev]  [PATCH v4] app/eventdev: use proper teardown sequence
  2018-07-17 14:33 [dpdk-dev] [PATCH] app/eventdev: use proper teardown sequence Pavan Nikhilesh
                   ` (2 preceding siblings ...)
  2018-07-24 11:01 ` [dpdk-dev] [PATCH v3] " Pavan Nikhilesh
@ 2018-07-24 12:14 ` Pavan Nikhilesh
  2018-07-24 15:39   ` Jerin Jacob
  3 siblings, 1 reply; 7+ messages in thread
From: Pavan Nikhilesh @ 2018-07-24 12:14 UTC (permalink / raw)
  To: jerin.jacob; +Cc: dev, Pavan Nikhilesh

Use proper teardown sequence when SIGINT is caught to prevent
eventdev from going into undefined state.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
---
 v4 Changes:
 - Check opts before closing ethdev.

 v3 Changes:
 - Segregate ethdev_stop and close to prevent possible SEGFAULT.
 - handle early shutdown.

 v2 Changes:
 - Only stopping the ethdev(producer) is sufficient.(Jerin)

 app/test-eventdev/evt_main.c             | 42 +++++++++++++++---------
 app/test-eventdev/test_perf_common.c     |  1 -
 app/test-eventdev/test_pipeline_common.c |  1 -
 3 files changed, 27 insertions(+), 17 deletions(-)

diff --git a/app/test-eventdev/evt_main.c b/app/test-eventdev/evt_main.c
index 57bb94570..a8d304bab 100644
--- a/app/test-eventdev/evt_main.c
+++ b/app/test-eventdev/evt_main.c
@@ -20,29 +20,41 @@ struct evt_test *test;
 static void
 signal_handler(int signum)
 {
-	if (signum == SIGINT || signum == SIGTERM) {
+	int i;
+	static uint8_t once;
+
+	if ((signum == SIGINT || signum == SIGTERM) && !once) {
+		once = true;
 		printf("\nSignal %d received, preparing to exit...\n",
 				signum);
-		/* request all lcores to exit from the main loop */
-		*(int *)test->test_priv = true;
-		rte_wmb();

-		rte_eal_mp_wait_lcore();
+		if (test != NULL) {
+			/* request all lcores to exit from the main loop */
+			*(int *)test->test_priv = true;
+			rte_wmb();
+
+			if (test->ops.ethdev_destroy)
+				test->ops.ethdev_destroy(test, &opt);

-		if (test->ops.test_result)
-			test->ops.test_result(test, &opt);
+			rte_eal_mp_wait_lcore();

-		if (test->ops.eventdev_destroy)
-			test->ops.eventdev_destroy(test, &opt);
+			if (test->ops.test_result)
+				test->ops.test_result(test, &opt);

-		if (test->ops.ethdev_destroy)
-			test->ops.ethdev_destroy(test, &opt);
+			if (opt.prod_type == EVT_PROD_TYPE_ETH_RX_ADPTR) {
+				RTE_ETH_FOREACH_DEV(i)
+					rte_eth_dev_close(i);
+			}

-		if (test->ops.mempool_destroy)
-			test->ops.mempool_destroy(test, &opt);
+			if (test->ops.eventdev_destroy)
+				test->ops.eventdev_destroy(test, &opt);

-		if (test->ops.test_destroy)
-			test->ops.test_destroy(test, &opt);
+			if (test->ops.mempool_destroy)
+				test->ops.mempool_destroy(test, &opt);
+
+			if (test->ops.test_destroy)
+				test->ops.test_destroy(test, &opt);
+		}

 		/* exit with the expected status */
 		signal(signum, SIG_DFL);
diff --git a/app/test-eventdev/test_perf_common.c b/app/test-eventdev/test_perf_common.c
index d00f91802..6d39f98e0 100644
--- a/app/test-eventdev/test_perf_common.c
+++ b/app/test-eventdev/test_perf_common.c
@@ -743,7 +743,6 @@ void perf_ethdev_destroy(struct evt_test *test, struct evt_options *opt)
 		RTE_ETH_FOREACH_DEV(i) {
 			rte_event_eth_rx_adapter_stop(i);
 			rte_eth_dev_stop(i);
-			rte_eth_dev_close(i);
 		}
 	}
 }
diff --git a/app/test-eventdev/test_pipeline_common.c b/app/test-eventdev/test_pipeline_common.c
index 719518ff3..96e7c9882 100644
--- a/app/test-eventdev/test_pipeline_common.c
+++ b/app/test-eventdev/test_pipeline_common.c
@@ -467,7 +467,6 @@ pipeline_ethdev_destroy(struct evt_test *test, struct evt_options *opt)
 	RTE_ETH_FOREACH_DEV(i) {
 		rte_event_eth_rx_adapter_stop(i);
 		rte_eth_dev_stop(i);
-		rte_eth_dev_close(i);
 	}
 }

--
2.18.0

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

* Re: [dpdk-dev] [PATCH v4] app/eventdev: use proper teardown sequence
  2018-07-24 12:14 ` [dpdk-dev] [PATCH v4] " Pavan Nikhilesh
@ 2018-07-24 15:39   ` Jerin Jacob
  2018-07-25 13:12     ` Jerin Jacob
  0 siblings, 1 reply; 7+ messages in thread
From: Jerin Jacob @ 2018-07-24 15:39 UTC (permalink / raw)
  To: Pavan Nikhilesh; +Cc: dev

-----Original Message-----
> Date: Tue, 24 Jul 2018 17:44:50 +0530
> From: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> To: jerin.jacob@caviumnetworks.com
> Cc: dev@dpdk.org, Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> Subject: [dpdk-dev] [PATCH v4] app/eventdev: use proper teardown sequence
> X-Mailer: git-send-email 2.18.0
> 
> Use proper teardown sequence when SIGINT is caught to prevent
> eventdev from going into undefined state.
> 
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>

Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>

> ---
>  v4 Changes:
>  - Check opts before closing ethdev.
> 
>  v3 Changes:
>  - Segregate ethdev_stop and close to prevent possible SEGFAULT.
>  - handle early shutdown.
> 
>  v2 Changes:
>  - Only stopping the ethdev(producer) is sufficient.(Jerin)
> 
>  app/test-eventdev/evt_main.c             | 42 +++++++++++++++---------
>  app/test-eventdev/test_perf_common.c     |  1 -
>  app/test-eventdev/test_pipeline_common.c |  1 -
>  3 files changed, 27 insertions(+), 17 deletions(-)
> 
> diff --git a/app/test-eventdev/evt_main.c b/app/test-eventdev/evt_main.c
> index 57bb94570..a8d304bab 100644
> --- a/app/test-eventdev/evt_main.c
> +++ b/app/test-eventdev/evt_main.c
> @@ -20,29 +20,41 @@ struct evt_test *test;
>  static void
>  signal_handler(int signum)
>  {
> -	if (signum == SIGINT || signum == SIGTERM) {
> +	int i;
> +	static uint8_t once;
> +
> +	if ((signum == SIGINT || signum == SIGTERM) && !once) {
> +		once = true;
>  		printf("\nSignal %d received, preparing to exit...\n",
>  				signum);
> -		/* request all lcores to exit from the main loop */
> -		*(int *)test->test_priv = true;
> -		rte_wmb();
> 
> -		rte_eal_mp_wait_lcore();
> +		if (test != NULL) {
> +			/* request all lcores to exit from the main loop */
> +			*(int *)test->test_priv = true;
> +			rte_wmb();
> +
> +			if (test->ops.ethdev_destroy)
> +				test->ops.ethdev_destroy(test, &opt);
> 
> -		if (test->ops.test_result)
> -			test->ops.test_result(test, &opt);
> +			rte_eal_mp_wait_lcore();
> 
> -		if (test->ops.eventdev_destroy)
> -			test->ops.eventdev_destroy(test, &opt);
> +			if (test->ops.test_result)
> +				test->ops.test_result(test, &opt);
> 
> -		if (test->ops.ethdev_destroy)
> -			test->ops.ethdev_destroy(test, &opt);
> +			if (opt.prod_type == EVT_PROD_TYPE_ETH_RX_ADPTR) {
> +				RTE_ETH_FOREACH_DEV(i)
> +					rte_eth_dev_close(i);
> +			}
> 
> -		if (test->ops.mempool_destroy)
> -			test->ops.mempool_destroy(test, &opt);
> +			if (test->ops.eventdev_destroy)
> +				test->ops.eventdev_destroy(test, &opt);
> 
> -		if (test->ops.test_destroy)
> -			test->ops.test_destroy(test, &opt);
> +			if (test->ops.mempool_destroy)
> +				test->ops.mempool_destroy(test, &opt);
> +
> +			if (test->ops.test_destroy)
> +				test->ops.test_destroy(test, &opt);
> +		}
> 
>  		/* exit with the expected status */
>  		signal(signum, SIG_DFL);
> diff --git a/app/test-eventdev/test_perf_common.c b/app/test-eventdev/test_perf_common.c
> index d00f91802..6d39f98e0 100644
> --- a/app/test-eventdev/test_perf_common.c
> +++ b/app/test-eventdev/test_perf_common.c
> @@ -743,7 +743,6 @@ void perf_ethdev_destroy(struct evt_test *test, struct evt_options *opt)
>  		RTE_ETH_FOREACH_DEV(i) {
>  			rte_event_eth_rx_adapter_stop(i);
>  			rte_eth_dev_stop(i);
> -			rte_eth_dev_close(i);
>  		}
>  	}
>  }
> diff --git a/app/test-eventdev/test_pipeline_common.c b/app/test-eventdev/test_pipeline_common.c
> index 719518ff3..96e7c9882 100644
> --- a/app/test-eventdev/test_pipeline_common.c
> +++ b/app/test-eventdev/test_pipeline_common.c
> @@ -467,7 +467,6 @@ pipeline_ethdev_destroy(struct evt_test *test, struct evt_options *opt)
>  	RTE_ETH_FOREACH_DEV(i) {
>  		rte_event_eth_rx_adapter_stop(i);
>  		rte_eth_dev_stop(i);
> -		rte_eth_dev_close(i);
>  	}
>  }
> 
> --
> 2.18.0
> 

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

* Re: [dpdk-dev] [PATCH v4] app/eventdev: use proper teardown sequence
  2018-07-24 15:39   ` Jerin Jacob
@ 2018-07-25 13:12     ` Jerin Jacob
  0 siblings, 0 replies; 7+ messages in thread
From: Jerin Jacob @ 2018-07-25 13:12 UTC (permalink / raw)
  To: Pavan Nikhilesh; +Cc: dev

-----Original Message-----
> Date: Tue, 24 Jul 2018 21:09:50 +0530
> From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> To: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v4] app/eventdev: use proper teardown
>  sequence
> User-Agent: Mutt/1.10.1 (2018-07-13)
> 
> -----Original Message-----
> > Date: Tue, 24 Jul 2018 17:44:50 +0530
> > From: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> > To: jerin.jacob@caviumnetworks.com
> > Cc: dev@dpdk.org, Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> > Subject: [dpdk-dev] [PATCH v4] app/eventdev: use proper teardown sequence
> > X-Mailer: git-send-email 2.18.0
> > 
> > Use proper teardown sequence when SIGINT is caught to prevent
> > eventdev from going into undefined state.
> > 
> > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> 
> Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>

Applied to dpdk-next-eventdev/master. Thanks.

> 
> > ---
> >  v4 Changes:
> >  - Check opts before closing ethdev.
> > 
> >  v3 Changes:
> >  - Segregate ethdev_stop and close to prevent possible SEGFAULT.
> >  - handle early shutdown.
> > 
> >  v2 Changes:
> >  - Only stopping the ethdev(producer) is sufficient.(Jerin)
> > 
> >  app/test-eventdev/evt_main.c             | 42 +++++++++++++++---------
> >  app/test-eventdev/test_perf_common.c     |  1 -
> >  app/test-eventdev/test_pipeline_common.c |  1 -
> >  3 files changed, 27 insertions(+), 17 deletions(-)
> > 
> > diff --git a/app/test-eventdev/evt_main.c b/app/test-eventdev/evt_main.c
> > index 57bb94570..a8d304bab 100644
> > --- a/app/test-eventdev/evt_main.c
> > +++ b/app/test-eventdev/evt_main.c
> > @@ -20,29 +20,41 @@ struct evt_test *test;
> >  static void
> >  signal_handler(int signum)
> >  {
> > -	if (signum == SIGINT || signum == SIGTERM) {
> > +	int i;
> > +	static uint8_t once;
> > +
> > +	if ((signum == SIGINT || signum == SIGTERM) && !once) {
> > +		once = true;
> >  		printf("\nSignal %d received, preparing to exit...\n",
> >  				signum);
> > -		/* request all lcores to exit from the main loop */
> > -		*(int *)test->test_priv = true;
> > -		rte_wmb();
> > 
> > -		rte_eal_mp_wait_lcore();
> > +		if (test != NULL) {
> > +			/* request all lcores to exit from the main loop */
> > +			*(int *)test->test_priv = true;
> > +			rte_wmb();
> > +
> > +			if (test->ops.ethdev_destroy)
> > +				test->ops.ethdev_destroy(test, &opt);
> > 
> > -		if (test->ops.test_result)
> > -			test->ops.test_result(test, &opt);
> > +			rte_eal_mp_wait_lcore();
> > 
> > -		if (test->ops.eventdev_destroy)
> > -			test->ops.eventdev_destroy(test, &opt);
> > +			if (test->ops.test_result)
> > +				test->ops.test_result(test, &opt);
> > 
> > -		if (test->ops.ethdev_destroy)
> > -			test->ops.ethdev_destroy(test, &opt);
> > +			if (opt.prod_type == EVT_PROD_TYPE_ETH_RX_ADPTR) {
> > +				RTE_ETH_FOREACH_DEV(i)
> > +					rte_eth_dev_close(i);
> > +			}
> > 
> > -		if (test->ops.mempool_destroy)
> > -			test->ops.mempool_destroy(test, &opt);
> > +			if (test->ops.eventdev_destroy)
> > +				test->ops.eventdev_destroy(test, &opt);
> > 
> > -		if (test->ops.test_destroy)
> > -			test->ops.test_destroy(test, &opt);
> > +			if (test->ops.mempool_destroy)
> > +				test->ops.mempool_destroy(test, &opt);
> > +
> > +			if (test->ops.test_destroy)
> > +				test->ops.test_destroy(test, &opt);
> > +		}
> > 
> >  		/* exit with the expected status */
> >  		signal(signum, SIG_DFL);
> > diff --git a/app/test-eventdev/test_perf_common.c b/app/test-eventdev/test_perf_common.c
> > index d00f91802..6d39f98e0 100644
> > --- a/app/test-eventdev/test_perf_common.c
> > +++ b/app/test-eventdev/test_perf_common.c
> > @@ -743,7 +743,6 @@ void perf_ethdev_destroy(struct evt_test *test, struct evt_options *opt)
> >  		RTE_ETH_FOREACH_DEV(i) {
> >  			rte_event_eth_rx_adapter_stop(i);
> >  			rte_eth_dev_stop(i);
> > -			rte_eth_dev_close(i);
> >  		}
> >  	}
> >  }
> > diff --git a/app/test-eventdev/test_pipeline_common.c b/app/test-eventdev/test_pipeline_common.c
> > index 719518ff3..96e7c9882 100644
> > --- a/app/test-eventdev/test_pipeline_common.c
> > +++ b/app/test-eventdev/test_pipeline_common.c
> > @@ -467,7 +467,6 @@ pipeline_ethdev_destroy(struct evt_test *test, struct evt_options *opt)
> >  	RTE_ETH_FOREACH_DEV(i) {
> >  		rte_event_eth_rx_adapter_stop(i);
> >  		rte_eth_dev_stop(i);
> > -		rte_eth_dev_close(i);
> >  	}
> >  }
> > 
> > --
> > 2.18.0
> > 

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

end of thread, other threads:[~2018-07-25 13:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-17 14:33 [dpdk-dev] [PATCH] app/eventdev: use proper teardown sequence Pavan Nikhilesh
2018-07-18 17:36 ` Jerin Jacob
2018-07-19 11:41 ` [dpdk-dev] [PATCH v2] " Pavan Nikhilesh
2018-07-24 11:01 ` [dpdk-dev] [PATCH v3] " Pavan Nikhilesh
2018-07-24 12:14 ` [dpdk-dev] [PATCH v4] " Pavan Nikhilesh
2018-07-24 15:39   ` Jerin Jacob
2018-07-25 13:12     ` Jerin Jacob

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).