From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E92F4A09EF; Tue, 22 Dec 2020 04:23:08 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 22BEFCB83; Tue, 22 Dec 2020 04:22:54 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id F2B12CAE3; Tue, 22 Dec 2020 04:22:51 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5333830E; Mon, 21 Dec 2020 19:22:50 -0800 (PST) Received: from net-x86-dell-8268.shanghai.arm.com (net-x86-dell-8268.shanghai.arm.com [10.169.210.131]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 3024D3F718; Mon, 21 Dec 2020 19:22:47 -0800 (PST) From: Feifei Wang To: Jerin Jacob , Harry van Haaren Cc: dev@dpdk.org, nd@arm.com, Feifei Wang , stable@dpdk.org Date: Tue, 22 Dec 2020 11:22:32 +0800 Message-Id: <20201222032237.36046-2-feifei.wang2@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201222032237.36046-1-feifei.wang2@arm.com> References: <20201222032237.36046-1-feifei.wang2@arm.com> Subject: [dpdk-dev] [RFC PATCH v1 1/6] app/eventdev: fix SMP barrier bugs for perf test X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Reviewed-by: Honnappa Nagarahalli Reviewed-by: Ruifeng Wang --- 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.17.1