From patchwork Wed Feb 24 21:20:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honnappa Nagarahalli X-Patchwork-Id: 386875 Delivered-To: patch@linaro.org Received: by 2002:a02:290e:0:0:0:0:0 with SMTP id p14csp697630jap; Wed, 24 Feb 2021 13:20:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJzWcfCQpTQvLqRCqRBk6Qy3dhiPDg3km7b/o2SUDQbBCOy17tAYFrNi19Hob0A5pYUBtgpy X-Received: by 2002:a05:6402:1445:: with SMTP id d5mr5947322edx.174.1614201632060; Wed, 24 Feb 2021 13:20:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614201632; cv=none; d=google.com; s=arc-20160816; b=0PYpmrdOHDc0yqn80P7jjClxnbOBdEzw9RWFyxkg0e7qHfdtXXRgX3PPSszQy9uYU6 J/kDyQQ3VqffajHXAvAa/QNPvyi7cCIcTXxb+uocxX6o+MCAaGXshDaq8Rg024ut3KE1 KlKXrXG14N7xlggGq4l6YJLpbNrHHfhsrZUWKKPZ5zX7CQvGgpD1IoKJOSRQb49BhfJx HdXeI0xPTOAprNI6AGDjOmKasyofQIeKwxFXYWEzhFr9B8UKjAQkO9b35IGKUx9xNZ7x hA6tttl1wsyjqKC2bg2+luMPPEXSo62Lv3qgnHYqucfcA+SHuZ9sQkO3qCkHp+HYi6jI rSOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:message-id:date:cc:to :from; bh=XT51ig7YS9nW0xcSDpETjQFn+ThnZXZIajxYoVKyzf0=; b=M80LGrF+6BcRYaeBcB7YID70BYcele9sYPONTRKvuwmpikrsfL4X5KYK/v/Ob3BLgE oMVEK9zOw2q9cMfIKstgV/DK6JUmtYbpTS0MizpiyF8xEH85PZAyNeh6HeqPi670V8xr cgo1r3lg/qh31Z1OHmZvZWeGFTyYaq7yqysnnp8AKjJARg3K7nV+XtPhCcr/yy668IZB Qu12LERJaWxPnor+94hdzHz6z7lriDLRoRaeydt5j3/wQW0Y1SWxuDd/7hbGxZpQljX5 rlTXSziWjZQYlsZ/KozZd7TCqmTORe4XlMqo8NUPk/JE502XS0/9g/i59px/DFSroari g2Vg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id n22si2109500ejk.360.2021.02.24.13.20.30; Wed, 24 Feb 2021 13:20:32 -0800 (PST) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) client-ip=217.70.189.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E732C40042; Wed, 24 Feb 2021 22:20:29 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id 195E840040 for ; Wed, 24 Feb 2021 22:20:28 +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 4F997ED1; Wed, 24 Feb 2021 13:20:27 -0800 (PST) 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 45DAC3F73D; Wed, 24 Feb 2021 13:20:27 -0800 (PST) From: Honnappa Nagarahalli To: Cc: dev@dpdk.org, honnappa.nagarahalli@arm.com, ruifeng.wang@arm.com, feifei.wang@arm.com, nd@arm.com Date: Wed, 24 Feb 2021 15:20:13 -0600 Message-Id: <20210224212018.17576-1-honnappa.nagarahalli@arm.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [RFC 0/5] 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 and vice versa. 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 (just like any other writer-reader use case). 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. I would like some feedback on why the FINISHED state is required. I have not paid attention to what it means for backward compatibility. If it is decided to remove this state, documentation changes are required. Honnappa Nagarahalli (5): eal: reset lcore function pointer and argument eal: ensure memory operations are visible to worker eal: lcore state FINISHED is not required 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 | 2 +- lib/librte_eal/common/eal_common_launch.c | 13 +++--- lib/librte_eal/freebsd/eal_thread.c | 31 +++++++++++--- lib/librte_eal/linux/eal_thread.c | 40 +++++++++++++------ lib/librte_eal/windows/eal_thread.c | 34 +++++++++++----- 9 files changed, 94 insertions(+), 52 deletions(-) -- 2.17.1