]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: X86: Fix initialization of MSR lists
authorChenyi Qiang <chenyi.qiang@intel.com>
Wed, 6 Nov 2019 06:35:20 +0000 (14:35 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 12 Nov 2019 09:17:25 +0000 (10:17 +0100)
commita762a7ef93f3895387ac5b8c7e7eb094f3929e83
tree148baa85fb034c6fa3ef946f774abd70e152e2ee
parent63e503b8db3475044b34710dad6b1fe624af1a07
KVM: X86: Fix initialization of MSR lists

The three MSR lists(msrs_to_save[], emulated_msrs[] and
msr_based_features[]) are global arrays of kvm.ko, which are
adjusted (copy supported MSRs forward to override the unsupported MSRs)
when insmod kvm-{intel,amd}.ko, but it doesn't reset these three arrays
to their initial value when rmmod kvm-{intel,amd}.ko. Thus, at the next
installation, kvm-{intel,amd}.ko will do operations on the modified
arrays with some MSRs lost and some MSRs duplicated.

So define three constant arrays to hold the initial MSR lists and
initialize msrs_to_save[], emulated_msrs[] and msr_based_features[]
based on the constant arrays.

Cc: stable@vger.kernel.org
Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>
Signed-off-by: Chenyi Qiang <chenyi.qiang@intel.com>
[Remove now useless conditionals. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/x86.c