]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 9 Nov 2018 16:13:08 +0000 (08:13 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 9 Nov 2018 16:13:08 +0000 (08:13 -0800)
added patches:
cpuidle-do-not-access-cpuidle_devices-when-config_cpu_idle.patch

queue-4.4/cpuidle-do-not-access-cpuidle_devices-when-config_cpu_idle.patch [new file with mode: 0644]
queue-4.4/series

diff --git a/queue-4.4/cpuidle-do-not-access-cpuidle_devices-when-config_cpu_idle.patch b/queue-4.4/cpuidle-do-not-access-cpuidle_devices-when-config_cpu_idle.patch
new file mode 100644 (file)
index 0000000..bfbb932
--- /dev/null
@@ -0,0 +1,61 @@
+From 9bd616e3dbedfc103f158197c8ad93678849b1ed Mon Sep 17 00:00:00 2001
+From: Catalin Marinas <catalin.marinas@arm.com>
+Date: Wed, 1 Jun 2016 18:52:16 +0100
+Subject: cpuidle: Do not access cpuidle_devices when !CONFIG_CPU_IDLE
+
+From: Catalin Marinas <catalin.marinas@arm.com>
+
+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>
+Cc: 4.5+ <stable@vger.kernel.org> # 4.5+
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Cc: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/linux/cpuidle.h |    3 +++
+ kernel/sched/idle.c     |    2 +-
+ 2 files changed, 4 insertions(+), 1 deletion(-)
+
+--- a/include/linux/cpuidle.h
++++ b/include/linux/cpuidle.h
+@@ -152,6 +152,8 @@ extern void cpuidle_disable_device(struc
+ extern int cpuidle_play_dead(void);
+ 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,
+@@ -187,6 +189,7 @@ static inline void cpuidle_disable_devic
+ static inline int cpuidle_play_dead(void) {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
+ #if defined(CONFIG_CPU_IDLE) && defined(CONFIG_SUSPEND)
+--- a/kernel/sched/idle.c
++++ b/kernel/sched/idle.c
+@@ -132,7 +132,7 @@ static int call_cpuidle(struct cpuidle_d
+  */
+ 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;
index 2ff9990a755a34ef72fe20c77aef21f625127ec0..fd80bcc21ef4e852d804f533ba015f7ba582f28c 100644 (file)
@@ -110,4 +110,5 @@ usb-fix-the-usbfs-flag-sanitization-for-control-transfers.patch
 input-elan_i2c-add-acpi-id-for-lenovo-ideapad-330-15igm.patch
 sched-fair-fix-throttle_list-starvation-with-low-cfs-quota.patch
 x86-percpu-fix-this_cpu_read.patch
+cpuidle-do-not-access-cpuidle_devices-when-config_cpu_idle.patch
 x86-time-correct-the-attribute-on-jiffies-definition.patch