> -----Original Message----- > From: Jerin Jacob <jerinjac...@gmail.com> > Sent: Monday, November 11, 2019 1:12 PM > To: Ananyev, Konstantin <konstantin.anan...@intel.com> > Cc: tho...@monjalon.net; David Marchand > <david.march...@redhat.com>; dev@dpdk.org; nd <n...@arm.com>; Gavin > Hu (Arm Technology China) <gavin...@arm.com>; Mcnamara, John > <john.mcnam...@intel.com>; Kovacevic, Marko > <marko.kovace...@intel.com>; jer...@marvell.com; Jan Viktorin > <vikto...@rehivetech.com> > Subject: Re: [dpdk-dev] [PATCH v13 2/5] eal: add the APIs to wait until > equal > > On Sat, Nov 9, 2019 at 12:07 AM Ananyev, Konstantin > <konstantin.anan...@intel.com> wrote: > > > > > > > > > -----Original Message----- > > > From: Thomas Monjalon <tho...@monjalon.net> > > > Sent: Friday, November 8, 2019 5:00 PM > > > To: Ananyev, Konstantin <konstantin.anan...@intel.com> > > > Cc: David Marchand <david.march...@redhat.com>; dev@dpdk.org; > n...@arm.com; Gavin Hu <gavin...@arm.com>; Mcnamara, John > > > <john.mcnam...@intel.com>; Kovacevic, Marko > <marko.kovace...@intel.com>; Jerin Jacob <jer...@marvell.com>; Jan > Viktorin > > > <vikto...@rehivetech.com> > > > Subject: Re: [PATCH v13 2/5] eal: add the APIs to wait until equal > > > > > > 08/11/2019 17:38, Ananyev, Konstantin: > > > > > From: Gavin Hu <gavin...@arm.com> > > > > > +static __rte_always_inline void > > > > > +rte_wait_until_equal_64(volatile uint64_t *addr, uint64_t expected, > > > > > + int memorder) > > > > > +{ > > > > > + uint64_t value; > > > > > + > > > > > + assert(memorder == __ATOMIC_ACQUIRE || memorder == > __ATOMIC_RELAXED); > > > > > + > > > > > + /* > > > > > + * Atomic exclusive load from addr, it returns the 64-bit content of > > > > > + * *addr while making it 'monitored',when it is written by someone > > > > > + * else, the 'monitored' state is cleared and a event is generated > > > > > + * implicitly to exit WFE. > > > > > + */ > > > > > +#define __LOAD_EXC_64(src, dst, memorder) { \ > > > > > + if (memorder == __ATOMIC_RELAXED) { \ > > > > > + asm volatile("ldxr %x[tmp], [%x[addr]]" \ > > > > > + : [tmp] "=&r" (dst) \ > > > > > + : [addr] "r"(src) \ > > > > > + : "memory"); \ > > > > > + } else { \ > > > > > + asm volatile("ldaxr %x[tmp], [%x[addr]]" \ > > > > > + : [tmp] "=&r" (dst) \ > > > > > + : [addr] "r"(src) \ > > > > > + : "memory"); \ > > > > > + } } > > > > > + > > > > > + __LOAD_EXC_64(addr, value, memorder) > > > > > + if (value != expected) { > > > > > + __SEVL() > > > > > + do { > > > > > + __WFE() > > > > > + __LOAD_EXC_64(addr, value, memorder) > > > > > + } while (value != expected); > > > > > + } > > > > > +} > > > > > +#undef __LOAD_EXC_64 > > > > > + > > > > > +#undef __SEVL > > > > > +#undef __WFE > > > > > > > > Personally I don't see how these define/undef are better then inline > functions... > > > > > > The benefit it to not pollute the API namespace > > > with some functions which are used only locally. > > > After using a macro, it disappears with #undef. > > > > > > > Again I suppose they might be re-used in future some other ARM > specific low-level primitvies. > > > > > > Do this low-level routines _LOAD_EXC_ need to be exposed in EAL for re- > use? > > > > About load_exc don't know for sure... > > Though as I can see wfe/sevl are used here: > > http://patchwork.dpdk.org/patch/61779/ > > Might be it is possible to reuse these functions/macros... > > But again, I am not arm expert, would be interested to know what arm > guys think. > > > Considering WFE has a requirement on using load_exec on ARM so IMO, it > makes sense to expose > load_exec in conjunction with wfe/sevl to use it properly. Agree, WFE should have more use cases can be developed, not limited to the WAIT_UNTIL_EQUAL_XX APIs. Marvel's patch is an example. Sorry I don't have more use case so far, but Arm is evolving WFE, so I think more use cases are emerging. /Gavin > > > > > > > > > > > My preference would be to keep them as inline function - much > cleaner code. > > > > But as I don't develop for/use, I wouldn't insist and let you and arm > guys to decide. > > > > > > > >
Re: [dpdk-dev] [PATCH v13 2/5] eal: add the APIs to wait until equal
Gavin Hu (Arm Technology China) Sun, 10 Nov 2019 21:52:49 -0800
- [dpdk-dev] [PATCH v13 0/5] use WFE for aar... David Marchand
- [dpdk-dev] [PATCH v13 2/5] eal: add t... David Marchand
- Re: [dpdk-dev] [PATCH v13 2/5] ea... Ananyev, Konstantin
- Re: [dpdk-dev] [PATCH v13 2/5... Thomas Monjalon
- Re: [dpdk-dev] [PATCH v13... Ananyev, Konstantin
- Re: [dpdk-dev] [PATC... Jerin Jacob
- Re: [dpdk-dev] [... Gavin Hu (Arm Technology China)
- Re: [dpdk-de... Honnappa Nagarahalli
- [dpdk-dev] [PATCH v13 1/5] bus/fslmc:... David Marchand
- Re: [dpdk-dev] [PATCH v13 1/5] bu... Honnappa Nagarahalli
- [dpdk-dev] [PATCH v13 3/5] ticketlock... David Marchand
- [dpdk-dev] [PATCH v13 5/5] event/opdl... David Marchand
- [dpdk-dev] [PATCH v13 4/5] net/thunde... David Marchand