On a two-socket Graviton4 (AWS c8g.metal-48xl, 192 Neoverse V2 cores),
dom0 hangs about two minutes into its boot. All 96 pCPUs of one socket
spin in the exclusive loop of atomic_add_return() on dom0's p2m rwlock:
nobody holds the lock, the increment itself never completes. The lock
is hot because every trapped-WFI block copies the vCPU's runstate to a
guest virtual address, and that translation takes the p2m read lock.
LSE atomics guarantee forward progress, and with them dom0 came up in
every boot I tried. Following Linux, the series detects LSE at boot and
puts a check patched by the alternatives in front of each existing
exclusive loop, so CPUs without LSE run the same code as today. Each
LSE sequence keeps the barriers of the loop it bypasses, so the
ordering is the same or stronger.
Tested on the 48xl with our 4.22-based tree, with guests running, and
on staging under QEMU with and without LSE (neoverse-n2, cortex-a57).
Luca Di Maio (5):
xen/arm64: detect the LSE atomic instructions
xen/arm64: use LSE in the atomic_t operations
xen/arm64: use LSE in xchg() and cmpxchg()
xen/arm64: use LSE in the bitops
xen/arm64: use LSE for arch_fetch_and_add()
xen/arch/arm/arch.mk | 3 ++
xen/arch/arm/arm64/lib/bitops.c | 47 ++++++++++++++++----
xen/arch/arm/cpufeature.c | 10 +++++
xen/arch/arm/include/asm/arm64/atomic.h | 55 ++++++++++++++++++++++++
xen/arch/arm/include/asm/arm64/cmpxchg.h | 41 ++++++++++++++++++
xen/arch/arm/include/asm/arm64/lse.h | 31 +++++++++++++
xen/arch/arm/include/asm/arm64/system.h | 20 +++++++++
xen/arch/arm/include/asm/cpufeature.h | 3 +-
xen/arch/arm/include/asm/system.h | 2 +
9 files changed, 203 insertions(+), 9 deletions(-)
create mode 100644 xen/arch/arm/include/asm/arm64/lse.h
base-commit: f460efb764c694304573d1a555477638d8c34f25
--
2.47.3