]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.9-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 24 Oct 2022 08:40:38 +0000 (10:40 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 24 Oct 2022 08:40:38 +0000 (10:40 +0200)
added patches:
thermal-intel_powerclamp-use-first-online-cpu-as-control_cpu.patch

queue-4.9/series
queue-4.9/thermal-intel_powerclamp-use-first-online-cpu-as-control_cpu.patch [new file with mode: 0644]

index 37df05bdbc2530d74be6ba2982f132a13a6991a1..a4f33ceaa06fcd3eef3976f847c560ba7f88669b 100644 (file)
@@ -155,3 +155,4 @@ net-ieee802154-return-einval-for-unknown-addr-type.patch
 net-ieee802154-don-t-warn-zero-sized-raw_sendmsg.patch
 ext4-continue-to-expand-file-system-when-the-target-size-doesn-t-reach.patch
 inet-fully-convert-sk-sk_rx_dst-to-rcu-rules.patch
+thermal-intel_powerclamp-use-first-online-cpu-as-control_cpu.patch
diff --git a/queue-4.9/thermal-intel_powerclamp-use-first-online-cpu-as-control_cpu.patch b/queue-4.9/thermal-intel_powerclamp-use-first-online-cpu-as-control_cpu.patch
new file mode 100644 (file)
index 0000000..5b75bed
--- /dev/null
@@ -0,0 +1,44 @@
+From 4bb7f6c2781e46fc5bd00475a66df2ea30ef330d Mon Sep 17 00:00:00 2001
+From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
+Date: Thu, 13 Oct 2022 14:50:28 +0200
+Subject: thermal: intel_powerclamp: Use first online CPU as control_cpu
+
+From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+
+commit 4bb7f6c2781e46fc5bd00475a66df2ea30ef330d upstream.
+
+Commit 68b99e94a4a2 ("thermal: intel_powerclamp: Use get_cpu() instead
+of smp_processor_id() to avoid crash") fixed an issue related to using
+smp_processor_id() in preemptible context by replacing it with a pair
+of get_cpu()/put_cpu(), but what is needed there really is any online
+CPU and not necessarily the one currently running the code.  Arguably,
+getting the one that's running the code in there is confusing.
+
+For this reason, simply give the control CPU role to the first online
+one which automatically will be CPU0 if it is online, so one check
+can be dropped from the code for an added benefit.
+
+Link: https://lore.kernel.org/linux-pm/20221011113646.GA12080@duo.ucw.cz/
+Fixes: 68b99e94a4a2 ("thermal: intel_powerclamp: Use get_cpu() instead of smp_processor_id() to avoid crash")
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Reviewed-by: Chen Yu <yu.c.chen@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/thermal/intel_powerclamp.c |    6 +-----
+ 1 file changed, 1 insertion(+), 5 deletions(-)
+
+--- a/drivers/thermal/intel_powerclamp.c
++++ b/drivers/thermal/intel_powerclamp.c
+@@ -518,11 +518,7 @@ static int start_power_clamp(void)
+       get_online_cpus();
+       /* prefer BSP */
+-      control_cpu = 0;
+-      if (!cpu_online(control_cpu)) {
+-              control_cpu = get_cpu();
+-              put_cpu();
+-      }
++      control_cpu = cpumask_first(cpu_online_mask);
+       clamping = true;
+       schedule_delayed_work(&poll_pkg_cstate_work, 0);