Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

Len Brown 62027aea 6dccf9c5

+20
+3
Documentation/kernel-parameters.txt
··· 546 546 /proc/<pid>/coredump_filter. 547 547 See also Documentation/filesystems/proc.txt. 548 548 549 + cpuidle.off=1 [CPU_IDLE] 550 + disable the cpuidle sub-system 551 + 549 552 cpcihp_generic= [HW,PCI] Generic port I/O CompactPCI driver 550 553 Format: 551 554 <first_slot>,<last_slot>,<port>,<enum_bit>[,<debug>]
+10
drivers/cpuidle/cpuidle.c
··· 28 28 static void (*pm_idle_old)(void); 29 29 30 30 static int enabled_devices; 31 + static int off __read_mostly; 32 + 33 + int cpuidle_disabled(void) 34 + { 35 + return off; 36 + } 31 37 32 38 #if defined(CONFIG_ARCH_HAS_CPU_IDLE_WAIT) 33 39 static void cpuidle_kick_cpus(void) ··· 433 427 { 434 428 int ret; 435 429 430 + if (cpuidle_disabled()) 431 + return -ENODEV; 432 + 436 433 pm_idle_old = pm_idle; 437 434 438 435 ret = cpuidle_add_class_sysfs(&cpu_sysdev_class); ··· 447 438 return 0; 448 439 } 449 440 441 + module_param(off, int, 0444); 450 442 core_initcall(cpuidle_init);
+1
drivers/cpuidle/cpuidle.h
··· 13 13 extern struct list_head cpuidle_detected_devices; 14 14 extern struct mutex cpuidle_lock; 15 15 extern spinlock_t cpuidle_driver_lock; 16 + extern int cpuidle_disabled(void); 16 17 17 18 /* idle loop */ 18 19 extern void cpuidle_install_idle_handler(void);
+3
drivers/cpuidle/driver.c
··· 26 26 if (!drv) 27 27 return -EINVAL; 28 28 29 + if (cpuidle_disabled()) 30 + return -ENODEV; 31 + 29 32 spin_lock(&cpuidle_driver_lock); 30 33 if (cpuidle_curr_driver) { 31 34 spin_unlock(&cpuidle_driver_lock);
+3
drivers/cpuidle/governor.c
··· 81 81 if (!gov || !gov->select) 82 82 return -EINVAL; 83 83 84 + if (cpuidle_disabled()) 85 + return -ENODEV; 86 + 84 87 mutex_lock(&cpuidle_lock); 85 88 if (__cpuidle_find_governor(gov->name) == NULL) { 86 89 ret = 0;