Hi Gavin,
>-----Original Message-----
>From: dev <[email protected]> On Behalf Of Gavin Hu
>Sent: Sunday, June 30, 2019 9:51 PM
>To: [email protected]
>Cc: [email protected]; Jerin Jacob Kollanukkaran
><[email protected]>; [email protected];
>[email protected]; [email protected];
>[email protected]; [email protected]; [email protected]
>Subject: [dpdk-dev] [RFC 1/5] eal: add the APIs to wait until equal
>
>The rte_wait_until_equal_xxx APIs abstract the functionality of 'polling
>for a memory location to become equal to a given value'.
>
>Signed-off-by: Gavin Hu <[email protected]>
>Reviewed-by: Ruifeng Wang <[email protected]>
>Reviewed-by: Steve Capper <[email protected]>
>Reviewed-by: Ola Liljedahl <[email protected]>
>Reviewed-by: Honnappa Nagarahalli <[email protected]>
>---
> .../common/include/arch/arm/rte_pause_64.h | 143
>+++++++++++++++++++++
> lib/librte_eal/common/include/generic/rte_pause.h | 20 +++
> 2 files changed, 163 insertions(+)
>
>diff --git a/lib/librte_eal/common/include/arch/arm/rte_pause_64.h
>b/lib/librte_eal/common/include/arch/arm/rte_pause_64.h
>index 93895d3..0095da6 100644
>--- a/lib/librte_eal/common/include/arch/arm/rte_pause_64.h
>+++ b/lib/librte_eal/common/include/arch/arm/rte_pause_64.h
>@@ -17,6 +17,149 @@ static inline void rte_pause(void)
> asm volatile("yield" ::: "memory");
> }
>
>+#ifdef RTE_USE_WFE
>+#define rte_wait_until_equal_relaxed(addr, expected) do {\
>+ typeof(*addr) tmp; \
>+ if (__builtin_constant_p((expected))) \
>+ do { \
>+ if (sizeof(*(addr)) == 16)\
>+ asm volatile( \
>+ "sevl\n" \
>+ "1: wfe\n" \
>+ "ldxrh %w0, %1\n" \
>+ "cmp %w0, %w2\n" \
>+ "bne 1b\n" \
>+ : "=&r"(tmp) \
>+ : "Q"(*addr),
>"i"(expected) \
>+ : "cc", "memory"); \
Can we have early exit here i.e. instead of going directly to wfe can we first
check the condition and then fallthrough?
Something like:
asm volatile(" ldxrh %w0 %1 \n"
" cmp %w0 %w2 \n"
" b.eq 2: \n"
"1: wfe \n"
" ldxrh %w0, %1 \n"
" cmp %w0, %w2 \n"
" b.ne 1b \n"
"2: \n"
:::);
Regards,
Pavan.