Skip to content

Provide VM capability to disable PMU virtualization for individual VMs

David Dunn kvm 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 1 replyIn review
  2. v13 patches 3 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3Provide VM capability to disable PMU virtualization for individual VMsarch/x86/include/asm/kvm_host.h arch/x86/kvm/svm/pmu.c arch/x86/kvm/vmx/pmu_intel.c +3 more+23 -21 reply
2/3selftests: introduce function to create test VM without vcpus.tools/testing/selftests/kvm/include/kvm_util_base.h tools/testing/selftests/kvm/lib/kvm_util.c+38 -130 replies
3/3selftests: Verify disabling PMU via KVM_CAP_CONFIG_PMUtools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c+35 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/3] Provide VM capability to disable PMU virtualization for individual VMs

This patchset adds a new per VM capability for configuring the x86 PMU. Right now the only configuration is to disable the PMU for an entire VM.

Thanks to Sean and Like for great feedback on v1.

I've incorporated most of the comments. Unfortunately I wasn't able to get the AMD version to work by using pmu->version == 0 as a flag. And it makes the Intel pmu->refresh() logic complicated. So this version stays with the kvm->arch.enable_pmu boolean on each VM.

David Dunn (3):
Provide VM capability to disable PMU virtualization for individual VMs
selftests: introduce function to create test VM without vcpus.
selftests: Verify disabling PMU via KVM_CAP_CONFIG_PMU

 arch/x86/include/asm/kvm_host.h               |  1 +
 arch/x86/kvm/svm/pmu.c                        |  2 +-
 arch/x86/kvm/vmx/pmu_intel.c                  |  2 +-
 arch/x86/kvm/x86.c                            | 12 +++++
 include/uapi/linux/kvm.h                      |  4 ++
 tools/include/uapi/linux/kvm.h                |  4 ++
 .../selftests/kvm/include/kvm_util_base.h     |  3 ++
 tools/testing/selftests/kvm/lib/kvm_util.c    | 48 ++++++++++++++-----
 .../kvm/x86_64/pmu_event_filter_test.c        | 35 ++++++++++++++
 9 files changed, 96 insertions(+), 15 deletions(-)
Signature · 1 line
2.35.0.rc0.227.g00780c9af4-goog