[dpdk-dev] [RFC 1/5] eal: add the APIs to wait until equal

Gavin Hu (Arm Technology China) Gavin.Hu at arm.com
Tue Jul 2 16:08:29 CEST 2019


Hi Pavan,

> -----Original Message-----
> From: Pavan Nikhilesh Bhagavatula <pbhagavatula at marvell.com>
> Sent: Monday, July 1, 2019 5:59 PM
> To: Gavin Hu (Arm Technology China) <Gavin.Hu at arm.com>; dev at dpdk.org
> Cc: thomas at monjalon.net; jerinj at marvell.com; hemant.agrawal at nxp.com;
> bruce.richardson at intel.com; chaozhu at linux.vnet.ibm.com; Honnappa
> Nagarahalli <Honnappa.Nagarahalli at arm.com>; nd <nd at arm.com>
> Subject: RE: [dpdk-dev] [RFC 1/5] eal: add the APIs to wait until equal
> 
> Hi Gavin,
> 
> >-----Original Message-----
> >From: dev <dev-bounces at dpdk.org> On Behalf Of Gavin Hu
> >Sent: Sunday, June 30, 2019 9:51 PM
> >To: dev at dpdk.org
> >Cc: thomas at monjalon.net; Jerin Jacob Kollanukkaran
> ><jerinj at marvell.com>; hemant.agrawal at nxp.com;
> >bruce.richardson at intel.com; chaozhu at linux.vnet.ibm.com;
> >Honnappa.Nagarahalli at arm.com; nd at arm.com; gavin.hu at 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.hu at arm.com>
> >Reviewed-by: Ruifeng Wang <ruifeng.wang at arm.com>
> >Reviewed-by: Steve Capper <steve.capper at arm.com>
> >Reviewed-by: Ola Liljedahl <ola.liljedahl at arm.com>
> >Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli at 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.


More information about the dev mailing list