From patchwork Mon Oct 25 04:52:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honnappa Nagarahalli X-Patchwork-Id: 102724 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id AA318A0C45; Mon, 25 Oct 2021 06:52:58 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 21394407FF; Mon, 25 Oct 2021 06:52:58 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id 564E24003E for ; Mon, 25 Oct 2021 06:52:56 +0200 (CEST) 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 A4E121FB; Sun, 24 Oct 2021 21:52:55 -0700 (PDT) Received: from qc2400f-1.austin.arm.com (qc2400f-1.austin.arm.com [10.118.12.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9B3953F73D; Sun, 24 Oct 2021 21:52:55 -0700 (PDT) From: Honnappa Nagarahalli To: dev@dpdk.org, honnappa.nagarahalli@arm.com, konstantin.ananyev@intel.com, david.marchand@redhat.com, feifei.wang2@arm.com Cc: ruifeng.wang@arm.com, nd@arm.com Date: Sun, 24 Oct 2021 23:52:33 -0500 Message-Id: <20211025045237.19878-1-honnappa.nagarahalli@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210224212018.17576-1-honnappa.nagarahalli@arm.com> References: <20210224212018.17576-1-honnappa.nagarahalli@arm.com> Subject: [dpdk-dev] [PATCH v3 0/4] Use correct memory ordering in eal functions X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" v3: a) Added Fixes, Cc:stable#dpdk.org in 1/6 b) Merged 3/6 & 4/6 and moved after the first commit in the series c) Merged 2/6 & 5/6 as they need to be in a single commit d) Removed use of volatile in 6/6 (Konstantin) rte_eal_remote_launch and rte_eal_wait_lcore need to provide correct memory ordering to address the data communication from main core to worker core. There are 2 use cases: 1) All the store operations (meant for worker) by main core should be visible to worker core before the worker core runs the assigned function 2) All the store operations by the worker core should be visible to the main core after rte_eal_wait_lcore returns. For the data that needs to be communicated to the worker after the rte_eal_remote_launch returns, load-acquire and store-release semantics should be used. For the main to worker communication, the pointer to function to execute is used as the guard variable. Hence, resetting of the function pointer is important. For the worker to main communication, the existing code uses the lcore state as the guard variable. However, it looks like the FINISHED state is not really required. Hence the FINISHED state is removed before using the state as the guard variable. Honnappa Nagarahalli (4): eal: reset lcore function pointer and argument eal: lcore state FINISHED is not required eal: ensure correct memory ordering test/ring: use relaxed barriers for ring stress test app/test/test_ring_stress_impl.h | 18 +++---- drivers/event/dpaa2/dpaa2_eventdev_selftest.c | 2 +- drivers/event/octeontx/ssovf_evdev_selftest.c | 2 +- drivers/event/sw/sw_evdev_selftest.c | 4 +- examples/l2fwd-keepalive/main.c | 3 +- lib/eal/common/eal_common_launch.c | 13 ++--- lib/eal/freebsd/eal_thread.c | 45 +++++++++++++---- lib/eal/include/rte_launch.h | 21 ++++---- lib/eal/include/rte_service.h | 4 +- lib/eal/linux/eal_thread.c | 48 +++++++++++++------ lib/eal/windows/eal_thread.c | 48 +++++++++++++------ 11 files changed, 132 insertions(+), 76 deletions(-)