Re: [dpdk-dev] Use WFE for spinlock and ring
From: Ruifeng Wang <hidden>
Date: 2021-07-08 09:41:31
-----Original Message----- From: Stephen Hemminger <stephen@networkplumber.org> Sent: Wednesday, July 7, 2021 10:48 PM To: Ruifeng Wang <redacted> Cc: dev@dpdk.org; david.marchand@redhat.com; thomas@monjalon.net; jerinj@marvell.com; nd [off-list ref]; Honnappa Nagarahalli [off-list ref] Subject: Re: [dpdk-dev] Use WFE for spinlock and ring On Sun, 25 Apr 2021 05:56:51 +0000 Ruifeng Wang [off-list ref] wrote:quoted
The rte_wait_until_equal_xxx APIs abstract the functionality of 'polling for a memory location to become equal to a given value'[1]. Use the API for the rte spinlock and ring implementations. With the wait until equal APIs being stable, changes will not impact ABI. [1] http://patches.dpdk.org/cover/62703/ v3: Series rebased. (David) Gavin Hu (1): spinlock: use wfe to reduce contention on aarch64 Ruifeng Wang (1): ring: use wfe to wait for ring tail update on aarch64 lib/eal/include/generic/rte_spinlock.h | 4 ++-- lib/ring/rte_ring_c11_pvt.h | 4 ++-- lib/ring/rte_ring_generic_pvt.h | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-)Other places that should use WFE:
Thank you Stephen for looking into this.
rte_mcslock.h:rte_mcslock_lock()
Existing API can be used in this one.
rte_mcslock_unlock:rte_mcslock_unlock()
This one needs rte_wait_while_xxx variant.
rte_pflock.h:rte_pflock_lock() rte_rwlock.h:rte_rwlock_read_lock() rte_rwlock.h:rte_rwlock_write_lock()
These occurrences have extra logic (AND, conditional branch, CAS) in the loop. I'm not sure generic API can be abstracted from these use cases.
You should also introduce rte_wait_while_XXX variants to handle some of these cases.