On 17/05/19 10:49, Wanpeng Li wrote: > MSR IA32_MSIC_ENABLE bit 18, according to SDM: > > | When this bit is set to 0, the MONITOR feature flag is not set (CPUID.01H:ECX[bit 3] = 0). > | This indicates that MONITOR/MWAIT are not supported. > | > | Software attempts to execute MONITOR/MWAIT will cause #UD when this bit is 0. > | > | When this bit is set to 1 (default), MONITOR/MWAIT are supported (CPUID.01H:ECX[bit 3] = 1). > > The CPUID.01H:ECX[bit 3] ought to mirror the value of the MSR bit, > CPUID.01H:ECX[bit 3] is a better guard than kvm_mwait_in_guest(). > kvm_mwait_in_guest() affects the behavior of MONITOR/MWAIT, not its > guest visibility. > > This patch implements toggling of the CPUID bit based on guest writes > to the MSR. Won't this disable mwait after migration, unless IA32_MISC_ENABLE is set correctly by firmware or userspace? I think you need to hide this behind KVM_CAP_DISABLE_QUIRKS. (Also, what is the reason for this change in general besides making behavior closer to real hardware?) Thanks, Paolo