aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWanpeng Li2019-08-29 16:49:57 +0800
committerRafael J. Wysocki2019-09-11 17:46:15 +0200
commit1328edca4a142ee3c7442d1eece2c3ca383eff35 (patch)
tree75a50d1d56f31a075fe7d1372a247f654a57a46d
parent472f263660832b90e53bede2020f68cd14f8b76c (diff)
cpuidle-haltpoll: Enable kvm guest polling when dedicated physical CPUs are available
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>
-rw-r--r--arch/x86/kernel/kvm.c1
-rw-r--r--drivers/cpuidle/cpuidle-haltpoll.c3
2 files changed, 3 insertions, 1 deletions
diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
index 60bab4a3b36b..3726ba48f763 100644
--- a/arch/x86/kernel/kvm.c
+++ b/arch/x86/kernel/kvm.c
@@ -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)
{
diff --git a/drivers/cpuidle/cpuidle-haltpoll.c b/drivers/cpuidle/cpuidle-haltpoll.c
index 49a65c6fe91e..932390b028f1 100644
--- a/drivers/cpuidle/cpuidle-haltpoll.c
+++ b/drivers/cpuidle/cpuidle-haltpoll.c
@@ -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);