From: Shiyuan Gao <gaoshiyuan@xxxxxxxxx> When live-migrate VM on icelake microarchitecture, if the source host kernel before commit 2e8cd7a3b828 ("kvm: x86: limit the maximum number of vPMU fixed counters to 3") and the dest host kernel after this commit, the migration will fail. The source VM's CPUID.0xA.edx[0..4]=4 that is reported by KVM and the IA32_PERF_GLOBAL_CTRL MSR is 0xf000000ff. However the dest VM's CPUID.0xA.edx[0..4]=3 and the IA32_PERF_GLOBAL_CTRL MSR is 0x7000000ff. This inconsistency leads to migration failure. The QEMU limits the maximum number of vPMU fixed counters to 3, so ignore the check of IA32_PERF_GLOBAL_CTRL bit35. Fixes: 2e8cd7a3b828 ("kvm: x86: limit the maximum number of vPMU fixed counters to 3") Signed-off-by: Shiyuan Gao <gaoshiyuan@xxxxxxxxx> --- arch/x86/kvm/pmu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/pmu.h b/arch/x86/kvm/pmu.h index 5c7bbf03b599..9895311d334e 100644 --- a/arch/x86/kvm/pmu.h +++ b/arch/x86/kvm/pmu.h @@ -91,7 +91,7 @@ static inline bool pmc_is_fixed(struct kvm_pmc *pmc) static inline bool kvm_valid_perf_global_ctrl(struct kvm_pmu *pmu, u64 data) { - return !(pmu->global_ctrl_mask & data); + return !(pmu->global_ctrl_mask & (data & ~(1ULL << 35))); } /* returns general purpose PMC with the specified MSR. Note that it can be -- 2.36.1