From: Thomas Monjalon <thomas@monjalon.net>
To: Tyler Retzlaff <roretzla@linux.microsoft.com>
Cc: dev@dpdk.org, techboard@dpdk.org,
"Bruce Richardson" <bruce.richardson@intel.com>,
"Honnappa Nagarahalli" <honnappa.nagarahalli@arm.com>,
"Ruifeng Wang" <ruifeng.wang@arm.com>,
"Jerin Jacob" <jerinj@marvell.com>,
"Sunil Kumar Kori" <skori@marvell.com>,
"Mattias Rönnblom" <mattias.ronnblom@ericsson.com>,
"Joyce Kong" <joyce.kong@arm.com>,
"David Christensen" <drc@linux.vnet.ibm.com>,
"Konstantin Ananyev" <konstantin.v.ananyev@yandex.ru>,
"David Hunt" <david.hunt@intel.com>,
"David Marchand" <david.marchand@redhat.com>
Subject: Re: [PATCH v6 1/6] eal: provide rte stdatomics optional atomics API
Date: Thu, 28 Sep 2023 10:06:11 +0200 [thread overview]
Message-ID: <5908573.LM0AJKV5NW@thomas> (raw)
In-Reply-To: <1692738045-32363-2-git-send-email-roretzla@linux.microsoft.com>
22/08/2023 23:00, Tyler Retzlaff:
> --- a/lib/eal/include/generic/rte_rwlock.h
> +++ b/lib/eal/include/generic/rte_rwlock.h
> @@ -32,6 +32,7 @@
> #include <rte_common.h>
> #include <rte_lock_annotations.h>
> #include <rte_pause.h>
> +#include <rte_stdatomic.h>
I'm not sure about adding the include in patch 1 if it is not used here.
> --- /dev/null
> +++ b/lib/eal/include/rte_stdatomic.h
> @@ -0,0 +1,198 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2023 Microsoft Corporation
> + */
> +
> +#ifndef _RTE_STDATOMIC_H_
> +#define _RTE_STDATOMIC_H_
> +
> +#include <assert.h>
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#ifdef RTE_ENABLE_STDATOMIC
> +#ifdef __STDC_NO_ATOMICS__
> +#error enable_stdatomics=true but atomics not supported by toolchain
> +#endif
> +
> +#include <stdatomic.h>
> +
> +/* RTE_ATOMIC(type) is provided for use as a type specifier
> + * permitting designation of an rte atomic type.
> + */
> +#define RTE_ATOMIC(type) _Atomic(type)
> +
> +/* __rte_atomic is provided for type qualification permitting
> + * designation of an rte atomic qualified type-name.
Sorry I don't understand this comment.
> + */
> +#define __rte_atomic _Atomic
> +
> +/* The memory order is an enumerated type in C11. */
> +typedef memory_order rte_memory_order;
> +
> +#define rte_memory_order_relaxed memory_order_relaxed
> +#ifdef __ATOMIC_RELAXED
> +static_assert(rte_memory_order_relaxed == __ATOMIC_RELAXED,
> + "rte_memory_order_relaxed == __ATOMIC_RELAXED");
Not sure about using static_assert or RTE_BUILD_BUG_ON
> +#endif
> +
> +#define rte_memory_order_consume memory_order_consume
> +#ifdef __ATOMIC_CONSUME
> +static_assert(rte_memory_order_consume == __ATOMIC_CONSUME,
> + "rte_memory_order_consume == __ATOMIC_CONSUME");
> +#endif
> +
> +#define rte_memory_order_acquire memory_order_acquire
> +#ifdef __ATOMIC_ACQUIRE
> +static_assert(rte_memory_order_acquire == __ATOMIC_ACQUIRE,
> + "rte_memory_order_acquire == __ATOMIC_ACQUIRE");
> +#endif
> +
> +#define rte_memory_order_release memory_order_release
> +#ifdef __ATOMIC_RELEASE
> +static_assert(rte_memory_order_release == __ATOMIC_RELEASE,
> + "rte_memory_order_release == __ATOMIC_RELEASE");
> +#endif
> +
> +#define rte_memory_order_acq_rel memory_order_acq_rel
> +#ifdef __ATOMIC_ACQ_REL
> +static_assert(rte_memory_order_acq_rel == __ATOMIC_ACQ_REL,
> + "rte_memory_order_acq_rel == __ATOMIC_ACQ_REL");
> +#endif
> +
> +#define rte_memory_order_seq_cst memory_order_seq_cst
> +#ifdef __ATOMIC_SEQ_CST
> +static_assert(rte_memory_order_seq_cst == __ATOMIC_SEQ_CST,
> + "rte_memory_order_seq_cst == __ATOMIC_SEQ_CST");
> +#endif
> +
> +#define rte_atomic_load_explicit(ptr, memorder) \
> + atomic_load_explicit(ptr, memorder)
> +
> +#define rte_atomic_store_explicit(ptr, val, memorder) \
> + atomic_store_explicit(ptr, val, memorder)
> +
> +#define rte_atomic_exchange_explicit(ptr, val, memorder) \
> + atomic_exchange_explicit(ptr, val, memorder)
> +
> +#define rte_atomic_compare_exchange_strong_explicit( \
> + ptr, expected, desired, succ_memorder, fail_memorder) \
> + atomic_compare_exchange_strong_explicit( \
> + ptr, expected, desired, succ_memorder, fail_memorder)
> +
> +#define rte_atomic_compare_exchange_weak_explicit( \
> + ptr, expected, desired, succ_memorder, fail_memorder) \
> + atomic_compare_exchange_weak_explicit( \
> + ptr, expected, desired, succ_memorder, fail_memorder)
> +
> +#define rte_atomic_fetch_add_explicit(ptr, val, memorder) \
> + atomic_fetch_add_explicit(ptr, val, memorder)
> +
> +#define rte_atomic_fetch_sub_explicit(ptr, val, memorder) \
> + atomic_fetch_sub_explicit(ptr, val, memorder)
> +
> +#define rte_atomic_fetch_and_explicit(ptr, val, memorder) \
> + atomic_fetch_and_explicit(ptr, val, memorder)
> +
> +#define rte_atomic_fetch_xor_explicit(ptr, val, memorder) \
> + atomic_fetch_xor_explicit(ptr, val, memorder)
> +
> +#define rte_atomic_fetch_or_explicit(ptr, val, memorder) \
> + atomic_fetch_or_explicit(ptr, val, memorder)
> +
> +#define rte_atomic_fetch_nand_explicit(ptr, val, memorder) \
> + atomic_fetch_nand_explicit(ptr, val, memorder)
> +
> +#define rte_atomic_flag_test_and_set_explicit(ptr, memorder) \
> + atomic_flag_test_and_set_explicit(ptr, memorder)
> +
> +#define rte_atomic_flag_clear_explicit(ptr, memorder) \
> + atomic_flag_clear_explicit(ptr, memorder)
> +
> +/* We provide internal macro here to allow conditional expansion
> + * in the body of the per-arch rte_atomic_thread_fence inline functions.
> + */
> +#define __rte_atomic_thread_fence(memorder) \
> + atomic_thread_fence(memorder)
> +
> +#else
Better to add some context in comment of this "else": /* !RTE_ENABLE_STDATOMIC */
> +
> +/* RTE_ATOMIC(type) is provided for use as a type specifier
> + * permitting designation of an rte atomic type.
> + */
The comment should say it has no effect.
Or no comment at all for this part.
> +#define RTE_ATOMIC(type) type
> +
> +/* __rte_atomic is provided for type qualification permitting
> + * designation of an rte atomic qualified type-name.
> + */
> +#define __rte_atomic
> +
> +/* The memory order is an integer type in GCC built-ins,
> + * not an enumerated type like in C11.
> + */
> +typedef int rte_memory_order;
> +
> +#define rte_memory_order_relaxed __ATOMIC_RELAXED
> +#define rte_memory_order_consume __ATOMIC_CONSUME
> +#define rte_memory_order_acquire __ATOMIC_ACQUIRE
> +#define rte_memory_order_release __ATOMIC_RELEASE
> +#define rte_memory_order_acq_rel __ATOMIC_ACQ_REL
> +#define rte_memory_order_seq_cst __ATOMIC_SEQ_CST
> +
> +#define rte_atomic_load_explicit(ptr, memorder) \
> + __atomic_load_n(ptr, memorder)
> +
> +#define rte_atomic_store_explicit(ptr, val, memorder) \
> + __atomic_store_n(ptr, val, memorder)
> +
> +#define rte_atomic_exchange_explicit(ptr, val, memorder) \
> + __atomic_exchange_n(ptr, val, memorder)
> +
> +#define rte_atomic_compare_exchange_strong_explicit( \
> + ptr, expected, desired, succ_memorder, fail_memorder) \
> + __atomic_compare_exchange_n( \
> + ptr, expected, desired, 0, succ_memorder, fail_memorder)
> +
> +#define rte_atomic_compare_exchange_weak_explicit( \
> + ptr, expected, desired, succ_memorder, fail_memorder) \
> + __atomic_compare_exchange_n( \
> + ptr, expected, desired, 1, succ_memorder, fail_memorder)
> +
> +#define rte_atomic_fetch_add_explicit(ptr, val, memorder) \
> + __atomic_fetch_add(ptr, val, memorder)
> +
> +#define rte_atomic_fetch_sub_explicit(ptr, val, memorder) \
> + __atomic_fetch_sub(ptr, val, memorder)
> +
> +#define rte_atomic_fetch_and_explicit(ptr, val, memorder) \
> + __atomic_fetch_and(ptr, val, memorder)
> +
> +#define rte_atomic_fetch_xor_explicit(ptr, val, memorder) \
> + __atomic_fetch_xor(ptr, val, memorder)
> +
> +#define rte_atomic_fetch_or_explicit(ptr, val, memorder) \
> + __atomic_fetch_or(ptr, val, memorder)
> +
> +#define rte_atomic_fetch_nand_explicit(ptr, val, memorder) \
> + __atomic_fetch_nand(ptr, val, memorder)
> +
> +#define rte_atomic_flag_test_and_set_explicit(ptr, memorder) \
> + __atomic_test_and_set(ptr, memorder)
> +
> +#define rte_atomic_flag_clear_explicit(ptr, memorder) \
> + __atomic_clear(ptr, memorder)
> +
> +/* We provide internal macro here to allow conditional expansion
> + * in the body of the per-arch rte_atomic_thread_fence inline functions.
> + */
> +#define __rte_atomic_thread_fence(memorder) \
> + __atomic_thread_fence(memorder)
> +
> +#endif
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* _RTE_STDATOMIC_H_ */
next prev parent reply other threads:[~2023-09-28 8:06 UTC|newest]
Thread overview: 82+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-11 1:31 [PATCH 0/6] RFC optional rte optional stdatomics API Tyler Retzlaff
2023-08-11 1:31 ` [PATCH 1/6] eal: provide rte stdatomics optional atomics API Tyler Retzlaff
2023-08-11 8:56 ` Bruce Richardson
2023-08-11 9:42 ` Morten Brørup
2023-08-11 15:54 ` Tyler Retzlaff
2023-08-14 9:04 ` Morten Brørup
2023-08-11 1:31 ` [PATCH 2/6] eal: adapt EAL to present rte " Tyler Retzlaff
2023-08-11 1:31 ` [PATCH 3/6] eal: add rte atomic qualifier with casts Tyler Retzlaff
2023-08-11 1:31 ` [PATCH 4/6] distributor: adapt for EAL optional atomics API changes Tyler Retzlaff
2023-08-11 1:32 ` [PATCH 5/6] bpf: " Tyler Retzlaff
2023-08-11 1:32 ` [PATCH 6/6] devtools: forbid new direct use of GCC atomic builtins Tyler Retzlaff
2023-08-11 8:57 ` Bruce Richardson
2023-08-11 9:51 ` Morten Brørup
2023-08-11 15:56 ` Tyler Retzlaff
2023-08-14 6:37 ` Morten Brørup
2023-08-11 17:32 ` [PATCH v2 0/6] RFC optional rte optional stdatomics API Tyler Retzlaff
2023-08-11 17:32 ` [PATCH v2 1/6] eal: provide rte stdatomics optional atomics API Tyler Retzlaff
2023-08-14 7:06 ` Morten Brørup
2023-08-11 17:32 ` [PATCH v2 2/6] eal: adapt EAL to present rte " Tyler Retzlaff
2023-08-14 8:00 ` Morten Brørup
2023-08-14 17:47 ` Tyler Retzlaff
2023-08-16 20:13 ` Morten Brørup
2023-08-16 20:32 ` Tyler Retzlaff
2023-08-11 17:32 ` [PATCH v2 3/6] eal: add rte atomic qualifier with casts Tyler Retzlaff
2023-08-14 8:05 ` Morten Brørup
2023-08-11 17:32 ` [PATCH v2 4/6] distributor: adapt for EAL optional atomics API changes Tyler Retzlaff
2023-08-14 8:07 ` Morten Brørup
2023-08-11 17:32 ` [PATCH v2 5/6] bpf: " Tyler Retzlaff
2023-08-14 8:11 ` Morten Brørup
2023-08-11 17:32 ` [PATCH v2 6/6] devtools: forbid new direct use of GCC atomic builtins Tyler Retzlaff
2023-08-14 8:12 ` Morten Brørup
2023-08-16 19:19 ` [PATCH v3 0/6] RFC optional rte optional stdatomics API Tyler Retzlaff
2023-08-16 19:19 ` [PATCH v3 1/6] eal: provide rte stdatomics optional atomics API Tyler Retzlaff
2023-08-16 20:55 ` Morten Brørup
2023-08-16 21:04 ` Tyler Retzlaff
2023-08-16 21:08 ` Morten Brørup
2023-08-16 21:10 ` Tyler Retzlaff
2023-08-16 19:19 ` [PATCH v3 2/6] eal: adapt EAL to present rte " Tyler Retzlaff
2023-08-16 19:19 ` [PATCH v3 3/6] eal: add rte atomic qualifier with casts Tyler Retzlaff
2023-08-16 19:19 ` [PATCH v3 4/6] distributor: adapt for EAL optional atomics API changes Tyler Retzlaff
2023-08-16 19:19 ` [PATCH v3 5/6] bpf: " Tyler Retzlaff
2023-08-16 19:19 ` [PATCH v3 6/6] devtools: forbid new direct use of GCC atomic builtins Tyler Retzlaff
2023-08-16 21:38 ` [PATCH v4 0/6] RFC optional rte optional stdatomics API Tyler Retzlaff
2023-08-16 21:38 ` [PATCH v4 1/6] eal: provide rte stdatomics optional atomics API Tyler Retzlaff
2023-08-17 11:45 ` Morten Brørup
2023-08-17 19:09 ` Tyler Retzlaff
2023-08-18 6:55 ` Morten Brørup
2023-08-16 21:38 ` [PATCH v4 2/6] eal: adapt EAL to present rte " Tyler Retzlaff
2023-08-16 21:38 ` [PATCH v4 3/6] eal: add rte atomic qualifier with casts Tyler Retzlaff
2023-08-16 21:38 ` [PATCH v4 4/6] distributor: adapt for EAL optional atomics API changes Tyler Retzlaff
2023-08-16 21:38 ` [PATCH v4 5/6] bpf: " Tyler Retzlaff
2023-08-16 21:38 ` [PATCH v4 6/6] devtools: forbid new direct use of GCC atomic builtins Tyler Retzlaff
2023-08-17 11:57 ` Morten Brørup
2023-08-17 19:14 ` Tyler Retzlaff
2023-08-18 7:13 ` Morten Brørup
2023-08-22 18:14 ` Tyler Retzlaff
2023-08-17 21:42 ` [PATCH v5 0/6] optional rte optional stdatomics API Tyler Retzlaff
2023-08-17 21:42 ` [PATCH v5 1/6] eal: provide rte stdatomics optional atomics API Tyler Retzlaff
2023-08-17 21:42 ` [PATCH v5 2/6] eal: adapt EAL to present rte " Tyler Retzlaff
2023-08-17 21:42 ` [PATCH v5 3/6] eal: add rte atomic qualifier with casts Tyler Retzlaff
2023-08-17 21:42 ` [PATCH v5 4/6] distributor: adapt for EAL optional atomics API changes Tyler Retzlaff
2023-08-17 21:42 ` [PATCH v5 5/6] bpf: " Tyler Retzlaff
2023-08-17 21:42 ` [PATCH v5 6/6] devtools: forbid new direct use of GCC atomic builtins Tyler Retzlaff
2023-08-21 22:27 ` [PATCH v5 0/6] optional rte optional stdatomics API Konstantin Ananyev
2023-08-22 21:00 ` [PATCH v6 0/6] rte atomics API for optional stdatomic Tyler Retzlaff
2023-08-22 21:00 ` [PATCH v6 1/6] eal: provide rte stdatomics optional atomics API Tyler Retzlaff
2023-09-28 8:06 ` Thomas Monjalon [this message]
2023-09-29 8:04 ` David Marchand
2023-09-29 8:54 ` Morten Brørup
2023-09-29 9:02 ` David Marchand
2023-09-29 9:26 ` Bruce Richardson
2023-09-29 9:34 ` David Marchand
2023-09-29 10:26 ` Thomas Monjalon
2023-09-29 11:38 ` David Marchand
2023-09-29 11:51 ` Thomas Monjalon
2023-08-22 21:00 ` [PATCH v6 2/6] eal: adapt EAL to present rte " Tyler Retzlaff
2023-08-22 21:00 ` [PATCH v6 3/6] eal: add rte atomic qualifier with casts Tyler Retzlaff
2023-08-22 21:00 ` [PATCH v6 4/6] distributor: adapt for EAL optional atomics API changes Tyler Retzlaff
2023-08-22 21:00 ` [PATCH v6 5/6] bpf: " Tyler Retzlaff
2023-08-22 21:00 ` [PATCH v6 6/6] devtools: forbid new direct use of GCC atomic builtins Tyler Retzlaff
2023-08-29 15:57 ` [PATCH v6 0/6] rte atomics API for optional stdatomic Tyler Retzlaff
2023-09-29 14:09 ` David Marchand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5908573.LM0AJKV5NW@thomas \
--to=thomas@monjalon.net \
--cc=bruce.richardson@intel.com \
--cc=david.hunt@intel.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=drc@linux.vnet.ibm.com \
--cc=honnappa.nagarahalli@arm.com \
--cc=jerinj@marvell.com \
--cc=joyce.kong@arm.com \
--cc=konstantin.v.ananyev@yandex.ru \
--cc=mattias.ronnblom@ericsson.com \
--cc=roretzla@linux.microsoft.com \
--cc=ruifeng.wang@arm.com \
--cc=skori@marvell.com \
--cc=techboard@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.