eal: fix link status issue on ppc_64

Message ID 20191014230745.70489-1-drc@linux.vnet.ibm.com (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Headers
Series eal: fix link status issue on ppc_64 |

Checks

Context Check Description
ci/iol-compilation success Compile Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

David Christensen Oct. 14, 2019, 11:07 p.m. UTC
  The rte_atomic64_exchange operation for ppc_64 incorrectly linked
back to a 32 bit generic operation (__atomic_exchange_4) rather than
the 64 bit generic operation (__atomic_exchange_8).  As a result,
only the link speed was passed to the application, not the link
state, link duplex, on link autoneg properties.

Fixes: ff2863570f ("eal: introduce atomic exchange operation")
Cc: sthemmin@microsoft.com"
Cc: stable@dpdk.org

Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
---
 lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

David Marchand Oct. 15, 2019, 7:33 a.m. UTC | #1
Hello David,

On Tue, Oct 15, 2019 at 1:08 AM David Christensen
<drc@linux.vnet.ibm.com> wrote:
>
> The rte_atomic64_exchange operation for ppc_64 incorrectly linked
> back to a 32 bit generic operation (__atomic_exchange_4) rather than
> the 64 bit generic operation (__atomic_exchange_8).  As a result,
> only the link speed was passed to the application, not the link
> state, link duplex, on link autoneg properties.

Good catch.
The first impact is the link status, but you can imagine applications
calling this, so I would prefer a title like "eal/ppc: fix 64bits
exchange operation".
WDYT ?

rte_atomic64_exchange has no unit test.
This kind of problem could (should?) have been caught in unit tests.
Maybe something to add later.


>
> Fixes: ff2863570f ("eal: introduce atomic exchange operation")
> Cc: sthemmin@microsoft.com"
> Cc: stable@dpdk.org
>
> Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
> ---
>  lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h b/lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h
> index b13a80de4..7e3e13118 100644
> --- a/lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h
> +++ b/lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h
> @@ -401,7 +401,7 @@ static inline void rte_atomic64_clear(rte_atomic64_t *v)
>  static inline uint64_t
>  rte_atomic64_exchange(volatile uint64_t *dst, uint64_t val)
>  {
> -       return __atomic_exchange_4(dst, val, __ATOMIC_SEQ_CST);
> +       return __atomic_exchange_8(dst, val, __ATOMIC_SEQ_CST);
>  }
>
>  #endif
> --
> 2.18.1
>
  
David Christensen Oct. 15, 2019, 8:50 p.m. UTC | #2
>> The rte_atomic64_exchange operation for ppc_64 incorrectly linked
>> back to a 32 bit generic operation (__atomic_exchange_4) rather than
>> the 64 bit generic operation (__atomic_exchange_8).  As a result,
>> only the link speed was passed to the application, not the link
>> state, link duplex, on link autoneg properties.
> 
> Good catch.
> The first impact is the link status, but you can imagine applications
> calling this, so I would prefer a title like "eal/ppc: fix 64bits
> exchange operation".
> WDYT ?

Sure, I can do that as a v2.

> 
> rte_atomic64_exchange has no unit test.
> This kind of problem could (should?) have been caught in unit tests.
> Maybe something to add later.
> 

I was surprised too.  I'll look at adding a change to the rte_atomic.c
test application.

Dave
  

Patch

diff --git a/lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h b/lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h
index b13a80de4..7e3e13118 100644
--- a/lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h
+++ b/lib/librte_eal/common/include/arch/ppc_64/rte_atomic.h
@@ -401,7 +401,7 @@  static inline void rte_atomic64_clear(rte_atomic64_t *v)
 static inline uint64_t
 rte_atomic64_exchange(volatile uint64_t *dst, uint64_t val)
 {
-	return __atomic_exchange_4(dst, val, __ATOMIC_SEQ_CST);
+	return __atomic_exchange_8(dst, val, __ATOMIC_SEQ_CST);
 }
 
 #endif