]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
cpuidle: Do not access cpuidle_devices when !CONFIG_CPU_IDLE
authorCatalin Marinas <catalin.marinas@arm.com>
Wed, 1 Jun 2016 17:52:16 +0000 (18:52 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Jul 2016 15:42:10 +0000 (08:42 -0700)
commit94611d6e867fa01d33f2f1c5321e88ca47b5a74f
treeddeff41bcbb35669b58ac6761b9296c85472703e
parent88a7b2532dca4f4850a35ef16016986600e3bad0
cpuidle: Do not access cpuidle_devices when !CONFIG_CPU_IDLE

commit 9bd616e3dbedfc103f158197c8ad93678849b1ed upstream.

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>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/cpuidle.h
kernel/sched/idle.c