path: root/kernel
diff options
authorCatalin Marinas <>2016-06-01 18:52:16 +0100
committerRafael J. Wysocki <>2016-06-02 23:05:27 +0200
commit9bd616e3dbedfc103f158197c8ad93678849b1ed (patch)
treebcd47c1dba1e764ae3263f7bb30002e1656f88b5 /kernel
parente7387da52028b072489c45efeb7a916c0205ebd2 (diff)
cpuidle: Do not access cpuidle_devices when !CONFIG_CPU_IDLE
The cpuidle_devices per-CPU variable is only defined when CPU_IDLE is enabled. Commit c8cc7d4de7a4 ("sched/idle: Reorganize the idle loop") removed the #ifdef CONFIG_CPU_IDLE around cpuidle_idle_call() with the compiler optimising away __this_cpu_read(cpuidle_devices). However, with CONFIG_UBSAN && !CONFIG_CPU_IDLE, this optimisation no longer happens and the kernel fails to link since cpuidle_devices is not defined. This patch introduces an accessor function for the current CPU cpuidle device (returning NULL when !CONFIG_CPU_IDLE) and uses it in cpuidle_idle_call(). Signed-off-by: Catalin Marinas <> Cc: 4.5+ <> # 4.5+ Signed-off-by: Rafael J. Wysocki <>
Diffstat (limited to 'kernel')
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c
index bd12c6c714ec..c5aeedf4e93a 100644
--- a/kernel/sched/idle.c
+++ b/kernel/sched/idle.c
@@ -127,7 +127,7 @@ static int call_cpuidle(struct cpuidle_driver *drv, struct cpuidle_device *dev,
static void cpuidle_idle_call(void)
- struct cpuidle_device *dev = __this_cpu_read(cpuidle_devices);
+ struct cpuidle_device *dev = cpuidle_get_device();
struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev);
int next_state, entered_state;