Skip to contentSkip to conversation

remove smp barriers in app/test

PATCH Superseded Feifei Wang 3 participants 5 messages Feb 25, 2021 – Mar 9, 2021

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover remove smp barriers in app/test

For smp barriers in app/test, remove the unnecessary barriers and fix some bugs.

v2:
1. remove ring stress test patch for that Honnappa will do some changes for rte_remote_launch APIs

Feifei Wang (1):
app/test: collect perf data after worker threads exit

 app/test/test_trace_perf.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH v2 1/1 app/test: collect perf data after worker threads exit

The measure_perf function should be executed after worker threads exit to collect correct perf data. Otherwise, while workers are running, the main thread may get incomplete data from workers.

In the meanwhile, remove unnecessary barrier in the test. For signal variables "ldata.done" and "ldata.start", no operations should keep the order that being executed after them. So the wmb after them can be moved.

Fixes 16a277a24c9f ("test/trace: add performance test cases")
---
 app/test/test_trace_perf.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
app/test/test_trace_perf.c +2 -3
index e1ad8e6f5..46ae7d807 100644
@@ -79,7 +79,6 @@ signal_workers_to_finish(struct test_data *data)
 
 	for (workers = 0; workers < data->nb_workers; workers++) {
 		data->ldata[workers].done = 1;
-		rte_smp_wmb();
 	}
 }
 
@@ -102,7 +101,6 @@ worker_fn_##func(void *arg) \
 { \
 	struct lcore_data *ldata = arg; \
 	ldata->started = 1; \
-	rte_smp_wmb(); \
 	__worker_##func(ldata); \
 	return 0; \
 }
@@ -137,11 +135,12 @@ run_test(const char *str, lcore_function_t f, struct test_data *data, size_t sz)
 
 	wait_till_workers_are_ready(data);
 	rte_delay_ms(100); /* Wait for some time to accumulate the stats */
-	measure_perf(str, data);
 	signal_workers_to_finish(data);
 
 	RTE_LCORE_FOREACH_WORKER(id)
 		rte_eal_wait_lcore(id);
+
+	measure_perf(str, data);
 }
 
 static int
Signature · 1 line
2.25.1
#2 lore raw

[dpdk-dev] 回复: [PATCH v2 1/1] app/test: collect perf data after worker threads exit

Hi, Jerin

Sorry to disturb you. Would you please help review this patch when you are free? Thanks very much.

Best Regards
Feifei

Quoted 69 lines

-----邮件原件-----
发件人: Feifei Wang <[email protected]>
发送时间: 2021年2月25日 17:32
收件人: [email protected]; Sunil Kumar Kori <[email protected]>; David Marchand <[email protected]>
抄送: [email protected]; nd <[email protected]>; Feifei Wang <[email protected]>; [email protected]; Honnappa Nagarahalli <[email protected]>; Honnappa Nagarahalli <[email protected]>; Ruifeng Wang <[email protected]>
主题: [PATCH v2 1/1] app/test: collect perf data after worker threads exit

The measure_perf function should be executed after worker threads exit to collect correct perf data. Otherwise, while workers are running, the main thread may get incomplete data from workers.

In the meanwhile, remove unnecessary barrier in the test.
For signal variables "ldata.done" and "ldata.start", no operations should keep the order that being executed after them. So the wmb after them can be moved.

Fixes 16a277a24c9f ("test/trace: add performance test cases")
---
 app/test/test_trace_perf.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
app/test/test_trace_perf.c index renamed from app/test/test_trace_perf.c +0 -0

e1ad8e6f5..46ae7d807 100644

app/test/test_trace_perf.c +2 -3
@@ -79,7 +79,6 @@ signal_workers_to_finish(struct test_data *data)
 
 	for (workers = 0; workers < data->nb_workers; workers++) {
 		data->ldata[workers].done = 1;
-		rte_smp_wmb();
 	}
 }
 
@@ -102,7 +101,6 @@ worker_fn_##func(void *arg) \  { \
 	struct lcore_data *ldata = arg; \
 	ldata->started = 1; \
-	rte_smp_wmb(); \
 	__worker_##func(ldata); \
 	return 0; \
 }
@@ -137,11 +135,12 @@ run_test(const char *str, lcore_function_t f, struct
 test_data *data, size_t sz)
 
 	wait_till_workers_are_ready(data);
 	rte_delay_ms(100); /* Wait for some time to accumulate the stats */
-	measure_perf(str, data);
 	signal_workers_to_finish(data);
 
 	RTE_LCORE_FOREACH_WORKER(id)
 		rte_eal_wait_lcore(id);
+
+	measure_perf(str, data);
 }
 

static int
--
2.25.1

Acked-by
#3 lore raw

