Skip to content

Commit

Permalink
cpuidle-haltpoll: Enable kvm guest polling when dedicated physical CP…
Browse files Browse the repository at this point in the history
…Us 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>
  • Loading branch information
Wanpeng Li authored and Rafael J. Wysocki committed Sep 11, 2019
1 parent 472f263 commit 1328edc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions arch/x86/kernel/kvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
3 changes: 2 additions & 1 deletion drivers/cpuidle/cpuidle-haltpoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1328edc

Please sign in to comment.