mbox series

[v6,0/2] Add arch_timer_edge_cases selftest

Message ID 20240823175836.2798235-1-coltonlewis@google.com (mailing list archive)
Headers show
Series Add arch_timer_edge_cases selftest | expand

Message

Colton Lewis Aug. 23, 2024, 5:58 p.m. UTC
Add arch_timer_edge_cases selftest to test various corner cases of the
ARM timers such as:

* timers above the max TVAL value
* timers in the past
* moving counters ahead and behind pending timers
* reprogramming timers
* timers fired multiple times
* masking/unmasking using the timer control mask

These are intentionally unusual scenarios to stress compliance with
the arm architecture.

v6:
* Remove unused headers
* Declare const variables as static
* Clarify by using INT32_{MIN,MAX}
* Remove silly enum magic value
* Instead of commenting a function should be called with IRQs disabled,
  just disable them in function
* Remove unnecessary loop in test_reprogram_timers()
* Lift some invariant assignments out of loops
* Add some comments around better explaining wm() (irq_wait_method)
  functions
* Fix typos

v5:
https://lore.kernel.org/all/20240809183802.3572177-1-coltonlewis@google.com/

v4:
https://lore.kernel.org/kvmarm/20240307183907.1184775-1-coltonlewis@google.com/

v3:
https://lore.kernel.org/kvmarm/20231103192915.2209393-1-coltonlewis@google.com/

v2:
https://lore.kernel.org/kvmarm/20230928210201.1310536-1-coltonlewis@google.com/

v1:
https://lore.kernel.org/kvm/20230516213731.387132-1-coltonlewis@google.com/

Colton Lewis (2):
  KVM: selftests: Ensure pending interrupts are handled in arch_timer
    test
  KVM: arm64: selftests: Add arch_timer_edge_cases selftest

 tools/testing/selftests/kvm/Makefile          |    1 +
 .../kvm/aarch64/arch_timer_edge_cases.c       | 1062 +++++++++++++++++
 .../testing/selftests/kvm/aarch64/vgic_irq.c  |   11 +-
 .../kvm/include/aarch64/arch_timer.h          |   18 +-
 .../selftests/kvm/include/aarch64/processor.h |    3 +
 .../selftests/kvm/lib/aarch64/processor.c     |    6 +
 6 files changed, 1094 insertions(+), 7 deletions(-)
 create mode 100644 tools/testing/selftests/kvm/aarch64/arch_timer_edge_cases.c

--
2.46.0.295.g3b9ea8a38a-goog

Comments

Marc Zyngier Aug. 30, 2024, 8:07 a.m. UTC | #1
On Fri, 23 Aug 2024 17:58:34 +0000, Colton Lewis wrote:
> Add arch_timer_edge_cases selftest to test various corner cases of the
> ARM timers such as:
> 
> * timers above the max TVAL value
> * timers in the past
> * moving counters ahead and behind pending timers
> * reprogramming timers
> * timers fired multiple times
> * masking/unmasking using the timer control mask
> 
> [...]

Applied to next, thanks!

[1/2] KVM: selftests: Ensure pending interrupts are handled in arch_timer test
      commit: ca1a18368d764f9b29ab0c79b3ddd712f5511855
[2/2] KVM: arm64: selftests: Add arch_timer_edge_cases selftest
      commit: 54306f564441f6bc99514af45552236f28b1768d

Cheers,

	M.