diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2016-06-01 18:52:16 +0100 |
---|---|---|
committer | Seung-Woo Kim <sw0312.kim@samsung.com> | 2016-12-14 13:52:01 +0900 |
commit | 9239398bfe6198555c804b4be6e924772fd035f1 (patch) | |
tree | 52325df63cb07fe54154e7ea4826e707ecf7690a /include | |
parent | 6bbb82315c339299926c7956de9bb05cf06f151a (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 'include')
-rw-r--r-- | include/linux/cpuidle.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h index 9c5e89254796..111ead2df02e 100644 --- a/include/linux/cpuidle.h +++ b/include/linux/cpuidle.h @@ -157,6 +157,8 @@ extern int cpuidle_enter_freeze(struct cpuidle_driver *drv, struct cpuidle_device *dev); extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev); +static inline struct cpuidle_device *cpuidle_get_device(void) +{return __this_cpu_read(cpuidle_devices); } #else static inline void disable_cpuidle(void) { } static inline bool cpuidle_not_available(struct cpuidle_driver *drv, @@ -198,6 +200,7 @@ static inline int cpuidle_enter_freeze(struct cpuidle_driver *drv, {return -ENODEV; } static inline struct cpuidle_driver *cpuidle_get_cpu_driver( struct cpuidle_device *dev) {return NULL; } +static inline struct cpuidle_device *cpuidle_get_device(void) {return NULL; } #endif #ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED |