patches for DPDK stable branches
 help / color / mirror / Atom feed
* [RFC] eal: use same atomic intrinsics for gcc and clang
@ 2023-02-11  1:56 Honnappa Nagarahalli
  2023-02-11  8:04 ` Morten Brørup
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Honnappa Nagarahalli @ 2023-02-11  1:56 UTC (permalink / raw)
  To: roretzla, bruce.richardson, mb
  Cc: dev, honnappa.nagarahalli, ruifeng.wang, jerinj, nd, stable,
	pbhagavatula

The size generic atomic intrinsics generate the same
code as the size specific intrinsics for gcc. Use size
generic intrinsics for both gcc and clang.

Fixes: 7bdccb93078e ("eal: fix ARM build with clang")
Cc: stable@dpdk.org
Cc: pbhagavatula@marvell.com

Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
---
 lib/eal/include/generic/rte_atomic.h | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/lib/eal/include/generic/rte_atomic.h b/lib/eal/include/generic/rte_atomic.h
index f5c49a9870..234b268b91 100644
--- a/lib/eal/include/generic/rte_atomic.h
+++ b/lib/eal/include/generic/rte_atomic.h
@@ -176,11 +176,7 @@ rte_atomic16_exchange(volatile uint16_t *dst, uint16_t val);
 static inline uint16_t
 rte_atomic16_exchange(volatile uint16_t *dst, uint16_t val)
 {
-#if defined(__clang__)
 	return __atomic_exchange_n(dst, val, __ATOMIC_SEQ_CST);
-#else
-	return __atomic_exchange_2(dst, val, __ATOMIC_SEQ_CST);
-#endif
 }
 #endif
 
@@ -459,11 +455,7 @@ rte_atomic32_exchange(volatile uint32_t *dst, uint32_t val);
 static inline uint32_t
 rte_atomic32_exchange(volatile uint32_t *dst, uint32_t val)
 {
-#if defined(__clang__)
 	return __atomic_exchange_n(dst, val, __ATOMIC_SEQ_CST);
-#else
-	return __atomic_exchange_4(dst, val, __ATOMIC_SEQ_CST);
-#endif
 }
 #endif
 
@@ -741,11 +733,7 @@ rte_atomic64_exchange(volatile uint64_t *dst, uint64_t val);
 static inline uint64_t
 rte_atomic64_exchange(volatile uint64_t *dst, uint64_t val)
 {
-#if defined(__clang__)
 	return __atomic_exchange_n(dst, val, __ATOMIC_SEQ_CST);
-#else
-	return __atomic_exchange_8(dst, val, __ATOMIC_SEQ_CST);
-#endif
 }
 #endif
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [RFC] eal: use same atomic intrinsics for gcc and clang
  2023-02-11  1:56 [RFC] eal: use same atomic intrinsics for gcc and clang Honnappa Nagarahalli
@ 2023-02-11  8:04 ` Morten Brørup
  2023-02-13 20:01 ` Tyler Retzlaff
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Morten Brørup @ 2023-02-11  8:04 UTC (permalink / raw)
  To: Honnappa Nagarahalli, roretzla, bruce.richardson
  Cc: dev, ruifeng.wang, jerinj, nd, stable, pbhagavatula

> From: Honnappa Nagarahalli [mailto:honnappa.nagarahalli@arm.com]
> Sent: Saturday, 11 February 2023 02.56
> 
> The size generic atomic intrinsics generate the same
> code as the size specific intrinsics for gcc. Use size
> generic intrinsics for both gcc and clang.
> 
> Fixes: 7bdccb93078e ("eal: fix ARM build with clang")
> Cc: stable@dpdk.org
> Cc: pbhagavatula@marvell.com
> 
> Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> ---

Acked-by: Morten Brørup <mb@smartsharesystems.com>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC] eal: use same atomic intrinsics for gcc and clang
  2023-02-11  1:56 [RFC] eal: use same atomic intrinsics for gcc and clang Honnappa Nagarahalli
  2023-02-11  8:04 ` Morten Brørup
@ 2023-02-13 20:01 ` Tyler Retzlaff
  2023-02-13 20:13   ` Honnappa Nagarahalli
  2023-02-16  6:53 ` Ruifeng Wang
  2023-02-18  1:58 ` [PATCH] " Honnappa Nagarahalli
  3 siblings, 1 reply; 7+ messages in thread
From: Tyler Retzlaff @ 2023-02-13 20:01 UTC (permalink / raw)
  To: Honnappa Nagarahalli
  Cc: bruce.richardson, mb, dev, ruifeng.wang, jerinj, nd, stable,
	pbhagavatula

On Fri, Feb 10, 2023 at 07:56:22PM -0600, Honnappa Nagarahalli wrote:
> The size generic atomic intrinsics generate the same
> code as the size specific intrinsics for gcc. Use size
> generic intrinsics for both gcc and clang.
> 
> Fixes: 7bdccb93078e ("eal: fix ARM build with clang")
> Cc: stable@dpdk.org
> Cc: pbhagavatula@marvell.com
> 
> Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>

Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>

so first of all thanks for fixing this up. it was confusing me why it
was being conditionally compiled (there was no documented rationale).

i do have a slight concern that perhaps the reason this was done was
because __atomic_exchange_n on some gcc versions or for some specific
target processor was generating less than desirable code but if nobody
else has this concern i won't get in the way since it simplifies things.

thanks!

> ---
>  lib/eal/include/generic/rte_atomic.h | 12 ------------
>  1 file changed, 12 deletions(-)
> 
> diff --git a/lib/eal/include/generic/rte_atomic.h b/lib/eal/include/generic/rte_atomic.h
> index f5c49a9870..234b268b91 100644
> --- a/lib/eal/include/generic/rte_atomic.h
> +++ b/lib/eal/include/generic/rte_atomic.h
> @@ -176,11 +176,7 @@ rte_atomic16_exchange(volatile uint16_t *dst, uint16_t val);
>  static inline uint16_t
>  rte_atomic16_exchange(volatile uint16_t *dst, uint16_t val)
>  {
> -#if defined(__clang__)
>  	return __atomic_exchange_n(dst, val, __ATOMIC_SEQ_CST);
> -#else
> -	return __atomic_exchange_2(dst, val, __ATOMIC_SEQ_CST);
> -#endif
>  }
>  #endif
>  
> @@ -459,11 +455,7 @@ rte_atomic32_exchange(volatile uint32_t *dst, uint32_t val);
>  static inline uint32_t
>  rte_atomic32_exchange(volatile uint32_t *dst, uint32_t val)
>  {
> -#if defined(__clang__)
>  	return __atomic_exchange_n(dst, val, __ATOMIC_SEQ_CST);
> -#else
> -	return __atomic_exchange_4(dst, val, __ATOMIC_SEQ_CST);
> -#endif
>  }
>  #endif
>  
> @@ -741,11 +733,7 @@ rte_atomic64_exchange(volatile uint64_t *dst, uint64_t val);
>  static inline uint64_t
>  rte_atomic64_exchange(volatile uint64_t *dst, uint64_t val)
>  {
> -#if defined(__clang__)
>  	return __atomic_exchange_n(dst, val, __ATOMIC_SEQ_CST);
> -#else
> -	return __atomic_exchange_8(dst, val, __ATOMIC_SEQ_CST);
> -#endif
>  }
>  #endif
>  
> -- 
> 2.25.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [RFC] eal: use same atomic intrinsics for gcc and clang
  2023-02-13 20:01 ` Tyler Retzlaff
@ 2023-02-13 20:13   ` Honnappa Nagarahalli
  0 siblings, 0 replies; 7+ messages in thread
From: Honnappa Nagarahalli @ 2023-02-13 20:13 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: bruce.richardson, mb, dev, Ruifeng Wang, jerinj, nd, stable,
	pbhagavatula, Stephen Hemminger, nd

<snip>

> 
> On Fri, Feb 10, 2023 at 07:56:22PM -0600, Honnappa Nagarahalli wrote:
> > The size generic atomic intrinsics generate the same code as the size
> > specific intrinsics for gcc. Use size generic intrinsics for both gcc
> > and clang.
> >
> > Fixes: 7bdccb93078e ("eal: fix ARM build with clang")
> > Cc: stable@dpdk.org
> > Cc: pbhagavatula@marvell.com
> >
> > Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> 
> Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> 
> so first of all thanks for fixing this up. it was confusing me why it was being
> conditionally compiled (there was no documented rationale).
> 
> i do have a slight concern that perhaps the reason this was done was because
> __atomic_exchange_n on some gcc versions or for some specific target
> processor was generating less than desirable code but if nobody else has this
> concern i won't get in the way since it simplifies things.
Agree, I could not find a rationale from the commit logs. However, I did some tests on Godbolt and the latest compilers generated the same code for both the variants for x86 and ARM.
I think the initial author was Stephen, may be he has some comments.

