diff options
author | David Vrabel <david.vrabel@citrix.com> | 2015-08-03 12:29:19 +0100 |
---|---|---|
committer | Ian Campbell <ian.campbell@citrix.com> | 2015-09-15 11:58:47 +0100 |
commit | e625faf45ee1349be7da2b27e38567e01ce4b453 (patch) | |
tree | dcd011a624efae31e6fa7188a14fb80203c53de4 /xen/include/asm-arm/spinlock.h | |
parent | 7f315c5323bb8185319384ae94bf913d4d15902c (diff) |
arm: reduce power use by contented spin locks with WFE/SEV
Instead of cpu_relax() while spinning and observing the ticket head,
introduce arch_lock_relax() which executes a WFE instruction. After
the ticket head is changed call arch_lock_signal() to execute an SEV
instruction (with the required DSB first) to wake any spinners.
This should improve power consumption when locks are contented and
spinning.
For consistency also move arch_lock_(acquire|release)_barrier to
asm/spinlock.h.
Booted the result on arm32 (Midway) and arm64 (Mustang). Build test
only on amd64.
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
[ijc: add barrier, rename as arch_lock_*, move arch_lock_*_barrier, test]
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Diffstat (limited to 'xen/include/asm-arm/spinlock.h')
-rw-r--r-- | xen/include/asm-arm/spinlock.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/xen/include/asm-arm/spinlock.h b/xen/include/asm-arm/spinlock.h index 81955d1697..8cdf9e18ce 100644 --- a/xen/include/asm-arm/spinlock.h +++ b/xen/include/asm-arm/spinlock.h @@ -1,6 +1,13 @@ #ifndef __ASM_SPINLOCK_H #define __ASM_SPINLOCK_H -/* Nothing ARM specific. */ +#define arch_lock_acquire_barrier() smp_mb() +#define arch_lock_release_barrier() smp_mb() + +#define arch_lock_relax() wfe() +#define arch_lock_signal() do { \ + dsb(ishst); \ + sev(); \ +} while(0) #endif /* __ASM_SPINLOCK_H */ |