summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorCatalin Marinas <catalin.marinas@arm.com>2016-06-01 18:52:16 +0100
committerSeung-Woo Kim <sw0312.kim@samsung.com>2016-12-14 13:52:01 +0900
commit9239398bfe6198555c804b4be6e924772fd035f1 (patch)
tree52325df63cb07fe54154e7ea4826e707ecf7690a /kernel
parent6bbb82315c339299926c7956de9bb05cf06f151a (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 <catalin.marinas@arm.com> Cc: 4.5+ <stable@vger.kernel.org> # 4.5+ Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> [Backport from mainline to fix build error for CONFIG_UBSAN && ! CONFIG_CPU_IDLE] Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Change-Id: I447cd7f1076903bc036eb0e832d9cabba91099b7
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched/idle.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c
index fefcb1fa5160..437d577e30f7 100644
--- a/kernel/sched/idle.c
+++ b/kernel/sched/idle.c
@@ -78,7 +78,7 @@ void __weak arch_cpu_idle(void)
*/
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;
bool reflect;