summaryrefslogtreecommitdiffstats
path: root/drivers/cpuidle/cpuidle-haltpoll.c
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2019-07-04 01:51:29 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2019-07-30 17:27:37 +0200
commita1c4423b02b2121108e3ea9580741e0f26309a48 (patch)
treec2b6c2842065c7ed359f997580078ca00ad02fe3 /drivers/cpuidle/cpuidle-haltpoll.c
parentcpuidle: add haltpoll governor (diff)
downloadlinux-a1c4423b02b2121108e3ea9580741e0f26309a48.tar.xz
linux-a1c4423b02b2121108e3ea9580741e0f26309a48.zip
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>
Diffstat (limited to 'drivers/cpuidle/cpuidle-haltpoll.c')
-rw-r--r--drivers/cpuidle/cpuidle-haltpoll.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/cpuidle/cpuidle-haltpoll.c b/drivers/cpuidle/cpuidle-haltpoll.c
index 35cfb53e9287..9ac093dcbb01 100644
--- a/drivers/cpuidle/cpuidle-haltpoll.c
+++ b/drivers/cpuidle/cpuidle-haltpoll.c
@@ -15,6 +15,7 @@
#include <linux/module.h>
#include <linux/sched/idle.h>
#include <linux/kvm_para.h>
+#include <linux/cpuidle_haltpoll.h>
static int default_enter_idle(struct cpuidle_device *dev,
struct cpuidle_driver *drv, int index)
@@ -47,6 +48,7 @@ static struct cpuidle_driver haltpoll_driver = {
static int __init haltpoll_init(void)
{
+ int ret;
struct cpuidle_driver *drv = &haltpoll_driver;
cpuidle_poll_state_init(drv);
@@ -54,11 +56,16 @@ static int __init haltpoll_init(void)
if (!kvm_para_available())
return 0;
- return cpuidle_register(&haltpoll_driver, NULL);
+ ret = cpuidle_register(&haltpoll_driver, NULL);
+ if (ret == 0)
+ arch_haltpoll_enable();
+
+ return ret;
}
static void __exit haltpoll_exit(void)
{
+ arch_haltpoll_disable();
cpuidle_unregister(&haltpoll_driver);
}