Skip to content

KVM: selftests: Binary stats fixes and infra updates

Sean Christopherson kvm kvm-riscv kvmarm linux-arm-kernel linux-riscv lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest9 patches 2 repliesIn review
  2. v18 patches 2 repliesSuperseded

Changes in v2 from the cover letter

- Update rlimit number of files for all "standard" VMs.
- Account for the vCPU stats fd when updating rlimits.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9KVM: selftests: Fix mostly theoretical leak of VM's binary stats FDtools/testing/selftests/kvm/lib/kvm_util.c+2 -20 replies
2/9KVM: selftests: Close VM's binary stats FD when releasing VMtools/testing/selftests/kvm/lib/kvm_util.c+9 -60 replies
3/9KVM: selftests: Assert that __vm_get_stat() actually finds a stattools/testing/selftests/kvm/lib/kvm_util.c+3 -20 replies
4/9KVM: selftests: Macrofy vm_get_stat() to auto-generate stat name stringtools/testing/selftests/kvm/include/kvm_util.h tools/testing/selftests/kvm/x86/dirty_log_page_splitting_test.c tools/testing/selftests/kvm/x86/nx_huge_pages_test.c+12 -120 replies
5/9KVM: selftests: Add struct and helpers to wrap binary stats cachetools/testing/selftests/kvm/include/kvm_util.h tools/testing/selftests/kvm/lib/kvm_util.c+34 -240 replies
6/9KVM: selftests: Get VM's binary stats FD when opening VMtools/testing/selftests/kvm/lib/kvm_util.c+11 -40 replies
7/9KVM: selftests: Adjust number of files rlimit for all "standard" VMstools/testing/selftests/kvm/include/kvm_util.h tools/testing/selftests/kvm/kvm_create_max_vcpus.c tools/testing/selftests/kvm/lib/kvm_util.c+37 -270 replies
8/9KVM: selftests: Add infrastructure for getting vCPU binary statstools/testing/selftests/kvm/include/kvm_util.h tools/testing/selftests/kvm/lib/kvm_util.c tools/testing/selftests/kvm/x86/xapic_ipi_test.c+27 -271 reply
9/9KVM: selftests: Add compile-time assertions to guard against stats typostools/testing/selftests/kvm/include/arm64/kvm_util_arch.h tools/testing/selftests/kvm/include/kvm_util.h tools/testing/selftests/kvm/include/kvm_util_types.h +3 more+218 -30 replies

Reviews trailers per patch

None of the 9 patches has a Reviewed-by or Acked-by.

PatchManali Shukla
1/9
2/9
3/9
4/9
5/9
6/9
7/9
8/9T-b
9/9

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

Read the v2 thread

Cover letter [PATCH v2 0/9] KVM: selftests: Binary stats fixes and infra updates

Fix a handful of bugs in the binary stats infrastructure, expand support to vCPU-scoped stats, enumerate all KVM stats in selftests, and use the enumerated stats to assert at compile-time that {vm,vcpu}_get_stat() is getting a stat that actually exists.

Most of the bugs are benign, and AFAICT, none actually cause problems in the current code base. The worst of the bugs is lack of validation that the requested stat actually exists, which is quite annoying if someone fat fingers a stat name, tries to get a vCPU stat on a VM FD, etc.

As called out multiple times in v1, I'm on the fence regarding the last patch (compile-time assertions). My plan is to apply everything except the last patch fairly quickly, so that the vCPU stats stuff in particular can be used in x86 tests, and hold off on the compile-time assertion goo until someone comes along with a strong opinion one way or the other.

v2:
- Update rlimit number of files for all "standard" VMs.
- Account for the vCPU stats fd when updating rlimits.

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

Sean Christopherson (9):
KVM: selftests: Fix mostly theoretical leak of VM's binary stats FD
KVM: selftests: Close VM's binary stats FD when releasing VM
KVM: selftests: Assert that __vm_get_stat() actually finds a stat
KVM: selftests: Macrofy vm_get_stat() to auto-generate stat name
string
KVM: selftests: Add struct and helpers to wrap binary stats cache
KVM: selftests: Get VM's binary stats FD when opening VM
KVM: selftests: Adjust number of files rlimit for all "standard" VMs
KVM: selftests: Add infrastructure for getting vCPU binary stats
KVM: selftests: Add compile-time assertions to guard against stats
typos

 .../kvm/include/arm64/kvm_util_arch.h         |  12 ++
 .../testing/selftests/kvm/include/kvm_util.h  |  51 ++++++--
 .../selftests/kvm/include/kvm_util_types.h    |   6 +
 .../kvm/include/riscv/kvm_util_arch.h         |  14 +++
 .../kvm/include/s390/kvm_util_arch.h          | 113 +++++++++++++++++
 .../selftests/kvm/include/x86/kvm_util_arch.h |  52 ++++++++
 .../selftests/kvm/kvm_create_max_vcpus.c      |  28 +----
 tools/testing/selftests/kvm/lib/kvm_util.c    | 114 ++++++++++++------
 .../kvm/x86/dirty_log_page_splitting_test.c   |   6 +-
 .../selftests/kvm/x86/nx_huge_pages_test.c    |   4 +-
 .../selftests/kvm/x86/xapic_ipi_test.c        |   2 +
 11 files changed, 324 insertions(+), 78 deletions(-)

base-commit: 10b2c8a67c4b8ec15f9d07d177f63b563418e948

Signature · 1 line
2.47.1.613.gc27f4b7a9f-goog