summaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/kvm.c
diff options
context:
space:
mode:
authorJoao Martins <joao.m.martins@oracle.com>2019-09-02 11:40:31 +0100
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2019-09-03 09:36:36 +0200
commit97d3eb9da84cae0548359b0aecb8619faad003b7 (patch)
tree69c7f83cbc5a28db819ff39b31ddb4917ef600fb /arch/x86/kernel/kvm.c
parentb7e7fffd3e8c81aa0654ed4c9f7a142b4c4dab1a (diff)
downloadlinux-97d3eb9da84cae0548359b0aecb8619faad003b7.tar.bz2
cpuidle-haltpoll: vcpu hotplug support
When cpus != maxcpus cpuidle-haltpoll will fail to register all vcpus past the online ones and thus fail to register the idle driver. This is because cpuidle_add_sysfs() will return with -ENODEV as a consequence from get_cpu_device() return no device for a non-existing CPU. Instead switch to cpuidle_register_driver() and manually register each of the present cpus through cpuhp_setup_state() callbacks and future ones that get onlined or offlined. This mimmics similar logic that intel_idle does. Fixes: fa86ee90eb11 ("add cpuidle-haltpoll driver") Signed-off-by: Joao Martins <joao.m.martins@oracle.com> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'arch/x86/kernel/kvm.c')
-rw-r--r--arch/x86/kernel/kvm.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
index f48401be8ce0..60bab4a3b36b 100644
--- a/arch/x86/kernel/kvm.c
+++ b/arch/x86/kernel/kvm.c
@@ -888,32 +888,26 @@ static void kvm_enable_host_haltpoll(void *i)
wrmsrl(MSR_KVM_POLL_CONTROL, 1);
}
-void arch_haltpoll_enable(void)
+void arch_haltpoll_enable(unsigned int cpu)
{
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");
+ pr_err_once("kvm: host does not support poll control\n");
+ pr_err_once("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();
+ smp_call_function_single(cpu, kvm_disable_host_haltpoll, NULL, 1);
}
EXPORT_SYMBOL_GPL(arch_haltpoll_enable);
-void arch_haltpoll_disable(void)
+void arch_haltpoll_disable(unsigned int cpu)
{
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();
+ smp_call_function_single(cpu, kvm_enable_host_haltpoll, NULL, 1);
}
EXPORT_SYMBOL_GPL(arch_haltpoll_disable);
#endif