Re: [PATCH] x86/kvm: Don't use PVspinlock when mwait is advertised

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

 



On Sat, Feb 11, 2023, lirongqing@xxxxxxxxx wrote:
> From: Li RongQing <lirongqing@xxxxxxxxx>
> 
> MWAIT is advertised in host is not overcommitted scenario, however,
> pvspinlock should be enabled in host overcommitted scenario. Let's
> add the MWAIT checking when enabling pvspinlock
> 
> Signed-off-by: Li RongQing <lirongqing@xxxxxxxxx>
> ---
>  arch/x86/kernel/kvm.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
> index 1cceac5..dfa1451 100644
> --- a/arch/x86/kernel/kvm.c
> +++ b/arch/x86/kernel/kvm.c
> @@ -1087,6 +1087,11 @@ void __init kvm_spinlock_init(void)
>  		goto out;
>  	}
>  
> +	if (boot_cpu_has(X86_FEATURE_MWAIT)) {

IMO this is a bad idea.  Odds are good that there are less-than-perfect VM configs
that advertise MONITOR+MWAIT but don't disable interception.  Ugh, but we've already
added this logic for other features guaraded by KVM_HINTS_REALTIME in commit
40cd58dbf121 ("x86/kvm: Don't use PV TLB/yield when mwait is advertised")

Why doesn't the host simply advertise KVM_HINTS_REALTIME?



[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