All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/5] xen/arm64: use LSE atomics when the CPU has them
@ 2026-12-01 16:08 Luca Di Maio
  2026-12-01 16:08 ` [PATCH v2 1/5] xen/arm64: detect the LSE atomic instructions Luca Di Maio
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Luca Di Maio @ 2026-12-01 16:08 UTC (permalink / raw)
  To: xen-devel
  Cc: Luca Di Maio, Stefano Stabellini, Julien Grall, Bertrand Marquis,
	Michal Orzel, Volodymyr Babchuk, Alex Zenla, Alexander M. Merritt,
	Andres Rodriguez, Simon Veith, Steven Noonan

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).

Changes in v2:
- Patch 1: check the assembler for LSE in Kconfig instead of arch.mk (Jan).

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/Kconfig                     |  4 ++
 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, 204 insertions(+), 9 deletions(-)
 create mode 100644 xen/arch/arm/include/asm/arm64/lse.h


base-commit: 091d3c200281ea44846ccdf1e5d39985321c643e
-- 
2.47.3



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-12-01 16:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 16:08 [PATCH v2 0/5] xen/arm64: use LSE atomics when the CPU has them Luca Di Maio
2026-12-01 16:08 ` [PATCH v2 1/5] xen/arm64: detect the LSE atomic instructions Luca Di Maio
2026-12-01 16:08 ` [PATCH v2 2/5] xen/arm64: use LSE in the atomic_t operations Luca Di Maio
2026-12-01 16:08 ` [PATCH v2 3/5] xen/arm64: use LSE in xchg() and cmpxchg() Luca Di Maio
2026-12-01 16:08 ` [PATCH v2 4/5] xen/arm64: use LSE in the bitops Luca Di Maio
2026-12-01 16:08 ` [PATCH v2 5/5] xen/arm64: use LSE for arch_fetch_and_add() Luca Di Maio

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.