History

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

Allow a guest to read the physical IA32_APERF and IA32_MPERF MSRs without interception. The IA32_APERF and IA32_MPERF MSRs are not virtualized. Writes are not handled at all. The MSR values are not zeroed on vCPU creation, saved on suspend, or restored on resume. No accommodation is made for processor migration or for sharing a logical processor with other tasks. No adjustments are made for non-unit TSC multipliers. The MSRs do not account for time the same way as the comparable PMU events, whether the PMU is virtualized by the traditional emulation method or the new mediated pass-through approach. Nonetheless, in a properly constrained environment, this capability can be combined with a guest CPUID table that advertises support for CPUID.6:ECX.APERFMPERF[bit 0] to induce a Linux guest to report the effective physical CPU frequency in /proc/cpuinfo. Moreover, there is no performance cost for this capability.

Jim Mattson committed 1 year ago

Commit a7cec201 parent 6fbef869 files · +53 −2Browse files

Showing the changes to include/uapi (1 of 9 files). Show all

Unified · Split

include/uapi/linux/kvm.h+1−0
@@ -644,6 +644,7 @@ struct kvm_ioeventfd { · 643 unmodified lines
644644 #define KVM_X86_DISABLE_EXITS_HLT (1 << 1)
645645 #define KVM_X86_DISABLE_EXITS_PAUSE (1 << 2)
646646 #define KVM_X86_DISABLE_EXITS_CSTATE (1 << 3)
647+#define KVM_X86_DISABLE_EXITS_APERFMPERF (1 << 4)
647648
648649 /* for KVM_ENABLE_CAP */
649650 struct kvm_enable_cap {