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 D5B97A09EF; Tue, 22 Dec 2020 06:09:02 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 53584CC61; Tue, 22 Dec 2020 06:07:52 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 8A2E7CC55; Tue, 22 Dec 2020 06:07:50 +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 00B241042; Mon, 21 Dec 2020 21:07:49 -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 BF4C13F718; Mon, 21 Dec 2020 21:07:45 -0800 (PST) From: Feifei Wang To: Jerin Jacob , Harry van Haaren , Pavan Nikhilesh Cc: dev@dpdk.org, nd@arm.com, Honnappa.Nagarahalli@arm.com, Feifei Wang , pbhagavatula@marvell.com, stable@dpdk.org, Phil Yang Date: Tue, 22 Dec 2020 13:07:25 +0800 Message-Id: <20201222050728.41000-5-feifei.wang2@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201222050728.41000-1-feifei.wang2@arm.com> References: <20201222050728.41000-1-feifei.wang2@arm.com> Subject: [dpdk-dev] [RFC PATCH v1 4/6] app/eventdev: add release barriers for pipeline 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" Add release barriers before updating the processed packets for worker lcores to ensure the worker lcore has really finished data processing and then it can update the processed packets number. Fixes: 314bcf58ca8f ("app/eventdev: add pipeline queue worker functions") Cc: pbhagavatula@marvell.com Cc: stable@dpdk.org Signed-off-by: Phil Yang Signed-off-by: Feifei Wang Reviewed-by: Ruifeng Wang --- app/test-eventdev/test_pipeline_queue.c | 64 +++++++++++++++++++++---- 1 file changed, 56 insertions(+), 8 deletions(-) diff --git a/app/test-eventdev/test_pipeline_queue.c b/app/test-eventdev/test_pipeline_queue.c index 7bebac34f..0c0ec0ceb 100644 --- a/app/test-eventdev/test_pipeline_queue.c +++ b/app/test-eventdev/test_pipeline_queue.c @@ -30,7 +30,13 @@ pipeline_queue_worker_single_stage_tx(void *arg) if (ev.sched_type == RTE_SCHED_TYPE_ATOMIC) { pipeline_event_tx(dev, port, &ev); - w->processed_pkts++; + + /* release barrier here ensures stored operation + * of the event completes before the number of + * processed pkts is visible to the main core + */ + __atomic_fetch_add(&(w->processed_pkts), 1, + __ATOMIC_RELEASE); } else { ev.queue_id++; pipeline_fwd_event(&ev, RTE_SCHED_TYPE_ATOMIC); @@ -59,7 +65,13 @@ pipeline_queue_worker_single_stage_fwd(void *arg) rte_event_eth_tx_adapter_txq_set(ev.mbuf, 0); pipeline_fwd_event(&ev, RTE_SCHED_TYPE_ATOMIC); pipeline_event_enqueue(dev, port, &ev); - w->processed_pkts++; + + /* release barrier here ensures stored operation + * of the event completes before the number of + * processed pkts is visible to the main core + */ + __atomic_fetch_add(&(w->processed_pkts), 1, + __ATOMIC_RELEASE); } return 0; @@ -84,7 +96,13 @@ pipeline_queue_worker_single_stage_burst_tx(void *arg) if (ev[i].sched_type == RTE_SCHED_TYPE_ATOMIC) { pipeline_event_tx(dev, port, &ev[i]); ev[i].op = RTE_EVENT_OP_RELEASE; - w->processed_pkts++; + + /* release barrier here ensures stored operation + * of the event completes before the number of + * processed pkts is visible to the main core + */ + __atomic_fetch_add(&(w->processed_pkts), 1, + __ATOMIC_RELEASE); } else { ev[i].queue_id++; pipeline_fwd_event(&ev[i], @@ -121,7 +139,13 @@ pipeline_queue_worker_single_stage_burst_fwd(void *arg) } pipeline_event_enqueue_burst(dev, port, ev, nb_rx); - w->processed_pkts += nb_rx; + + /* release barrier here ensures stored operation + * of the event completes before the number of + * processed pkts is visible to the main core + */ + __atomic_fetch_add(&(w->processed_pkts), nb_rx, + __ATOMIC_RELEASE); } return 0; @@ -146,7 +170,13 @@ pipeline_queue_worker_multi_stage_tx(void *arg) if (ev.queue_id == tx_queue[ev.mbuf->port]) { pipeline_event_tx(dev, port, &ev); - w->processed_pkts++; + + /* release barrier here ensures stored operation + * of the event completes before the number of + * processed pkts is visible to the main core + */ + __atomic_fetch_add(&(w->processed_pkts), 1, + __ATOMIC_RELEASE); continue; } @@ -180,7 +210,13 @@ pipeline_queue_worker_multi_stage_fwd(void *arg) ev.queue_id = tx_queue[ev.mbuf->port]; rte_event_eth_tx_adapter_txq_set(ev.mbuf, 0); pipeline_fwd_event(&ev, RTE_SCHED_TYPE_ATOMIC); - w->processed_pkts++; + + /* release barrier here ensures stored operation + * of the event completes before the number of + * processed pkts is visible to the main core + */ + __atomic_fetch_add(&(w->processed_pkts), 1, + __ATOMIC_RELEASE); } else { ev.queue_id++; pipeline_fwd_event(&ev, sched_type_list[cq_id]); @@ -214,7 +250,13 @@ pipeline_queue_worker_multi_stage_burst_tx(void *arg) if (ev[i].queue_id == tx_queue[ev[i].mbuf->port]) { pipeline_event_tx(dev, port, &ev[i]); ev[i].op = RTE_EVENT_OP_RELEASE; - w->processed_pkts++; + + /* release barrier here ensures stored operation + * of the event completes before the number of + * processed pkts is visible to the main core + */ + __atomic_fetch_add(&(w->processed_pkts), 1, + __ATOMIC_RELEASE); continue; } @@ -254,7 +296,13 @@ pipeline_queue_worker_multi_stage_burst_fwd(void *arg) rte_event_eth_tx_adapter_txq_set(ev[i].mbuf, 0); pipeline_fwd_event(&ev[i], RTE_SCHED_TYPE_ATOMIC); - w->processed_pkts++; + + /* release barrier here ensures stored operation + * of the event completes before the number of + * processed pkts is visible to the main core + */ + __atomic_fetch_add(&(w->processed_pkts), 1, + __ATOMIC_RELEASE); } else { ev[i].queue_id++; pipeline_fwd_event(&ev[i], -- 2.17.1