> 
> thanks!
> 
> > ---
> >  lib/eal/include/generic/rte_atomic.h | 12 ------------
> >  1 file changed, 12 deletions(-)
> >
> > diff --git a/lib/eal/include/generic/rte_atomic.h
> > b/lib/eal/include/generic/rte_atomic.h
> > index f5c49a9870..234b268b91 100644
> > --- a/lib/eal/include/generic/rte_atomic.h
> > +++ b/lib/eal/include/generic/rte_atomic.h
> > @@ -176,11 +176,7 @@ rte_atomic16_exchange(volatile uint16_t *dst,
> > uint16_t val);  static inline uint16_t  rte_atomic16_exchange(volatile
> > uint16_t *dst, uint16_t val)  { -#if defined(__clang__)
> >  	return __atomic_exchange_n(dst, val, __ATOMIC_SEQ_CST); -#else
> > -	return __atomic_exchange_2(dst, val, __ATOMIC_SEQ_CST);
> > -#endif
> >  }
> >  #endif
> >
> > @@ -459,11 +455,7 @@ rte_atomic32_exchange(volatile uint32_t *dst,
> > uint32_t val);  static inline uint32_t  rte_atomic32_exchange(volatile
> > uint32_t *dst, uint32_t val)  { -#if defined(__clang__)
> >  	return __atomic_exchange_n(dst, val, __ATOMIC_SEQ_CST); -#else
> > -	return __atomic_exchange_4(dst, val, __ATOMIC_SEQ_CST);
> > -#endif
> >  }
> >  #endif
> >
> > @@ -741,11 +733,7 @@ rte_atomic64_exchange(volatile uint64_t *dst,
> > uint64_t val);  static inline uint64_t  rte_atomic64_exchange(volatile
> > uint64_t *dst, uint64_t val)  { -#if defined(__clang__)
> >  	return __atomic_exchange_n(dst, val, __ATOMIC_SEQ_CST); -#else
> > -	return __atomic_exchange_8(dst, val, __ATOMIC_SEQ_CST);
> > -#endif
> >  }
> >  #endif
> >
> > --
> > 2.25.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [RFC] eal: use same atomic intrinsics for gcc and clang
  2023-02-11  1:56 [RFC] eal: use same atomic intrinsics for gcc and clang Honnappa Nagarahalli
  2023-02-11  8:04 ` Morten Brørup
  2023-02-13 20:01 ` Tyler Retzlaff
@ 2023-02-16  6:53 ` Ruifeng Wang
  2023-02-18  1:58 ` [PATCH] " Honnappa Nagarahalli
  3 siblings, 0 replies; 7+ messages in thread
From: Ruifeng Wang @ 2023-02-16  6:53 UTC (permalink / raw)
  To: Honnappa Nagarahalli, roretzla, bruce.richardson, mb
  Cc: dev, Honnappa Nagarahalli, jerinj, nd, stable, pbhagavatula, nd

> -----Original Message-----
> From: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> Sent: Saturday, February 11, 2023 9:56 AM
> To: roretzla@linux.microsoft.com; bruce.richardson@intel.com; mb@smartsharesystems.com
> Cc: dev@dpdk.org; Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>; Ruifeng Wang
> <Ruifeng.Wang@arm.com>; jerinj@marvell.com; nd <nd@arm.com>; stable@dpdk.org;
> pbhagavatula@marvell.com
> Subject: [RFC] eal: use same atomic intrinsics for gcc and clang
> 
> The size generic atomic intrinsics generate the same code as the size specific intrinsics
> for gcc. Use size generic intrinsics for both gcc and clang.
> 
> Fixes: 7bdccb93078e ("eal: fix ARM build with clang")
> Cc: stable@dpdk.org
> Cc: pbhagavatula@marvell.com
> 
> Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> ---
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>

Thanks.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] eal: use same atomic intrinsics for gcc and clang
  2023-02-11  1:56 [RFC] eal: use same atomic intrinsics for gcc and clang Honnappa Nagarahalli
                   ` (2 preceding siblings ...)
  2023-02-16  6:53 ` Ruifeng Wang
