Skip to content

selftests: KVM: Test offset-based counter controls

Oliver Upton kvm kvmarm linux-arm-kernel 2 versions – Applied

Status from this message: Queued patches 1-5, thanks.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v8 Latest9 patches 4 repliesApplied
  2. v79 patches 0 repliesSuperseded

Changes in v8 from the cover letter

- Rebased to 5.15-rc1
- Dropped helper for checking if reg exists in reg list (no longer necessary)
- Test and enable KVM_CAP_ARM_VTIMER_OFFSET
- Add get-reg-list changes

Patches in v8 Applied

#Subject and filesSizeRepliesApplied
1/9tools: arch: x86: pull in pvclock headerstools/arch/x86/include/asm/pvclock-abi.h tools/arch/x86/include/asm/pvclock.h+151 -00 replies
2/9selftests: KVM: Add test for KVM_{GET,SET}_CLOCKtools/testing/selftests/kvm/.gitignore tools/testing/selftests/kvm/Makefile tools/testing/selftests/kvm/include/kvm_util.h +1 more+208 -01 reply
3/9selftests: KVM: Fix kvm device helper ioctl assertionstools/testing/selftests/kvm/lib/kvm_util.c+3 -30 replies
4/9selftests: KVM: Add helpers for vCPU device attributestools/testing/selftests/kvm/include/kvm_util.h tools/testing/selftests/kvm/lib/kvm_util.c+47 -00 replies
5/9selftests: KVM: Introduce system counter offset testtools/testing/selftests/kvm/.gitignore tools/testing/selftests/kvm/Makefile tools/testing/selftests/kvm/system_counter_offset_test.c+134 -00 replies
6/9selftests: KVM: Add support for aarch64 to system_counter_offset_testtools/testing/selftests/kvm/Makefile tools/testing/selftests/kvm/include/aarch64/processor.h tools/testing/selftests/kvm/system_counter_offset_test.c+76 -10 replies
7/9selftests: KVM: Test physical counter offsettingtools/testing/selftests/kvm/include/aarch64/processor.h tools/testing/selftests/kvm/system_counter_offset_test.c+42 -40 replies
8/9selftests: KVM: Add counter emulation benchmarktools/testing/selftests/kvm/.gitignore tools/testing/selftests/kvm/Makefile tools/testing/selftests/kvm/aarch64/counter_emulation_benchmark.c+209 -00 replies
9/9selftests: KVM: Test vtimer offset reg in get-reg-listtools/testing/selftests/kvm/aarch64/get-reg-list.c+42 -01 reply

Reviews trailers per patch

7 of 9 patches have a Reviewed-by or Acked-by.

PatchAndrew JonesRicardo Koller
1/9
2/9
3/9R-b
4/9R-b
5/9R-b
6/9R-b
7/9R-b
8/9R-b R-b
9/9R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v8 thread

Cover letter [PATCH v8 0/9] selftests: KVM: Test offset-based counter controls

This series implements new tests for the x86 and arm64 counter migration changes that I've mailed out. These are sent separately as a dependent change since there are cross-arch dependencies here.

Patch 1 yanks the pvclock headers into the tools/ directory so we can make use of them within a KVM selftest guest.

Patch 2 tests the new capabilities of the KVM_*_CLOCK ioctls, ensuring that the kernel accounts for elapsed time when restoring the KVM clock.

Patches 3-4 add some device attribute helpers and clean up some mistakes in the assertions thereof.

Patch 5 implements a test for the KVM_VCPU_TSC_OFFSET attribute, asserting that manipulation of the offset results in correct TSC values within the guest.

Patch 6 adds basic arm64 support to the counter offset test, checking that the virtual counter-timer offset works correctly. Patch 7 does the same for the physical counter-timer offset.

Patch 8 adds a benchmark for physical counter offsetting, since most implementations available right now will rely on emulation.

Lastly, patch 9 extends the get-reg-list test to check for KVM_REG_ARM_TIMER_OFFSET if userspace opts-in to the kernel capability.

This series applies cleanly to 5.15-rc1

Tests were ran against the respective architecture changes on the following systems:

- Haswell (x86)
- Ampere Mt. Jade (non-ECV, nVHE and VHE)

v7: https://lore.kernel.org/r/[email protected]

v7 -> v8:
- Rebased to 5.15-rc1
- Dropped helper for checking if reg exists in reg list (no longer necessary)
- Test and enable KVM_CAP_ARM_VTIMER_OFFSET
- Add get-reg-list changes

Oliver Upton (9):
tools: arch: x86: pull in pvclock headers
selftests: KVM: Add test for KVM_{GET,SET}_CLOCK
selftests: KVM: Fix kvm device helper ioctl assertions
selftests: KVM: Add helpers for vCPU device attributes
selftests: KVM: Introduce system counter offset test
selftests: KVM: Add support for aarch64 to system_counter_offset_test
selftests: KVM: Test physical counter offsetting
selftests: KVM: Add counter emulation benchmark
selftests: KVM: Test vtimer offset reg in get-reg-list

 tools/arch/x86/include/asm/pvclock-abi.h      |  48 ++++
 tools/arch/x86/include/asm/pvclock.h          | 103 ++++++++
 tools/testing/selftests/kvm/.gitignore        |   3 +
 tools/testing/selftests/kvm/Makefile          |   4 +
 .../kvm/aarch64/counter_emulation_benchmark.c | 207 ++++++++++++++++
 .../selftests/kvm/aarch64/get-reg-list.c      |  42 ++++
 .../selftests/kvm/include/aarch64/processor.h |  24 ++
 .../testing/selftests/kvm/include/kvm_util.h  |  11 +
 tools/testing/selftests/kvm/lib/kvm_util.c    |  44 +++-
 .../kvm/system_counter_offset_test.c          | 220 ++++++++++++++++++
 .../selftests/kvm/x86_64/kvm_clock_test.c     | 204 ++++++++++++++++
 11 files changed, 907 insertions(+), 3 deletions(-)
 create mode 100644 tools/arch/x86/include/asm/pvclock-abi.h
 create mode 100644 tools/arch/x86/include/asm/pvclock.h
 create mode 100644 tools/testing/selftests/kvm/aarch64/counter_emulation_benchmark.c
 create mode 100644 tools/testing/selftests/kvm/system_counter_offset_test.c
 create mode 100644 tools/testing/selftests/kvm/x86_64/kvm_clock_test.c
Signature · 6 lines
2.33.0.464.g1972c5931b-goog

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