From patchwork Thu Sep 9 23:13:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honnappa Nagarahalli X-Patchwork-Id: 508371 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp767517jai; Thu, 9 Sep 2021 16:13:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZ5EJwpkGzLbz0dfCoxIe2jdYSuaA+5EoQbTTZf3oShYlep5cYVPzAgNW/SDX0z+27oOtI X-Received: by 2002:a1c:2905:: with SMTP id p5mr5311780wmp.93.1631229214249; Thu, 09 Sep 2021 16:13:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631229214; cv=none; d=google.com; s=arc-20160816; b=PI8bu+XlK0Ngr+qJVFo9OrpSWZIqdyrgcrFk1tx+fmLqpjy1DW7MhxVV8jKYBTh+3G 4Axca3q2iBBu0LLLjiicn1qaG+HUP0NRAY6EbSy41f+MCDw8rjryLFxywpp4+NdTzI02 0rUQ5TBlJN0GHO/614I0sWwgbjqDpXaLFkac3NfS+d5J6S15wG+N74E5xaKjp3HPKqF8 dCN8WCGnS+8/3jwt7y1zs0alP5QuMsCB+IZBQAMlmMxihDBqQyD0Ta+j4a7ZW+gjZGU6 zO6KIgPWCy8Rgq7jDTYKaC5oIj34At+91UnQMn4l5xjau7XklNfAsiUtQuKrlAJbj1S3 S+xg== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:cc:to:from; bh=+HgHbE8wpZicKlxD6fJF8CGAhjNzw2gVB3L2sXXPhwM=; b=jq1nBpXxq1BjGYIaII7sq/dnHOwwjVs+zzlDTKcDCN4KH8J2VwCx6JeIyrnhG5t9j/ ry4qGZjDMt/AvmLXsXMPk6fxIhA28QEM6EFqxNnYXtzLfOJNFbT8+CP2adL8S/CVhW5q 4JwqYxGvIMdZ65hIrOm843DkIb2KnlMPqV8tGYL+S/zZjo6MTiEe6cyJ8vX/pFmXVk6Z RkY8TQHVNzsoobZ83nwFG3AjSpwGC9CkJA0Diw9etI08AttLWWsbxwRdCqTxYidliQyf V7PwW7qNk758MF+bTZ/l4CLgkOLkVZo2+9VIxH4PPBf8R0rLCDkBDfsYT8R9YiXM3qyE SJIA== 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 y7si3298464wrg.561.2021.09.09.16.13.33; Thu, 09 Sep 2021 16:13:34 -0700 (PDT) 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 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 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