app/eventdev: use proper teardown sequence

Message ID 20180717143307.5270-1-pbhagavatula@caviumnetworks.com (mailing list archive)
State Superseded, archived
Delegated to: Jerin Jacob
Headers
Series app/eventdev: use proper teardown sequence |

Checks

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

Commit Message

Pavan Nikhilesh July 17, 2018, 2:33 p.m. UTC
  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(-)
  

Comments

Jerin Jacob July 18, 2018, 5:36 p.m. UTC | #1
-----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
>
  

Patch

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);
 }