From patchwork Mon Jul 3 09:56:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ruifeng Wang X-Patchwork-Id: 129203 X-Patchwork-Delegate: thomas@monjalon.net 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 DDC7B42DAC; Mon, 3 Jul 2023 11:57:00 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B475E40ED5; Mon, 3 Jul 2023 11:57:00 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id A492640156 for ; Mon, 3 Jul 2023 11:56:59 +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 AEAE31FB; Mon, 3 Jul 2023 02:57:41 -0700 (PDT) Received: from net-arm-n1amp-02.shanghai.arm.com (net-arm-n1amp-02.shanghai.arm.com [10.169.210.108]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 34EB13F762; Mon, 3 Jul 2023 02:56:55 -0700 (PDT) From: Ruifeng Wang To: thomas@monjalon.net, david.marchand@redhat.com Cc: dev@dpdk.org, roretzla@linux.microsoft.com, hofors@lysator.liu.se, konstantin.v.ananyev@yandex.ru, honnappa.nagarahalli@arm.com, nd@arm.com, Ruifeng Wang Subject: [PATCH v3] eal: add notes to SMP memory barrier APIs Date: Mon, 3 Jul 2023 17:56:42 +0800 Message-Id: <20230703095642.3326601-1-ruifeng.wang@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230621064420.163931-1-ruifeng.wang@arm.com> References: <20230621064420.163931-1-ruifeng.wang@arm.com> MIME-Version: 1.0 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 The rte_smp_xx() APIs are deprecated. But it is not mentioned in the function header. Added notes in function header for clarification. Signed-off-by: Ruifeng Wang --- v3: Added suggested memory ordering semantic for replacement. Refined deprecation explanation. v2: Made the notes more specific. lib/eal/include/generic/rte_atomic.h | 30 ++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/lib/eal/include/generic/rte_atomic.h b/lib/eal/include/generic/rte_atomic.h index 58df843c54..aef44e2455 100644 --- a/lib/eal/include/generic/rte_atomic.h +++ b/lib/eal/include/generic/rte_atomic.h @@ -55,6 +55,14 @@ static inline void rte_rmb(void); * Guarantees that the LOAD and STORE operations that precede the * rte_smp_mb() call are globally visible across the lcores * before the LOAD and STORE operations that follows it. + * + * @note + * This function is deprecated. + * It provides similar synchronization primitive as atomic fence, + * but has different syntax and memory ordering semantic. Hence + * deprecated for the simplicity of memory ordering semantics in use. + * + * rte_atomic_thread_fence(__ATOMIC_ACQ_REL) should be used instead. */ static inline void rte_smp_mb(void); @@ -64,6 +72,17 @@ static inline void rte_smp_mb(void); * Guarantees that the STORE operations that precede the * rte_smp_wmb() call are globally visible across the lcores * before the STORE operations that follows it. + * + * @note + * This function is deprecated. + * It provides similar synchronization primitive as atomic fence, + * but has different syntax and memory ordering semantic. Hence + * deprecated for the simplicity of memory ordering semantics in use. + * + * rte_atomic_thread_fence(__ATOMIC_RELEASE) should be used instead. + * The fence also guarantees LOAD operations that precede the call + * are globally visible across the lcores before the STORE operations + * that follows it. */ static inline void rte_smp_wmb(void); @@ -73,6 +92,17 @@ static inline void rte_smp_wmb(void); * Guarantees that the LOAD operations that precede the * rte_smp_rmb() call are globally visible across the lcores * before the LOAD operations that follows it. + * + * @note + * This function is deprecated. + * It provides similar synchronization primitive as atomic fence, + * but has different syntax and memory ordering semantic. Hence + * deprecated for the simplicity of memory ordering semantics in use. + * + * rte_atomic_thread_fence(__ATOMIC_ACQUIRE) should be used instead. + * The fence also guarantees LOAD operations that precede the call + * are globally visible across the lcores before the STORE operations + * that follows it. */ static inline void rte_smp_rmb(void); ///@}