On Mon, Nov 18, 2019 at 04:22:18PM +0100, gregkh@xxxxxxxxxxxxxxxxxxx wrote:
The patch below does not apply to the 5.3-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <stable@xxxxxxxxxxxxxxx>. thanks, greg k-h ------------------ original commit in Linus's tree ------------------ From 7a5ee6edb42e0bb487954806d34877995b6b8d59 Mon Sep 17 00:00:00 2001 From: Chenyi Qiang <chenyi.qiang@xxxxxxxxx> Date: Wed, 6 Nov 2019 14:35:20 +0800 Subject: [PATCH] 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@xxxxxxxxxxxxxxx Reviewed-by: Xiaoyao Li <xiaoyao.li@xxxxxxxxx> Signed-off-by: Chenyi Qiang <chenyi.qiang@xxxxxxxxx> [Remove now useless conditionals. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
Would it make sense taking the commits below to make this patch apply on 5.3? 7a5ee6edb42e ("KVM: X86: Fix initialization of MSR lists") e2ada66ec418 ("kvm: x86: Add Intel PMU MSRs to msrs_to_save[]") 24c29b7ac0da ("KVM: x86: omit absent pmu MSRs from MSR list") cf05a67b68b8 ("KVM: x86: omit "impossible" pmu MSRs from MSR list") -- Thanks, Sasha