From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 036C2A0547; Fri, 10 Sep 2021 01:13:33 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 853104003F; Fri, 10 Sep 2021 01:13:33 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id 9A5E64003E for ; Fri, 10 Sep 2021 01:13:32 +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 D6D1931B; Thu, 9 Sep 2021 16:13:31 -0700 (PDT) Received: from 2p2660v4-1.austin.arm.com (2p2660v4-1.austin.arm.com [10.118.13.211]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CF0853F73D; Thu, 9 Sep 2021 16:13:31 -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: Thu, 9 Sep 2021 18:13:06 -0500 Message-Id: <20210909231312.2572006-1-honnappa.nagarahalli@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210224212018.17576-1-honnappa.nagarahalli@arm.com> References: <20210224212018.17576-1-honnappa.nagarahalli@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 0/6] 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" 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 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, the state is also modified by the main (where it sets the state to FINISHED) which breaks the reader-writer semantics. It looks like the FINISHED state is not really required. Hence the FINISHED state is removed before using the state as the guard variable. (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) v2: 1) Added documentation changes 2) Changed rte_eal_wait_lcore API definition to reflect the removal of FINISHED state. Honnappa Nagarahalli (6): eal: reset lcore function pointer and argument eal: ensure memory operations are visible to worker eal: lcore state FINISHED is not required eal: update rte_eal_wait_lcore definition eal: ensure memory operations are visible to main 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(-) -- 2.25.1