[2/2] test/rcu: use existing lcore API

Message ID 1557907020-1548-2-git-send-email-david.marchand@redhat.com (mailing list archive)
State Superseded, archived
Headers
Series [1/2] test/hash: use existing lcore API |

Checks

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

Commit Message

David Marchand May 15, 2019, 7:57 a.m. UTC
  Prefer the existing apis rather than direct access lcore_config that is
going to disappear.

Fixes: b87089b0bb19 ("test/rcu: add API and functional tests")

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 app/test/test_rcu_qsbr.c      | 22 ++++++++++------------
 app/test/test_rcu_qsbr_perf.c | 12 ++++--------
 2 files changed, 14 insertions(+), 20 deletions(-)
  

Comments

Maxime Coquelin May 15, 2019, 12:19 p.m. UTC | #1
On 5/15/19 9:57 AM, David Marchand wrote:
> Prefer the existing apis rather than direct access lcore_config that is
> going to disappear.
> 
> Fixes: b87089b0bb19 ("test/rcu: add API and functional tests")
> 
> Signed-off-by: David Marchand<david.marchand@redhat.com>
> ---
>   app/test/test_rcu_qsbr.c      | 22 ++++++++++------------
>   app/test/test_rcu_qsbr_perf.c | 12 ++++--------
>   2 files changed, 14 insertions(+), 20 deletions(-)


Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime
  
Honnappa Nagarahalli May 15, 2019, 8:04 p.m. UTC | #2
> 
> Prefer the existing apis rather than direct access lcore_config that is going to
> disappear.
> 
> Fixes: b87089b0bb19 ("test/rcu: add API and functional tests")
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
>  app/test/test_rcu_qsbr.c      | 22 ++++++++++------------
>  app/test/test_rcu_qsbr_perf.c | 12 ++++--------
>  2 files changed, 14 insertions(+), 20 deletions(-)
> 
> diff --git a/app/test/test_rcu_qsbr.c b/app/test/test_rcu_qsbr.c index
> ed6934a..92ab0c2 100644
> --- a/app/test/test_rcu_qsbr.c
> +++ b/app/test/test_rcu_qsbr.c
> @@ -853,11 +853,10 @@
>  	hash_data[0][6] = NULL;
> 
>  	writer_done = 1;
> -	/* Wait until all readers have exited */
> -	rte_eal_mp_wait_lcore();
> -	/* Check return value from threads */
> +
> +	/* Wait and check return value from reader threads */
>  	for (i = 0; i < 4; i++)
> -		if (lcore_config[enabled_core_ids[i]].ret < 0)
> +		if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
>  			goto error;
>  	rte_hash_free(h[0]);
>  	rte_free(keys);
> @@ -913,17 +912,16 @@
>  		rte_eal_remote_launch(test_rcu_qsbr_writer,
>  				      (void *)(uintptr_t)(i - (test_cores / 2)),
>  					enabled_core_ids[i]);
> -	/* Wait for writers to complete */
> +	/* Wait and check return value from writer threads */
>  	for (i = test_cores / 2; i < test_cores;  i++)
> -		rte_eal_wait_lcore(enabled_core_ids[i]);
> +		if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
> +			goto error;
> 
>  	writer_done = 1;
> -	/* Wait for readers to complete */
> -	rte_eal_mp_wait_lcore();
> 
> -	/* Check return value from threads */
> -	for (i = 0; i < test_cores; i++)
> -		if (lcore_config[enabled_core_ids[i]].ret < 0)
> +	/* Wait and check return value from reader threads */
> +	for (i = 0; i < test_cores / 2; i++)
> +		if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
>  			goto error;
> 
>  	for (i = 0; i < num_cores / 4; i++)
> @@ -935,7 +933,7 @@
> 
>  error:
>  	writer_done = 1;
> -	/* Wait until all readers have exited */
> +	/* Wait until all readers and writers have exited */
>  	rte_eal_mp_wait_lcore();
> 
>  	for (i = 0; i < num_cores / 4; i++)
> diff --git a/app/test/test_rcu_qsbr_perf.c b/app/test/test_rcu_qsbr_perf.c
> index 16a43f8..6b1912c 100644
> --- a/app/test/test_rcu_qsbr_perf.c
> +++ b/app/test/test_rcu_qsbr_perf.c
> @@ -473,11 +473,9 @@
> 
>  	writer_done = 1;
> 
> -	/* Wait until all readers have exited */
> -	rte_eal_mp_wait_lcore();
> -	/* Check return value from threads */
> +	/* Wait and check return value from reader threads */
>  	for (i = 0; i < num_cores; i++)
> -		if (lcore_config[enabled_core_ids[i]].ret < 0)
> +		if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
>  			goto error;
>  	rte_hash_free(h[0]);
>  	rte_free(keys);
> @@ -587,11 +585,9 @@
>  	rte_atomic64_add(&checks, i);
> 
>  	writer_done = 1;
> -	/* Wait until all readers have exited */
> -	rte_eal_mp_wait_lcore();
> -	/* Check return value from threads */
> +	/* Wait and check return value from reader threads */
>  	for (i = 0; i < num_cores; i++)
> -		if (lcore_config[enabled_core_ids[i]].ret < 0)
> +		if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
>  			goto error;
>  	rte_hash_free(h[0]);
>  	rte_free(keys);
> --
> 1.8.3.1