Re: [dpdk-dev] 回复: [PATCH v2 1/1] app/test: collect perf data after worker threads exit

Quoted 4 lines · Feifei Wang

Hi, Jerin

Sorry to disturb you. Would you please help review this patch when you are free?

Sure. See below.

Quoted 34 lines

Thanks very much.

Best Regards
Feifei

Quoted 29 lines

-----邮件原件-----
发件人: Feifei Wang <[email protected]>
发送时间: 2021年2月25日 17:32
收件人: [email protected]; Sunil Kumar Kori <[email protected]>; David Marchand <[email protected]>
抄送: [email protected]; nd <[email protected]>; Feifei Wang <[email protected]>; [email protected]; Honnappa Nagarahalli <[email protected]>; Honnappa Nagarahalli <[email protected]>; Ruifeng Wang <[email protected]>
主题: [PATCH v2 1/1] app/test: collect perf data after worker threads exit

The measure_perf function should be executed after worker threads exit to collect correct perf data. Otherwise, while workers are running, the main thread may get incomplete data from workers.

In the meanwhile, remove unnecessary barrier in the test.
For signal variables "ldata.done" and "ldata.start", no operations should keep the order that being executed after them. So the wmb after them can be moved.

Fixes 16a277a24c9f ("test/trace: add performance test cases")

Please change to test/trace: ....
The rest looks good to me.

Quoted 41 lines
Quoted 40 lines
---
 app/test/test_trace_perf.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
app/test/test_trace_perf.c index renamed from app/test/test_trace_perf.c +0 -0

e1ad8e6f5..46ae7d807 100644

app/test/test_trace_perf.c +2 -3
@@ -79,7 +79,6 @@ signal_workers_to_finish(struct test_data *data)
 
      for (workers = 0; workers < data->nb_workers; workers++) {
              data->ldata[workers].done = 1;
-             rte_smp_wmb();
      }
 }
 
@@ -102,7 +101,6 @@ worker_fn_##func(void *arg) \  { \
      struct lcore_data *ldata = arg; \
      ldata->started = 1; \
-     rte_smp_wmb(); \
      __worker_##func(ldata); \
      return 0; \
 }
@@ -137,11 +135,12 @@ run_test(const char *str, lcore_function_t f, struct
 test_data *data, size_t sz)
 
      wait_till_workers_are_ready(data);
      rte_delay_ms(100); /* Wait for some time to accumulate the stats */
-     measure_perf(str, data);
      signal_workers_to_finish(data);
 
      RTE_LCORE_FOREACH_WORKER(id)
              rte_eal_wait_lcore(id);
+
+     measure_perf(str, data);
 }
 

static int
--
2.25.1

Acked-by on v2 1/1
#4 lore raw

Re: [dpdk-dev] [EXT] [PATCH v2 1/1] app/test: collect perf data after worker threads exit

In reply to Feifei Wang
Quoted 14 lines

The measure_perf function should be executed after worker threads exit
to collect correct perf data. Otherwise, while workers are running, the main thread may get incomplete data from workers.

In the meanwhile, remove unnecessary barrier in the test. For signal variables "ldata.done" and "ldata.start", no operations should keep the order that being executed after them. So the wmb after them can be moved.

Fixes 16a277a24c9f ("test/trace: add performance test cases")
Quoted 6 lines

Suggested-by: Honnappa Nagarahalli
<[email protected]>

Reviewed-by Honnappa Nagarahalli

<[email protected]>

Quoted 42 lines

---
app/test/test_trace_perf.c | 5 ++---

1 file changed, 2 insertions(+), 3 deletions(-)
app/test/test_trace_perf.c +0 -2
index e1ad8e6f5..46ae7d807 100644
@@ -79,7 +79,6 @@ signal_workers_to_finish(struct test_data *data)
 
 	for (workers = 0; workers < data->nb_workers; workers++) {
 		data->ldata[workers].done = 1;
-		rte_smp_wmb();
 	}
 }
 
@@ -102,7 +101,6 @@ worker_fn_##func(void *arg) \
 { \
 	struct lcore_data *ldata = arg; \
 	ldata->started = 1; \
-	rte_smp_wmb(); \
 	__worker_##func(ldata); \
 	return 0; \
 }
@@ -137,11 +135,12 @@ run_test(const char *str, lcore_function_t f,
 struct test_data *data, size_t sz)
 
 	wait_till_workers_are_ready(data);
 	rte_delay_ms(100); /* Wait for some time to accumulate the

stats */

app/test/test_trace_perf.c +0 -1
-	measure_perf(str, data);
	signal_workers_to_finish(data);

	RTE_LCORE_FOREACH_WORKER(id)
		rte_eal_wait_lcore(id);
app/test/test_trace_perf.c +2 -0
+
+	measure_perf(str, data);

}

static int
--
2.25.1