Skip to content

KVM: x86: Provide a capability to disable APERF/MPERF read intercepts

Jim Mattson kvm lkml 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest3 patches 10 repliesIn review
  2. v32 patches 7 repliesSuperseded
  3. v21 patch 0 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v11 patch5 repliesSuperseded

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3KVM: x86: Replace growing set of *_in_guest bools with a u64arch/x86/include/asm/kvm_host.h arch/x86/kvm/svm/svm.c arch/x86/kvm/vmx/vmx.c +2 more+16 -142 replies
2/3KVM: x86: Provide a capability to disable APERF/MPERF read interceptsDocumentation/virt/kvm/api.rst arch/x86/kvm/svm/svm.c arch/x86/kvm/svm/svm.h +6 more+52 -34 replies
3/3KVM: selftests: Test behavior of KVM_X86_DISABLE_EXITS_APERFMPERFtools/testing/selftests/kvm/Makefile.kvm tools/testing/selftests/kvm/include/kvm_util.h tools/testing/selftests/kvm/lib/kvm_util.c +1 more+152 -04 replies

Reviews trailers per patch

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

Read the v4 thread

Cover letter [PATCH v4 0/3] KVM: x86: Provide a capability to disable APERF/MPERF read intercepts

Allow a guest to read IA32_APERF and IA32_MPERF, so that it can determine the effective frequency multiplier for the physical LPU.

Commit b51700632e0e ("KVM: X86: Provide a capability to disable cstate msr read intercepts") allowed the userspace VMM to grant a guest read access to four core C-state residency MSRs. Do the same for IA32_APERF and IA32_MPERF.

While this isn't sufficient to claim support for CPUID.6:ECX.APERFMPERF[bit 0], it may suffice in a sufficiently restricted environment (i.e. vCPUs pinned to LPUs, no TSC multiplier, and no suspend/resume).

v1 -> v2: Add {IA32_APERF,IA32_MPERF} to vmx_possible_passthrough_msrs[] v2 -> v3: Add a selftest
v3 -> v4: Collect all disabled_exit flags in a u64 [Sean]
Improve documentation [Sean]
Add pin_task_to_one_cpu() to kvm selftests library [Sean]

Jim Mattson (3):
KVM: x86: Replace growing set of *_in_guest bools with a u64
KVM: x86: Provide a capability to disable APERF/MPERF read intercepts
KVM: selftests: Test behavior of KVM_X86_DISABLE_EXITS_APERFMPERF

 Documentation/virt/kvm/api.rst                |  23 +++
 arch/x86/include/asm/kvm_host.h               |   5 +-
 arch/x86/kvm/svm/svm.c                        |   9 +-
 arch/x86/kvm/svm/svm.h                        |   2 +-
 arch/x86/kvm/vmx/vmx.c                        |   8 +-
 arch/x86/kvm/vmx/vmx.h                        |   2 +-
 arch/x86/kvm/x86.c                            |  16 ++-
 arch/x86/kvm/x86.h                            |  18 ++-
 include/uapi/linux/kvm.h                      |   1 +
 tools/include/uapi/linux/kvm.h                |   1 +
 tools/testing/selftests/kvm/Makefile.kvm      |   1 +
 .../testing/selftests/kvm/include/kvm_util.h  |   2 +
 tools/testing/selftests/kvm/lib/kvm_util.c    |  17 +++
 .../selftests/kvm/x86/aperfmperf_test.c       | 132 ++++++++++++++++++
 14 files changed, 220 insertions(+), 17 deletions(-)
 create mode 100644 tools/testing/selftests/kvm/x86/aperfmperf_test.c
Signature · 1 line
2.49.0.1204.g71687c7c1d-goog