aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2011-04-01 18:13:10 -0400
committerLen Brown <len.brown@intel.com>2011-08-03 19:06:36 -0400
commit62027aea23fcd14478abdddd3b74a4e0f5fb2984 (patch)
tree1aaa5c1872e296f3448ae6c126175ac9d998e3b4
parent6dccf9c508d5d773859df1cc2dce75c5b19e35a0 (diff)
cpuidle: create bootparam "cpuidle.off=1"
useful for disabling cpuidle to fall back to architecture-default idle loop cpuidle drivers and governors will fail to register. on x86 they'll say so: intel_idle: intel_idle yielding to (null) ACPI: acpi_idle yielding to (null) Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r--Documentation/kernel-parameters.txt3
-rw-r--r--drivers/cpuidle/cpuidle.c10
-rw-r--r--drivers/cpuidle/cpuidle.h1
-rw-r--r--drivers/cpuidle/driver.c3
-rw-r--r--drivers/cpuidle/governor.c3
5 files changed, 20 insertions, 0 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index aa47be71df4c..9b8e62d75a0c 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -546,6 +546,9 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
546 /proc/<pid>/coredump_filter. 546 /proc/<pid>/coredump_filter.
547 See also Documentation/filesystems/proc.txt. 547 See also Documentation/filesystems/proc.txt.
548 548
549 cpuidle.off=1 [CPU_IDLE]
550 disable the cpuidle sub-system
551
549 cpcihp_generic= [HW,PCI] Generic port I/O CompactPCI driver 552 cpcihp_generic= [HW,PCI] Generic port I/O CompactPCI driver
550 Format: 553 Format:
551 <first_slot>,<last_slot>,<port>,<enum_bit>[,<debug>] 554 <first_slot>,<last_slot>,<port>,<enum_bit>[,<debug>]
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index bf5092455a8f..faae2c357bab 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -28,6 +28,12 @@ LIST_HEAD(cpuidle_detected_devices);
28static void (*pm_idle_old)(void); 28static void (*pm_idle_old)(void);
29 29
30static int enabled_devices; 30static int enabled_devices;
31static int off __read_mostly;
32
33int cpuidle_disabled(void)
34{
35 return off;
36}
31 37
32#if defined(CONFIG_ARCH_HAS_CPU_IDLE_WAIT) 38#if defined(CONFIG_ARCH_HAS_CPU_IDLE_WAIT)
33static void cpuidle_kick_cpus(void) 39static void cpuidle_kick_cpus(void)
@@ -427,6 +433,9 @@ static int __init cpuidle_init(void)
427{ 433{
428 int ret; 434 int ret;
429 435
436 if (cpuidle_disabled())
437 return -ENODEV;
438
430 pm_idle_old = pm_idle; 439 pm_idle_old = pm_idle;
431 440
432 ret = cpuidle_add_class_sysfs(&cpu_sysdev_class); 441 ret = cpuidle_add_class_sysfs(&cpu_sysdev_class);
@@ -438,4 +447,5 @@ static int __init cpuidle_init(void)
438 return 0; 447 return 0;
439} 448}
440 449
450module_param(off, int, 0444);
441core_initcall(cpuidle_init); 451core_initcall(cpuidle_init);
diff --git a/drivers/cpuidle/cpuidle.h b/drivers/cpuidle/cpuidle.h
index 33e50d556f17..38c3fd8b9d76 100644
--- a/drivers/cpuidle/cpuidle.h
+++ b/drivers/cpuidle/cpuidle.h
@@ -13,6 +13,7 @@ extern struct list_head cpuidle_governors;
13extern struct list_head cpuidle_detected_devices; 13extern struct list_head cpuidle_detected_devices;
14extern struct mutex cpuidle_lock; 14extern struct mutex cpuidle_lock;
15extern spinlock_t cpuidle_driver_lock; 15extern spinlock_t cpuidle_driver_lock;
16extern int cpuidle_disabled(void);
16 17
17/* idle loop */ 18/* idle loop */
18extern void cpuidle_install_idle_handler(void); 19extern void cpuidle_install_idle_handler(void);
diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c
index fd1601e3d125..3f7e3cedd133 100644
--- a/drivers/cpuidle/driver.c
+++ b/drivers/cpuidle/driver.c
@@ -26,6 +26,9 @@ int cpuidle_register_driver(struct cpuidle_driver *drv)
26 if (!drv) 26 if (!drv)
27 return -EINVAL; 27 return -EINVAL;
28 28
29 if (cpuidle_disabled())
30 return -ENODEV;
31
29 spin_lock(&cpuidle_driver_lock); 32 spin_lock(&cpuidle_driver_lock);
30 if (cpuidle_curr_driver) { 33 if (cpuidle_curr_driver) {
31 spin_unlock(&cpuidle_driver_lock); 34 spin_unlock(&cpuidle_driver_lock);
diff --git a/drivers/cpuidle/governor.c b/drivers/cpuidle/governor.c
index 724c164d31c9..ea2f8e7aa24a 100644
--- a/drivers/cpuidle/governor.c
+++ b/drivers/cpuidle/governor.c
@@ -81,6 +81,9 @@ int cpuidle_register_governor(struct cpuidle_governor *gov)
81 if (!gov || !gov->select) 81 if (!gov || !gov->select)
82 return -EINVAL; 82 return -EINVAL;
83 83
84 if (cpuidle_disabled())
85 return -ENODEV;
86
84 mutex_lock(&cpuidle_lock); 87 mutex_lock(&cpuidle_lock);
85 if (__cpuidle_find_governor(gov->name) == NULL) { 88 if (__cpuidle_find_governor(gov->name) == NULL) {
86 ret = 0; 89 ret = 0;