[dpdk-stable] patch 'test/distributor: fix race conditions on shutdown' has been queued to LTS release 18.11.11

Kevin Traynor ktraynor at redhat.com
Wed Nov 18 17:35:14 CET 2020


Hi,

FYI, your patch has been queued to LTS release 18.11.11

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/24/20. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable-queue

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable-queue/commit/f7b94e1e83274916f3ed163fcf5ebe02d93bb17c

Thanks.

Kevin.

---
>From f7b94e1e83274916f3ed163fcf5ebe02d93bb17c Mon Sep 17 00:00:00 2001
From: Lukasz Wojciechowski <l.wojciechow at partner.samsung.com>
Date: Sat, 17 Oct 2020 05:06:55 +0200
Subject: [PATCH] test/distributor: fix race conditions on shutdown

[ upstream commit 92e69743ed18692a1470396c4e7e47246c2191a5 ]

Instead of making delays in test code and waiting
for worker hopefully to reach proper states,
synchronize worker shutdown test cases with spin lock
on atomic variable.

Fixes: c0de0eb82e40 ("distributor: switch over to new API")

Signed-off-by: Lukasz Wojciechowski <l.wojciechow at partner.samsung.com>
Acked-by: David Hunt <david.hunt at intel.com>
---
 test/test/test_distributor.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/test/test/test_distributor.c b/test/test/test_distributor.c
index 43fd231904..459f75b96a 100644
--- a/test/test/test_distributor.c
+++ b/test/test/test_distributor.c
@@ -28,4 +28,5 @@ struct worker_params worker_params;
 static volatile int quit;      /**< general quit variable for all threads */
 static volatile int zero_quit; /**< var for when we just want thr0 to quit*/
+static volatile int zero_sleep; /**< thr0 has quit basic loop and is sleeping*/
 static volatile unsigned worker_idx;
 static volatile unsigned zero_idx;
@@ -377,6 +378,8 @@ handle_work_for_shutdown_test(void *arg)
 		 * when all workers are shutting down.
 		 */
+		__atomic_store_n(&zero_sleep, 1, __ATOMIC_RELEASE);
 		while (zero_quit)
 			usleep(100);
+		__atomic_store_n(&zero_sleep, 0, __ATOMIC_RELEASE);
 
 		num = rte_distributor_get_pkt(d, id, buf, NULL, 0);
@@ -446,5 +449,10 @@ sanity_test_with_worker_shutdown(struct worker_params *wp,
 	/* flush the distributor */
 	rte_distributor_flush(d);
-	rte_delay_us(10000);
+	while (!__atomic_load_n(&zero_sleep, __ATOMIC_ACQUIRE))
+		rte_distributor_flush(d);
+
+	zero_quit = 0;
+	while (__atomic_load_n(&zero_sleep, __ATOMIC_ACQUIRE))
+		rte_delay_us(100);
 
 	for (i = 0; i < rte_lcore_count() - 1; i++)
@@ -506,7 +514,12 @@ test_flush_with_worker_shutdown(struct worker_params *wp,
 	rte_distributor_flush(d);
 
-	rte_delay_us(10000);
+	while (!__atomic_load_n(&zero_sleep, __ATOMIC_ACQUIRE))
+		rte_distributor_flush(d);
 
 	zero_quit = 0;
+
+	while (__atomic_load_n(&zero_sleep, __ATOMIC_ACQUIRE))
+		rte_delay_us(100);
+
 	for (i = 0; i < rte_lcore_count() - 1; i++)
 		printf("Worker %u handled %u packets\n", i,
@@ -616,4 +629,6 @@ quit_workers(struct worker_params *wp, struct rte_mempool *p)
 	worker_idx = 0;
 	zero_idx = RTE_MAX_LCORE;
+	zero_quit = 0;
+	zero_sleep = 0;
 }
 
-- 
2.26.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-11-18 16:33:38.489536518 +0000
+++ 0028-test-distributor-fix-race-conditions-on-shutdown.patch	2020-11-18 16:33:37.931215063 +0000
@@ -1 +1 @@
-From 92e69743ed18692a1470396c4e7e47246c2191a5 Mon Sep 17 00:00:00 2001
+From f7b94e1e83274916f3ed163fcf5ebe02d93bb17c Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 92e69743ed18692a1470396c4e7e47246c2191a5 ]
+
@@ -12 +13,0 @@
-Cc: stable at dpdk.org
@@ -17 +18 @@
- app/test/test_distributor.c | 19 +++++++++++++++++--
+ test/test/test_distributor.c | 19 +++++++++++++++++--
@@ -20,4 +21,4 @@
-diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c
-index 3f0aeb7b90..fdb6ea9ceb 100644
---- a/app/test/test_distributor.c
-+++ b/app/test/test_distributor.c
+diff --git a/test/test/test_distributor.c b/test/test/test_distributor.c
+index 43fd231904..459f75b96a 100644
+--- a/test/test/test_distributor.c
++++ b/test/test/test_distributor.c
@@ -30 +31 @@
-@@ -378,6 +379,8 @@ handle_work_for_shutdown_test(void *arg)
+@@ -377,6 +378,8 @@ handle_work_for_shutdown_test(void *arg)
@@ -39 +40 @@
-@@ -447,5 +450,10 @@ sanity_test_with_worker_shutdown(struct worker_params *wp,
+@@ -446,5 +449,10 @@ sanity_test_with_worker_shutdown(struct worker_params *wp,
@@ -51 +52 @@
-@@ -507,7 +515,12 @@ test_flush_with_worker_shutdown(struct worker_params *wp,
+@@ -506,7 +514,12 @@ test_flush_with_worker_shutdown(struct worker_params *wp,
@@ -65 +66 @@
-@@ -617,4 +630,6 @@ quit_workers(struct worker_params *wp, struct rte_mempool *p)
+@@ -616,4 +629,6 @@ quit_workers(struct worker_params *wp, struct rte_mempool *p)



More information about the stable mailing list