]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: VMX: Give host userspace full control of MSR_IA32_PERF_CAPABILITIES
authorSean Christopherson <seanjc@google.com>
Sat, 11 Jun 2022 00:57:50 +0000 (00:57 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 20 Jun 2022 15:49:20 +0000 (11:49 -0400)
commit58e03880163b724ebbc65c22f504f20febd48224
treefde7d692cc3a7bb2496262439d417658bb5724c4
parentc3fe0c465b41839abab5bf4078ad2d3bf265e9e4
KVM: VMX: Give host userspace full control of MSR_IA32_PERF_CAPABILITIES

Do not clear manipulate MSR_IA32_PERF_CAPABILITIES in intel_pmu_refresh(),
i.e. give userspace full control over capability/read-only MSRs.  KVM is
not a babysitter, it is userspace's responsiblity to provide a valid and
coherent vCPU model.

Attempting to "help" the guest by forcing a consistent model creates edge
cases, and ironicially leads to inconsistent behavior.

Example #1:  KVM doesn't do intel_pmu_refresh() when userspace writes
the MSR.

Example #2: KVM doesn't clear the bits when the PMU is disabled, or when
there's no architectural PMU.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20220611005755.753273-3-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx/pmu_intel.c