@ 2023-02-18  1:58 ` Honnappa Nagarahalli
  2023-02-20  7:46   ` Thomas Monjalon
  3 siblings, 1 reply; 7+ messages in thread
From: Honnappa Nagarahalli @ 2023-02-18  1:58 UTC (permalink / raw)
  To: roretzla, bruce.richardson, mb
  Cc: dev, honnappa.nagarahalli, ruifeng.wang, jerinj, nd, stable,
	pbhagavatula, Ola Liljedahl

The size generic atomic intrinsics generate the same
code as the size specific intrinsics for gcc. Use size
generic intrinsics for both gcc and clang.

Fixes: 7bdccb93078e ("eal: fix ARM build with clang")
Cc: stable@dpdk.org
Cc: pbhagavatula@marvell.com

Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Ola Liljedahl <ola.liljedahl@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/eal/include/generic/rte_atomic.h | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/lib/eal/include/generic/rte_atomic.h b/lib/eal/include/generic/rte_atomic.h
index f5c49a9870..234b268b91 100644
--- a/lib/eal/include/generic/rte_atomic.h
+++ b/lib/eal/include/generic/rte_atomic.h
@@ -176,11 +176,7 @@ rte_atomic16_exchange(volatile uint16_t *dst, uint16_t val);
 static inline uint16_t
 rte_atomic16_exchange(volatile uint16_t *dst, uint16_t val)
 {
-#if defined(__clang__)
 	return __atomic_exchange_n(dst, val, __ATOMIC_SEQ_CST);
-#else
-	return __atomic_exchange_2(dst, val, __ATOMIC_SEQ_CST);
-#endif
 }
 #endif
 
@@ -459,11 +455,7 @@ rte_atomic32_exchange(volatile uint32_t *dst, uint32_t val);
 static inline uint32_t
 rte_atomic32_exchange(volatile uint32_t *dst, uint32_t val)
 {
-#if defined(__clang__)
 	return __atomic_exchange_n(dst, val, __ATOMIC_SEQ_CST);
-#else
-	return __atomic_exchange_4(dst, val, __ATOMIC_SEQ_CST);
-#endif
 }
 #endif
 
@@ -741,11 +733,7 @@ rte_atomic64_exchange(volatile uint64_t *dst, uint64_t val);
 static inline uint64_t
 rte_atomic64_exchange(volatile uint64_t *dst, uint64_t val)
 {
-#if defined(__clang__)
 	return __atomic_exchange_n(dst, val, __ATOMIC_SEQ_CST);
-#else
-	return __atomic_exchange_8(dst, val, __ATOMIC_SEQ_CST);
-#endif
 }
 #endif
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] eal: use same atomic intrinsics for gcc and clang
  2023-02-18  1:58 ` [PATCH] " Honnappa Nagarahalli
@ 2023-02-20  7:46   ` Thomas Monjalon
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Monjalon @ 2023-02-20  7:46 UTC (permalink / raw)
  To: Honnappa Nagarahalli
  Cc: roretzla, bruce.richardson, mb, dev, honnappa.nagarahalli,
	ruifeng.wang, jerinj, nd, stable, pbhagavatula, Ola Liljedahl

18/02/2023 02:58, Honnappa Nagarahalli:
> The size generic atomic intrinsics generate the same
> code as the size specific intrinsics for gcc. Use size
> generic intrinsics for both gcc and clang.
> 
> Fixes: 7bdccb93078e ("eal: fix ARM build with clang")
> Cc: stable@dpdk.org
> Cc: pbhagavatula@marvell.com
> 
> Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
> Reviewed-by: Ola Liljedahl <ola.liljedahl@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> Acked-by: Morten Brørup <mb@smartsharesystems.com>
> Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>

Applied, thanks.




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-02-20  7:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-11  1:56 [RFC] eal: use same atomic intrinsics for gcc and clang Honnappa Nagarahalli
2023-02-11  8:04 ` Morten Brørup
2023-02-13 20:01 ` Tyler Retzlaff
2023-02-13 20:13   ` Honnappa Nagarahalli
2023-02-16  6:53 ` Ruifeng Wang
2023-02-18  1:58 ` [PATCH] " Honnappa Nagarahalli
2023-02-20  7:46   ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).