Skip to content

KVM: arm64: selftests: Add edge cases tests for the arch timer

Ricardo Koller kvm kvmarm 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest4 patches 2 repliesIn review
  2. v34 patches 2 repliesSuperseded
  3. v23 patches 6 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v13 patches5 repliesSuperseded

Changes in v4 from the cover letter

- Fix is_cpu_online to also check whether the cpu is allowed to run the current process (on top of being online). Renamed is_cpu_online() to is_cpu_eligible_to_run(). [Sean]

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4KVM: arm64: selftests: add timer_get_tval() lib functiontools/testing/selftests/kvm/include/aarch64/arch_timer.h+17 -10 replies
2/4KVM: selftests: add is_cpu_eligible_to_run() utility functiontools/testing/selftests/kvm/include/test_util.h tools/testing/selftests/kvm/lib/test_util.c+21 -12 replies
3/4KVM: arm64: selftests: add arch_timer_edge_casestools/testing/selftests/kvm/.gitignore tools/testing/selftests/kvm/Makefile tools/testing/selftests/kvm/aarch64/arch_timer_edge_cases.c+610 -00 replies
4/4KVM: arm64: selftests: add edge cases tests into arch_timer_edge_casestools/testing/selftests/kvm/aarch64/arch_timer_edge_cases.c+298 -20 replies

Reviews trailers per patch

3 of 4 patches have a Reviewed-by or Acked-by.

PatchOliver UptonReiji WatanabeRaghavendra Rao Ananta
1/4R-b R-b
2/4
3/4R-b R-b
4/4R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v4 thread

Cover letter [PATCH v4 0/4] KVM: arm64: selftests: Add edge cases tests for the arch timer

Add a new selftests that validates some edge cases related to the virtual arch-timer, for example:
- timers across counter roll-overs.
- moving counters ahead and behind pending timers.
- having the same timer condition firing multiple times.

The tests run while checking the state of the IRQs (e.g., pending when they are supposed to be) and stressing things a bit by waiting for interrupts
while: re-scheduling the vcpu (with sched_yield()), by migrating the vcpu between cores, or by sleeping in userspace (with usleep()).

The first commit adds a timer utility function. The second commit adds some sanity checks and basic tests for the timer. The third commit adds the actual edge case tests (like forcing rollovers).

v3 ->v4:
- Fix is_cpu_online to also check whether the cpu is allowed to run the current process (on top of being online). Renamed is_cpu_online() to is_cpu_eligible_to_run(). [Sean]

v2 -> v3: https://lore.kernel.org/kvmarm/[email protected]/
- Add missing isb when polling for IRQ being handled. [Oliver, Marc]
- Wait for a counter pass by polling on it (instead of the previous isb). [Oliver, Marc]
- Edits in some comments. [Oliver]
- Dropping the msecs_to_usecs macro. [Oliver]
- Skipping test if desired pcpus are not online. This needed adding a library function (is_cpu_online). [Oliver]

v1 -> v2: https://lore.kernel.org/kvmarm/[email protected]/
- Remove the checks for timers firing within some margin; only leave the checks for timers not firing ahead of time. Also remove the tests that depend on timers firing within some margin. [Oliver, Marc]
- Collect R-b tag from Oliver (first commit). [Oliver]
- Multiple nits: replace wfi_ functions with wait_, reduce use of macros, drop typedefs, use IAR_SPURIOUS from header, move some comments functions to top. [Oliver]
- Don't fail if the test has a single cpu available. [Oliver]
- Don't fail if there's no GICv3 available. [Oliver]

v1: https://lore.kernel.org/kvmarm/[email protected]/

Ricardo Koller (4):
KVM: arm64: selftests: add timer_get_tval() lib function
KVM: selftests: add is_cpu_eligible_to_run() utility function
KVM: arm64: selftests: add arch_timer_edge_cases
KVM: arm64: selftests: add edge cases tests into arch_timer_edge_cases

 tools/testing/selftests/kvm/.gitignore        |   1 +
 tools/testing/selftests/kvm/Makefile          |   1 +
 .../kvm/aarch64/arch_timer_edge_cases.c       | 904 ++++++++++++++++++
 .../kvm/include/aarch64/arch_timer.h          |  18 +-
 .../testing/selftests/kvm/include/test_util.h |   2 +
 tools/testing/selftests/kvm/lib/test_util.c   |  20 +-
 6 files changed, 944 insertions(+), 2 deletions(-)
 create mode 100644 tools/testing/selftests/kvm/aarch64/arch_timer_edge_cases.c
Signature · 6 lines
2.35.1.1094.g7c7d902a7c-goog

_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm