[PATCH v2 3/6] eal: add rte atomic qualifier with casts
Morten Brørup
mb at smartsharesystems.com
Mon Aug 14 10:05:10 CEST 2023
> From: Tyler Retzlaff [mailto:roretzla at linux.microsoft.com]
> Sent: Friday, 11 August 2023 19.32
>
> Introduce __rte_atomic qualifying casts in rte_optional atomics inline
> functions to prevent cascading the need to pass __rte_atomic qualified
> arguments.
>
> Warning, this is really implementation dependent and being done
> temporarily to avoid having to convert more of the libraries and tests in
> DPDK in the initial series that introduces the API. The consequence of the
> assumption of the ABI of the types in question not being ``the same'' is
> only a risk that may be realized when enable_stdatomic=true.
>
> Signed-off-by: Tyler Retzlaff <roretzla at linux.microsoft.com>
> ---
> lib/eal/include/generic/rte_atomic.h | 48 ++++++++++++++++++++++++-----------
> -
> lib/eal/include/generic/rte_pause.h | 9 ++++---
> lib/eal/x86/rte_power_intrinsics.c | 7 +++---
> 3 files changed, 42 insertions(+), 22 deletions(-)
>
> diff --git a/lib/eal/include/generic/rte_atomic.h
> b/lib/eal/include/generic/rte_atomic.h
> index f6c4b3e..4f954e0 100644
> --- a/lib/eal/include/generic/rte_atomic.h
> +++ b/lib/eal/include/generic/rte_atomic.h
> @@ -274,7 +274,8 @@
> static inline void
> rte_atomic16_add(rte_atomic16_t *v, int16_t inc)
> {
> - rte_atomic_fetch_add_explicit(&v->cnt, inc, rte_memory_order_seq_cst);
> + rte_atomic_fetch_add_explicit((volatile int16_t __rte_atomic *)&v->cnt,
> inc,
> + rte_memory_order_seq_cst);
As mentioned in my review to the 2/6 patch, I think __rte_atomic should come before the type, like this:
(volatile __rte_atomic int16_t *)
Same with all the changes.
Otherwise good.
Reviewed-by: Morten Brørup <mb at smartsharesystems.com>
More information about the dev
mailing list