All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] target/arm: Fix timer deadlines when the offset puts the count ahead
@ 2026-09-21  7:44 Fuad Tabba
  2026-09-21  7:44 ` [PATCH 1/2] target/arm: Fix next timer tick " Fuad Tabba
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Fuad Tabba @ 2026-09-21  7:44 UTC (permalink / raw)
  To: Peter Maydell
  Cc: qemu-arm, qemu-devel, qemu-stable, Alex Bennée,
	Richard Henderson, Will Deacon, Fuad Tabba

Hi folks,

Two fixes for the same bug in three places: the next-tick calculation
for the generic timers, WFIT and WFET each treat a 64-bit overflow of
cval + offset (or timeout + offset) as a deadline beyond the counter's
wrap. Once CNTVOFF_EL2 (or CNTPOFF_EL2 for the physical timer) puts
the timer's view of the counter ahead of the physical count, that sum
overflows for every deadline still in the future and QEMU arms the
timer at INT64_MAX. The first site regressed in 8.2 (8d37a1425b99).
The WFxT sites have the same overflow test.

The KVM arch_timer_edge_cases selftest, which sets the guest counter
to 2^59 - 1, hangs in every host mode on QEMU 11.0.0 and passes on
hardware under an nVHE host. With patch 1 it completes under nVHE and
pKVM hosts. Under a VHE host its physical-timer half still stops, on a
KVM bug in the same arithmetic (KVM programs cval + offset where the
timer compares unsigned). That fix goes to kvmarm separately.

Each patch adds a tcg system test that fails before it and passes
after.

Based on master (3b5d71cc36).

Cheers,
/fuad

Fuad Tabba (2):
  target/arm: Fix next timer tick when the offset puts the count ahead
  target/arm: Fix WFxT timeouts when the offset puts the count ahead

 target/arm/helper.c                  |   9 +-
 target/arm/tcg/op_helper.c           |   6 +-
 tests/tcg/aarch64/system/meson.build |   7 ++
 tests/tcg/aarch64/system/vtimer.c    |  28 +++++++
 tests/tcg/aarch64/system/wfxt.c      | 118 +++++++++++++++++++++++++++
 5 files changed, 162 insertions(+), 6 deletions(-)
 create mode 100644 tests/tcg/aarch64/system/wfxt.c

-- 
2.39.5



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

end of thread, other threads:[~2026-09-30 11:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-21  7:44 [PATCH 0/2] target/arm: Fix timer deadlines when the offset puts the count ahead Fuad Tabba
2026-09-21  7:44 ` [PATCH 1/2] target/arm: Fix next timer tick " Fuad Tabba
2026-09-21  7:44 ` [PATCH 2/2] target/arm: Fix WFxT timeouts " Fuad Tabba
2026-09-30  8:56   ` Michael Tokarev
2026-09-30 11:41     ` Peter Maydell
2026-09-28 16:20 ` [PATCH 0/2] target/arm: Fix timer deadlines " Peter Maydell

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.