]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: omit absent pmu MSRs from MSR list
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 1 Oct 2019 13:18:26 +0000 (15:18 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 3 Oct 2019 10:07:59 +0000 (12:07 +0200)
commit22025448deeab10922116e797ae061d4ab771625
tree2c5caab599aefbcd498265f273429974bd46f954
parent4f32bfc74919d23fe4b4826bbda68c0bbced7872
KVM: x86: omit absent pmu MSRs from MSR list

INTEL_PMC_MAX_GENERIC is currently 32, which exceeds the 18 contiguous
MSR indices reserved by Intel for event selectors.  Since some machines
actually have MSRs past the reserved range, these may survive the
filtering of msrs_to_save array and would be rejected by KVM_GET/SET_MSR.
To avoid this, cut the list to whatever CPUID reports for the host's
architectural PMU.

Reported-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Suggested-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: Jim Mattson <jmattson@google.com>
Fixes: 40fc5149497e ("kvm: x86: Add Intel PMU MSRs to msrs_to_save[]", 2019-08-21)
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/x86.c