cpuidle-haltpoll: Enable kvm guest polling when dedicated physical CPUs are available
authorWanpeng Li <wanpengli@tencent.com>
Thu, 29 Aug 2019 08:49:57 +0000 (16:49 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 11 Sep 2019 15:46:15 +0000 (17:46 +0200)
The downside of guest side polling is that polling is performed even
with other runnable tasks in the host. However, even if poll in kvm
can aware whether or not other runnable tasks in the same pCPU, it
can still incur extra overhead in over-subscribe scenario. Now we can
just enable guest polling when dedicated pCPUs are available.

Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
arch/x86/kernel/kvm.c
drivers/cpuidle/cpuidle-haltpoll.c

index 60bab4a3b36b1c0fa0947da1d29088bab896b5b0..3726ba48f763bd739548cddc4e1fc48fa40b3d8b 100644 (file)
@@ -711,6 +711,7 @@ unsigned int kvm_arch_para_hints(void)
 {
        return cpuid_edx(kvm_cpuid_base() | KVM_CPUID_FEATURES);
 }
+EXPORT_SYMBOL_GPL(kvm_arch_para_hints);
 
 static uint32_t __init kvm_detect(void)
 {
index 49a65c6fe91e3b0dfe5d1b910e9ff66e09fec4da..932390b028f1df148d8f96bd6a5b1b6b36fcec72 100644 (file)
@@ -97,7 +97,8 @@ static int __init haltpoll_init(void)
 
        cpuidle_poll_state_init(drv);
 
-       if (!kvm_para_available())
+       if (!kvm_para_available() ||
+               !kvm_para_has_hint(KVM_HINTS_REALTIME))
                return -ENODEV;
 
        ret = cpuidle_register_driver(drv);