Re: [PATCH] kvm: x86: MONITOR/MWAIT are now supported

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2018-05-24 10:29-0700, Jim Mattson:
> KVM_GET_SUPPORTED_CPUID should return the x86 cpuid features which are
> supported by both the hardware and kvm. Since commit 4d5422cea3b6
> ("KVM: X86: Provide a capability to disable MWAIT intercepts"), it is
> possible to configure a VM so that MONITOR/MWAIT are fully supported
> in the guest.  Userspace still has the option to mask these features
> off (e.g. for VMs that don't disable MONITOR/MWAIT exits.)
> 
> Fixes: 4d5422cea3b6 ("KVM: X86: Provide a capability to disable MWAIT intercepts")
> Signed-off-by: Jim Mattson <jmattson@xxxxxxxxxx>
> ---

QEMU has a peculiar '-cpu host' mode that enables everything that is
reported as supported and this change would regress old userspaces by
tricking the guest OS into using a VM exit busy-loop instead of HLT.

I think it would be better to say that the userspace should enable
MONITOR in CPUID when using KVM_X86_DISABLE_EXITS_MWAIT.

>  arch/x86/kvm/cpuid.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
> index 82055b90a8b3..794e8c6adc11 100644
> --- a/arch/x86/kvm/cpuid.c
> +++ b/arch/x86/kvm/cpuid.c
> @@ -359,9 +359,7 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
>  		0 /* Reserved */ | f_lm | F(3DNOWEXT) | F(3DNOW);
>  	/* cpuid 1.ecx */
>  	const u32 kvm_cpuid_1_ecx_x86_features =
> -		/* NOTE: MONITOR (and MWAIT) are emulated as NOP,
> -		 * but *not* advertised to guests via CPUID ! */
> -		F(XMM3) | F(PCLMULQDQ) | 0 /* DTES64, MONITOR */ |
> +		F(XMM3) | F(PCLMULQDQ) | 0 /* DTES64 */ | F(MONITOR) |
>  		0 /* DS-CPL, VMX, SMX, EST */ |
>  		0 /* TM2 */ | F(SSSE3) | 0 /* CNXT-ID */ | 0 /* Reserved */ |
>  		F(FMA) | F(CX16) | 0 /* xTPR Update, PDCM */ |
> -- 
> 2.17.0.441.gb46fe60e1d-goog
> 



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux