]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
cpuidle: create bootparam "cpuidle.off=1"
authorLen Brown <len.brown@intel.com>
Fri, 1 Apr 2011 22:13:10 +0000 (18:13 -0400)
committerLen Brown <len.brown@intel.com>
Wed, 3 Aug 2011 23:06:36 +0000 (19:06 -0400)
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>
Documentation/kernel-parameters.txt
drivers/cpuidle/cpuidle.c
drivers/cpuidle/cpuidle.h
drivers/cpuidle/driver.c
drivers/cpuidle/governor.c

index aa47be71df4c12ddeb15f7abead764279b20f113..9b8e62d75a0c1b54043c33f0e15051cd9a3e2ecb 100644 (file)
@@ -546,6 +546,9 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
                        /proc/<pid>/coredump_filter.
                        See also Documentation/filesystems/proc.txt.
 
+       cpuidle.off=1   [CPU_IDLE]
+                       disable the cpuidle sub-system
+
        cpcihp_generic= [HW,PCI] Generic port I/O CompactPCI driver
                        Format:
                        <first_slot>,<last_slot>,<port>,<enum_bit>[,<debug>]
index bf5092455a8f813f58fe88b07baaeea1b772ae87..faae2c357bab35aed2d7c710889d12bad3122b78 100644 (file)
@@ -28,6 +28,12 @@ LIST_HEAD(cpuidle_detected_devices);
 static void (*pm_idle_old)(void);
 
 static int enabled_devices;
+static int off __read_mostly;
+
+int cpuidle_disabled(void)
+{
+       return off;
+}
 
 #if defined(CONFIG_ARCH_HAS_CPU_IDLE_WAIT)
 static void cpuidle_kick_cpus(void)
@@ -427,6 +433,9 @@ static int __init cpuidle_init(void)
 {
        int ret;
 
+       if (cpuidle_disabled())
+               return -ENODEV;
+
        pm_idle_old = pm_idle;
 
        ret = cpuidle_add_class_sysfs(&cpu_sysdev_class);
@@ -438,4 +447,5 @@ static int __init cpuidle_init(void)
        return 0;
 }
 
+module_param(off, int, 0444);
 core_initcall(cpuidle_init);
index 33e50d556f178232f2cef79ae45e28f6923b325f..38c3fd8b9d763b1e5da516c85d10e36bf731f476 100644 (file)
@@ -13,6 +13,7 @@ extern struct list_head cpuidle_governors;
 extern struct list_head cpuidle_detected_devices;
 extern struct mutex cpuidle_lock;
 extern spinlock_t cpuidle_driver_lock;
+extern int cpuidle_disabled(void);
 
 /* idle loop */
 extern void cpuidle_install_idle_handler(void);
index fd1601e3d1250faaa3b4863eb27706529076bcb1..3f7e3cedd133b4ef66965351efb34351374b4af8 100644 (file)
@@ -26,6 +26,9 @@ int cpuidle_register_driver(struct cpuidle_driver *drv)
        if (!drv)
                return -EINVAL;
 
+       if (cpuidle_disabled())
+               return -ENODEV;
+
        spin_lock(&cpuidle_driver_lock);
        if (cpuidle_curr_driver) {
                spin_unlock(&cpuidle_driver_lock);
index 724c164d31c9a47ece237894888244cb4ec0e4b1..ea2f8e7aa24af2936e4b0766f70e36eac2941eea 100644 (file)
@@ -81,6 +81,9 @@ int cpuidle_register_governor(struct cpuidle_governor *gov)
        if (!gov || !gov->select)
                return -EINVAL;
 
+       if (cpuidle_disabled())
+               return -ENODEV;
+
        mutex_lock(&cpuidle_lock);
        if (__cpuidle_find_governor(gov->name) == NULL) {
                ret = 0;