Hi Pavan,

> -----Original Message-----
> From: Pavan Nikhilesh Bhagavatula <pbhagavat...@marvell.com>
> Sent: Monday, July 1, 2019 5:59 PM
> To: Gavin Hu (Arm Technology China) <gavin...@arm.com>; dev@dpdk.org
> Cc: tho...@monjalon.net; jer...@marvell.com; hemant.agra...@nxp.com;
> bruce.richard...@intel.com; chao...@linux.vnet.ibm.com; Honnappa
> Nagarahalli <honnappa.nagaraha...@arm.com>; nd <n...@arm.com>
> Subject: RE: [dpdk-dev] [RFC 1/5] eal: add the APIs to wait until equal
> 
> Hi Gavin,
> 
> >-----Original Message-----
> >From: dev <dev-boun...@dpdk.org> On Behalf Of Gavin Hu
> >Sent: Sunday, June 30, 2019 9:51 PM
> >To: dev@dpdk.org
> >Cc: tho...@monjalon.net; Jerin Jacob Kollanukkaran
> ><jer...@marvell.com>; hemant.agra...@nxp.com;
> >bruce.richard...@intel.com; chao...@linux.vnet.ibm.com;
> >honnappa.nagaraha...@arm.com; n...@arm.com; gavin...@arm.com
> >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 <gavin...@arm.com>
> >Reviewed-by: Ruifeng Wang <ruifeng.w...@arm.com>
> >Reviewed-by: Steve Capper <steve.cap...@arm.com>
> >Reviewed-by: Ola Liljedahl <ola.liljed...@arm.com>
> >Reviewed-by: Honnappa Nagarahalli <honnappa.nagaraha...@arm.com>
> >---
> > .../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.
Ok, I will do it in next version.

Reply via email to