patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH v1 1/5] app/eventdev: fix SMP barrier bugs for perf test
       [not found] <20210114070830.707550-1-feifei.wang2@arm.com>
@ 2021-01-14  7:08 ` Feifei Wang
  2021-01-25 17:50   ` [dpdk-stable] [EXT] [dpdk-dev] " Pavan Nikhilesh Bhagavatula
  0 siblings, 1 reply; 2+ messages in thread
From: Feifei Wang @ 2021-01-14  7:08 UTC (permalink / raw)
  To: Jerin Jacob, Harry van Haaren
  Cc: dev, Honnappa.Nagarahalli, nd, Feifei Wang, stable, Ruifeng Wang

This patch fixes RTE SMP barrier bugs for the perf test of eventdev.

For the "perf_process_last_stage" function, wmb after storing
processed_pkts should be moved before it. This is because the worker
lcore should ensure it has really finished data processing, e.g. event
stored into buffers, before the shared variables "w->processed_pkts"are
stored.

For the "perf_process_last_stage_latency", on the one hand, the wmb
should be moved before storing into "w->processed_pkts". The reason is
the same as above. But on the other hand, for "w->latency", wmb is
unnecessary due to data dependency.

Fixes: 2369f73329f8 ("app/testeventdev: add perf queue worker functions")
Cc: jerinj@marvell.com
Cc: stable@dpdk.org

Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 app/test-eventdev/test_perf_common.h | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/app/test-eventdev/test_perf_common.h b/app/test-eventdev/test_perf_common.h
index ff9705df8..e7233e5a5 100644
--- a/app/test-eventdev/test_perf_common.h
+++ b/app/test-eventdev/test_perf_common.h
@@ -97,8 +97,13 @@ perf_process_last_stage(struct rte_mempool *const pool,
 		void *bufs[], int const buf_sz, uint8_t count)
 {
 	bufs[count++] = ev->event_ptr;
-	w->processed_pkts++;
+
+	/* wmb here ensures event_prt is stored before
+	 * updating the number of processed packets
+	 * for worker lcores
+	 */
 	rte_smp_wmb();
+	w->processed_pkts++;
 
 	if (unlikely(count == buf_sz)) {
 		count = 0;
@@ -116,6 +121,12 @@ perf_process_last_stage_latency(struct rte_mempool *const pool,
 	struct perf_elt *const m = ev->event_ptr;
 
 	bufs[count++] = ev->event_ptr;
+
+	/* wmb here ensures event_prt is stored before
+	 * updating the number of processed packets
+	 * for worker lcores
+	 */
+	rte_smp_wmb();
 	w->processed_pkts++;
 
 	if (unlikely(count == buf_sz)) {
@@ -127,7 +138,6 @@ perf_process_last_stage_latency(struct rte_mempool *const pool,
 	}
 
 	w->latency += latency;
-	rte_smp_wmb();
 	return count;
 }
 
-- 
2.25.1


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

* Re: [dpdk-stable] [EXT] [dpdk-dev] [PATCH v1 1/5] app/eventdev: fix SMP barrier bugs for perf test
  2021-01-14  7:08 ` [dpdk-stable] [PATCH v1 1/5] app/eventdev: fix SMP barrier bugs for perf test Feifei Wang
@ 2021-01-25 17:50   ` Pavan Nikhilesh Bhagavatula
  0 siblings, 0 replies; 2+ messages in thread
From: Pavan Nikhilesh Bhagavatula @ 2021-01-25 17:50 UTC (permalink / raw)
  To: Feifei Wang, Jerin Jacob Kollanukkaran, Harry van Haaren
  Cc: dev, Honnappa.Nagarahalli, nd, stable, Ruifeng Wang

>This patch fixes RTE SMP barrier bugs for the perf test of eventdev.
>
>For the "perf_process_last_stage" function, wmb after storing
>processed_pkts should be moved before it. This is because the worker
>lcore should ensure it has really finished data processing, e.g. event
>stored into buffers, before the shared variables "w-
>>processed_pkts"are
>stored.
>
>For the "perf_process_last_stage_latency", on the one hand, the wmb
>should be moved before storing into "w->processed_pkts". The reason
>is
>the same as above. But on the other hand, for "w->latency", wmb is
>unnecessary due to data dependency.
>
>Fixes: 2369f73329f8 ("app/testeventdev: add perf queue worker
>functions")
>Cc: jerinj@marvell.com
>Cc: stable@dpdk.org
>
>Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
>Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>

Acked-by: Pavan Nikhilesh <pbhagavatula@marvell.com>

>---
> app/test-eventdev/test_perf_common.h | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
>diff --git a/app/test-eventdev/test_perf_common.h b/app/test-
>eventdev/test_perf_common.h
>index ff9705df8..e7233e5a5 100644
>--- a/app/test-eventdev/test_perf_common.h
>+++ b/app/test-eventdev/test_perf_common.h
>@@ -97,8 +97,13 @@ perf_process_last_stage(struct rte_mempool
>*const pool,
> 		void *bufs[], int const buf_sz, uint8_t count)
> {
> 	bufs[count++] = ev->event_ptr;
>-	w->processed_pkts++;
>+
>+	/* wmb here ensures event_prt is stored before
>+	 * updating the number of processed packets
>+	 * for worker lcores
>+	 */
> 	rte_smp_wmb();
>+	w->processed_pkts++;
>
> 	if (unlikely(count == buf_sz)) {
> 		count = 0;
>@@ -116,6 +121,12 @@ perf_process_last_stage_latency(struct
>rte_mempool *const pool,
> 	struct perf_elt *const m = ev->event_ptr;
>
> 	bufs[count++] = ev->event_ptr;
>+
>+	/* wmb here ensures event_prt is stored before
>+	 * updating the number of processed packets
>+	 * for worker lcores
>+	 */
>+	rte_smp_wmb();
> 	w->processed_pkts++;
>
> 	if (unlikely(count == buf_sz)) {
>@@ -127,7 +138,6 @@ perf_process_last_stage_latency(struct
>rte_mempool *const pool,
> 	}
>
> 	w->latency += latency;
>-	rte_smp_wmb();
> 	return count;
> }
>
>--
>2.25.1


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

end of thread, other threads:[~2021-01-25 17:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20210114070830.707550-1-feifei.wang2@arm.com>
2021-01-14  7:08 ` [dpdk-stable] [PATCH v1 1/5] app/eventdev: fix SMP barrier bugs for perf test Feifei Wang
2021-01-25 17:50   ` [dpdk-stable] [EXT] [dpdk-dev] " Pavan Nikhilesh Bhagavatula

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