cpuidle-haltpoll: disable host side polling when kvm virtualized
When performing guest side polling, it is not necessary to also perform host side polling. So disable host side polling, via the new MSR interface, when loading cpuidle-haltpoll driver. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:

committed by
Rafael J. Wysocki

parent
2cffe9f6b9
commit
a1c4423b02
@@ -875,3 +875,45 @@ void __init kvm_spinlock_init(void)
|
||||
}
|
||||
|
||||
#endif /* CONFIG_PARAVIRT_SPINLOCKS */
|
||||
|
||||
#ifdef CONFIG_ARCH_CPUIDLE_HALTPOLL
|
||||
|
||||
static void kvm_disable_host_haltpoll(void *i)
|
||||
{
|
||||
wrmsrl(MSR_KVM_POLL_CONTROL, 0);
|
||||
}
|
||||
|
||||
static void kvm_enable_host_haltpoll(void *i)
|
||||
{
|
||||
wrmsrl(MSR_KVM_POLL_CONTROL, 1);
|
||||
}
|
||||
|
||||
void arch_haltpoll_enable(void)
|
||||
{
|
||||
if (!kvm_para_has_feature(KVM_FEATURE_POLL_CONTROL)) {
|
||||
printk(KERN_ERR "kvm: host does not support poll control\n");
|
||||
printk(KERN_ERR "kvm: host upgrade recommended\n");
|
||||
return;
|
||||
}
|
||||
|
||||
preempt_disable();
|
||||
/* Enable guest halt poll disables host halt poll */
|
||||
kvm_disable_host_haltpoll(NULL);
|
||||
smp_call_function(kvm_disable_host_haltpoll, NULL, 1);
|
||||
preempt_enable();
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(arch_haltpoll_enable);
|
||||
|
||||
void arch_haltpoll_disable(void)
|
||||
{
|
||||
if (!kvm_para_has_feature(KVM_FEATURE_POLL_CONTROL))
|
||||
return;
|
||||
|
||||
preempt_disable();
|
||||
/* Enable guest halt poll disables host halt poll */
|
||||
kvm_enable_host_haltpoll(NULL);
|
||||
smp_call_function(kvm_enable_host_haltpoll, NULL, 1);
|
||||
preempt_enable();
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(arch_haltpoll_disable);
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user