Acked-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
  

Patch

diff --git a/app/test/test_rcu_qsbr.c b/app/test/test_rcu_qsbr.c
index ed6934a..92ab0c2 100644
--- a/app/test/test_rcu_qsbr.c
+++ b/app/test/test_rcu_qsbr.c
@@ -853,11 +853,10 @@ 
 	hash_data[0][6] = NULL;
 
 	writer_done = 1;
-	/* Wait until all readers have exited */
-	rte_eal_mp_wait_lcore();
-	/* Check return value from threads */
+
+	/* Wait and check return value from reader threads */
 	for (i = 0; i < 4; i++)
-		if (lcore_config[enabled_core_ids[i]].ret < 0)
+		if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
 			goto error;
 	rte_hash_free(h[0]);
 	rte_free(keys);
@@ -913,17 +912,16 @@ 
 		rte_eal_remote_launch(test_rcu_qsbr_writer,
 				      (void *)(uintptr_t)(i - (test_cores / 2)),
 					enabled_core_ids[i]);
-	/* Wait for writers to complete */
+	/* Wait and check return value from writer threads */
 	for (i = test_cores / 2; i < test_cores;  i++)
-		rte_eal_wait_lcore(enabled_core_ids[i]);
+		if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
+			goto error;
 
 	writer_done = 1;
-	/* Wait for readers to complete */
-	rte_eal_mp_wait_lcore();
 
-	/* Check return value from threads */
-	for (i = 0; i < test_cores; i++)
-		if (lcore_config[enabled_core_ids[i]].ret < 0)
+	/* Wait and check return value from reader threads */
+	for (i = 0; i < test_cores / 2; i++)
+		if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
 			goto error;
 
 	for (i = 0; i < num_cores / 4; i++)
@@ -935,7 +933,7 @@ 
 
 error:
 	writer_done = 1;
-	/* Wait until all readers have exited */
+	/* Wait until all readers and writers have exited */
 	rte_eal_mp_wait_lcore();
 
 	for (i = 0; i < num_cores / 4; i++)
diff --git a/app/test/test_rcu_qsbr_perf.c b/app/test/test_rcu_qsbr_perf.c
index 16a43f8..6b1912c 100644
--- a/app/test/test_rcu_qsbr_perf.c
+++ b/app/test/test_rcu_qsbr_perf.c
@@ -473,11 +473,9 @@ 
 
 	writer_done = 1;
 
-	/* Wait until all readers have exited */
-	rte_eal_mp_wait_lcore();
-	/* Check return value from threads */
+	/* Wait and check return value from reader threads */
 	for (i = 0; i < num_cores; i++)
-		if (lcore_config[enabled_core_ids[i]].ret < 0)
+		if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
 			goto error;
 	rte_hash_free(h[0]);
 	rte_free(keys);
@@ -587,11 +585,9 @@ 
 	rte_atomic64_add(&checks, i);
 
 	writer_done = 1;
-	/* Wait until all readers have exited */
-	rte_eal_mp_wait_lcore();
-	/* Check return value from threads */
+	/* Wait and check return value from reader threads */
 	for (i = 0; i < num_cores; i++)
-		if (lcore_config[enabled_core_ids[i]].ret < 0)
+		if (rte_eal_wait_lcore(enabled_core_ids[i]) < 0)
 			goto error;
 	rte_hash_free(h[0]);
 	rte_free(keys);