All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/kvm: Don't use PVspinlock when mwait is advertised
@ 2023-02-11 14:06 lirongqing
  2023-02-13 16:13 ` Sean Christopherson
  0 siblings, 1 reply; 2+ messages in thread
From: lirongqing @ 2023-02-11 14:06 UTC (permalink / raw)
  To: pbonzini, wanpengli, vkuznets, tglx, mingo, x86, kvm

From: Li RongQing <lirongqing@baidu.com>

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@baidu.com>
---
 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)) {
+		pr_info("PV spinlocks disabled with mwait\n");
+		goto out;
+	}
+
 	if (num_possible_cpus() == 1) {
 		pr_info("PV spinlocks disabled, single CPU\n");
 		goto out;
-- 
2.9.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-02-13 16:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-11 14:06 [PATCH] x86/kvm: Don't use PVspinlock when mwait is advertised lirongqing
2023-02-13 16:13 ` Sean Christopherson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.