Skip to content

Commit 40cd58d

Browse files
Wanpeng Libonzini
authored andcommitted
x86/kvm: Don't use PV TLB/yield when mwait is advertised
MWAIT is advertised in host is not overcommitted scenario, however, PV TLB/sched yield should be enabled in host overcommitted scenario. Let's add the MWAIT checking when enabling PV TLB/sched yield. Signed-off-by: Wanpeng Li <wanpengli@tencent.com> Message-Id: <1645777780-2581-1-git-send-email-wanpengli@tencent.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent ece32a7 commit 40cd58d

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

arch/x86/kernel/kvm.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ static bool pv_tlb_flush_supported(void)
463463
return (kvm_para_has_feature(KVM_FEATURE_PV_TLB_FLUSH) &&
464464
!kvm_para_has_hint(KVM_HINTS_REALTIME) &&
465465
kvm_para_has_feature(KVM_FEATURE_STEAL_TIME) &&
466+
!boot_cpu_has(X86_FEATURE_MWAIT) &&
466467
(num_possible_cpus() != 1));
467468
}
468469

@@ -477,6 +478,7 @@ static bool pv_sched_yield_supported(void)
477478
return (kvm_para_has_feature(KVM_FEATURE_PV_SCHED_YIELD) &&
478479
!kvm_para_has_hint(KVM_HINTS_REALTIME) &&
479480
kvm_para_has_feature(KVM_FEATURE_STEAL_TIME) &&
481+
!boot_cpu_has(X86_FEATURE_MWAIT) &&
480482
(num_possible_cpus() != 1));
481483
}
482484

0 commit comments

Comments
 (0)