]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.12-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 23 Oct 2025 15:52:06 +0000 (17:52 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 23 Oct 2025 15:52:06 +0000 (17:52 +0200)
added patches:
pm-em-drop-unused-parameter-from-em_adjust_new_capacity.patch
pm-em-fix-late-boot-with-holes-in-cpu-topology.patch
pm-em-move-cpu-capacity-check-to-em_adjust_new_capacity.patch
pm-em-slightly-reduce-em_check_capacity_update-overhead.patch

queue-6.12/pm-em-drop-unused-parameter-from-em_adjust_new_capacity.patch [new file with mode: 0644]
queue-6.12/pm-em-fix-late-boot-with-holes-in-cpu-topology.patch [new file with mode: 0644]
queue-6.12/pm-em-move-cpu-capacity-check-to-em_adjust_new_capacity.patch [new file with mode: 0644]
queue-6.12/pm-em-slightly-reduce-em_check_capacity_update-overhead.patch [new file with mode: 0644]
queue-6.12/series

diff --git a/queue-6.12/pm-em-drop-unused-parameter-from-em_adjust_new_capacity.patch b/queue-6.12/pm-em-drop-unused-parameter-from-em_adjust_new_capacity.patch
new file mode 100644 (file)
index 0000000..d7dcfc0
--- /dev/null
@@ -0,0 +1,48 @@
+From stable+bounces-188417-greg=kroah.com@vger.kernel.org Tue Oct 21 21:22:35 2025
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 21 Oct 2025 15:22:22 -0400
+Subject: PM: EM: Drop unused parameter from em_adjust_new_capacity()
+To: stable@vger.kernel.org
+Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>, Lukasz Luba <lukasz.luba@arm.com>, Sasha Levin <sashal@kernel.org>
+Message-ID: <20251021192225.2899605-1-sashal@kernel.org>
+
+From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
+
+[ Upstream commit 5fad775d432c6c9158ea12e7e00d8922ef8d3dfc ]
+
+The max_cap parameter is never used in em_adjust_new_capacity(), so
+drop it.
+
+No functional impact.
+
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
+Link: https://patch.msgid.link/2369979.ElGaqSPkdT@rjwysocki.net
+Stable-dep-of: 1ebe8f7e7825 ("PM: EM: Fix late boot with holes in CPU topology")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ kernel/power/energy_model.c |    5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+--- a/kernel/power/energy_model.c
++++ b/kernel/power/energy_model.c
+@@ -723,8 +723,7 @@ free_em_table:
+  * are correctly calculated.
+  */
+ static void em_adjust_new_capacity(struct device *dev,
+-                                 struct em_perf_domain *pd,
+-                                 u64 max_cap)
++                                 struct em_perf_domain *pd)
+ {
+       struct em_perf_table *em_table;
+@@ -795,7 +794,7 @@ static void em_check_capacity_update(voi
+                        cpu, cpu_capacity, em_max_perf);
+               dev = get_cpu_device(cpu);
+-              em_adjust_new_capacity(dev, pd, cpu_capacity);
++              em_adjust_new_capacity(dev, pd);
+       }
+       free_cpumask_var(cpu_done_mask);
diff --git a/queue-6.12/pm-em-fix-late-boot-with-holes-in-cpu-topology.patch b/queue-6.12/pm-em-fix-late-boot-with-holes-in-cpu-topology.patch
new file mode 100644 (file)
index 0000000..868e846
--- /dev/null
@@ -0,0 +1,72 @@
+From stable+bounces-188420-greg=kroah.com@vger.kernel.org Tue Oct 21 21:22:37 2025
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 21 Oct 2025 15:22:25 -0400
+Subject: PM: EM: Fix late boot with holes in CPU topology
+To: stable@vger.kernel.org
+Cc: Christian Loehle <christian.loehle@arm.com>, Kenneth Crudup <kenneth.crudup@gmail.com>, "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>, Sasha Levin <sashal@kernel.org>
+Message-ID: <20251021192225.2899605-4-sashal@kernel.org>
+
+From: Christian Loehle <christian.loehle@arm.com>
+
+[ Upstream commit 1ebe8f7e782523e62cd1fa8237f7afba5d1dae83 ]
+
+Commit e3f1164fc9ee ("PM: EM: Support late CPUs booting and capacity
+adjustment") added a mechanism to handle CPUs that come up late by
+retrying when any of the `cpufreq_cpu_get()` call fails.
+
+However, if there are holes in the CPU topology (offline CPUs, e.g.
+nosmt), the first missing CPU causes the loop to break, preventing
+subsequent online CPUs from being updated.
+
+Instead of aborting on the first missing CPU policy, loop through all
+and retry if any were missing.
+
+Fixes: e3f1164fc9ee ("PM: EM: Support late CPUs booting and capacity adjustment")
+Suggested-by: Kenneth Crudup <kenneth.crudup@gmail.com>
+Reported-by: Kenneth Crudup <kenneth.crudup@gmail.com>
+Link: https://lore.kernel.org/linux-pm/40212796-734c-4140-8a85-854f72b8144d@panix.com/
+Cc: 6.9+ <stable@vger.kernel.org> # 6.9+
+Signed-off-by: Christian Loehle <christian.loehle@arm.com>
+Link: https://patch.msgid.link/20250831214357.2020076-1-christian.loehle@arm.com
+[ rjw: Drop the new pr_debug() message which is not very useful ]
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ kernel/power/energy_model.c |   11 ++++++-----
+ 1 file changed, 6 insertions(+), 5 deletions(-)
+
+--- a/kernel/power/energy_model.c
++++ b/kernel/power/energy_model.c
+@@ -755,7 +755,7 @@ static void em_adjust_new_capacity(unsig
+ static void em_check_capacity_update(void)
+ {
+       cpumask_var_t cpu_done_mask;
+-      int cpu;
++      int cpu, failed_cpus = 0;
+       if (!zalloc_cpumask_var(&cpu_done_mask, GFP_KERNEL)) {
+               pr_warn("no free memory\n");
+@@ -773,10 +773,8 @@ static void em_check_capacity_update(voi
+               policy = cpufreq_cpu_get(cpu);
+               if (!policy) {
+-                      pr_debug("Accessing cpu%d policy failed\n", cpu);
+-                      schedule_delayed_work(&em_update_work,
+-                                            msecs_to_jiffies(1000));
+-                      break;
++                      failed_cpus++;
++                      continue;
+               }
+               cpufreq_cpu_put(policy);
+@@ -791,6 +789,9 @@ static void em_check_capacity_update(voi
+               em_adjust_new_capacity(cpu, dev, pd);
+       }
++      if (failed_cpus)
++              schedule_delayed_work(&em_update_work, msecs_to_jiffies(1000));
++
+       free_cpumask_var(cpu_done_mask);
+ }
diff --git a/queue-6.12/pm-em-move-cpu-capacity-check-to-em_adjust_new_capacity.patch b/queue-6.12/pm-em-move-cpu-capacity-check-to-em_adjust_new_capacity.patch
new file mode 100644 (file)
index 0000000..8988ec5
--- /dev/null
@@ -0,0 +1,109 @@
+From stable+bounces-188419-greg=kroah.com@vger.kernel.org Tue Oct 21 21:22:36 2025
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 21 Oct 2025 15:22:24 -0400
+Subject: PM: EM: Move CPU capacity check to em_adjust_new_capacity()
+To: stable@vger.kernel.org
+Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>, Lukasz Luba <lukasz.luba@arm.com>, Christian Loehle <christian.loehle@arm.com>, Dietmar Eggemann <dietmar.eggemann@arm.com>, Sasha Levin <sashal@kernel.org>
+Message-ID: <20251021192225.2899605-3-sashal@kernel.org>
+
+From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
+
+[ Upstream commit 3e3ba654d3097e0031f2add215b12ff81c23814e ]
+
+Move the check of the CPU capacity currently stored in the energy model
+against the arch_scale_cpu_capacity() value to em_adjust_new_capacity()
+so it will be done regardless of where the latter is called from.
+
+This will be useful when a new em_adjust_new_capacity() caller is added
+subsequently.
+
+While at it, move the pd local variable declaration in
+em_check_capacity_update() into the loop in which it is used.
+
+No intentional functional impact.
+
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
+Tested-by: Christian Loehle <christian.loehle@arm.com>
+Reviewed-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
+Link: https://patch.msgid.link/7810787.EvYhyI6sBW@rjwysocki.net
+Stable-dep-of: 1ebe8f7e7825 ("PM: EM: Fix late boot with holes in CPU topology")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ kernel/power/energy_model.c |   40 +++++++++++++++++-----------------------
+ 1 file changed, 17 insertions(+), 23 deletions(-)
+
+--- a/kernel/power/energy_model.c
++++ b/kernel/power/energy_model.c
+@@ -722,10 +722,24 @@ free_em_table:
+  * Adjustment of CPU performance values after boot, when all CPUs capacites
+  * are correctly calculated.
+  */
+-static void em_adjust_new_capacity(struct device *dev,
++static void em_adjust_new_capacity(unsigned int cpu, struct device *dev,
+                                  struct em_perf_domain *pd)
+ {
++      unsigned long cpu_capacity = arch_scale_cpu_capacity(cpu);
+       struct em_perf_table *em_table;
++      struct em_perf_state *table;
++      unsigned long em_max_perf;
++
++      rcu_read_lock();
++      table = em_perf_state_from_pd(pd);
++      em_max_perf = table[pd->nr_perf_states - 1].performance;
++      rcu_read_unlock();
++
++      if (em_max_perf == cpu_capacity)
++              return;
++
++      pr_debug("updating cpu%d cpu_cap=%lu old capacity=%lu\n", cpu,
++               cpu_capacity, em_max_perf);
+       em_table = em_table_dup(pd);
+       if (!em_table) {
+@@ -741,9 +755,6 @@ static void em_adjust_new_capacity(struc
+ static void em_check_capacity_update(void)
+ {
+       cpumask_var_t cpu_done_mask;
+-      struct em_perf_state *table;
+-      struct em_perf_domain *pd;
+-      unsigned long cpu_capacity;
+       int cpu;
+       if (!zalloc_cpumask_var(&cpu_done_mask, GFP_KERNEL)) {
+@@ -754,7 +765,7 @@ static void em_check_capacity_update(voi
+       /* Check if CPUs capacity has changed than update EM */
+       for_each_possible_cpu(cpu) {
+               struct cpufreq_policy *policy;
+-              unsigned long em_max_perf;
++              struct em_perf_domain *pd;
+               struct device *dev;
+               if (cpumask_test_cpu(cpu, cpu_done_mask))
+@@ -777,24 +788,7 @@ static void em_check_capacity_update(voi
+               cpumask_or(cpu_done_mask, cpu_done_mask,
+                          em_span_cpus(pd));
+-              cpu_capacity = arch_scale_cpu_capacity(cpu);
+-
+-              rcu_read_lock();
+-              table = em_perf_state_from_pd(pd);
+-              em_max_perf = table[pd->nr_perf_states - 1].performance;
+-              rcu_read_unlock();
+-
+-              /*
+-               * Check if the CPU capacity has been adjusted during boot
+-               * and trigger the update for new performance values.
+-               */
+-              if (em_max_perf == cpu_capacity)
+-                      continue;
+-
+-              pr_debug("updating cpu%d cpu_cap=%lu old capacity=%lu\n",
+-                       cpu, cpu_capacity, em_max_perf);
+-
+-              em_adjust_new_capacity(dev, pd);
++              em_adjust_new_capacity(cpu, dev, pd);
+       }
+       free_cpumask_var(cpu_done_mask);
diff --git a/queue-6.12/pm-em-slightly-reduce-em_check_capacity_update-overhead.patch b/queue-6.12/pm-em-slightly-reduce-em_check_capacity_update-overhead.patch
new file mode 100644 (file)
index 0000000..2d18fa9
--- /dev/null
@@ -0,0 +1,55 @@
+From stable+bounces-188418-greg=kroah.com@vger.kernel.org Tue Oct 21 21:22:35 2025
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 21 Oct 2025 15:22:23 -0400
+Subject: PM: EM: Slightly reduce em_check_capacity_update() overhead
+To: stable@vger.kernel.org
+Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>, Lukasz Luba <lukasz.luba@arm.com>, Sasha Levin <sashal@kernel.org>
+Message-ID: <20251021192225.2899605-2-sashal@kernel.org>
+
+From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
+
+[ Upstream commit a8e62726ac0dd7b610c87ba1a938a5a9091c34df ]
+
+Every iteration of the loop over all possible CPUs in
+em_check_capacity_update() causes get_cpu_device() to be called twice
+for the same CPU, once indirectly via em_cpu_get() and once directly.
+
+Get rid of the indirect get_cpu_device() call by moving the direct
+invocation of it earlier and using em_pd_get() instead of em_cpu_get()
+to get a pd pointer for the dev one returned by it.
+
+This also exposes the fact that dev is needed to get a pd, so the code
+becomes somewhat easier to follow after it.
+
+No functional impact.
+
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
+Link: https://patch.msgid.link/1925950.tdWV9SEqCh@rjwysocki.net
+Stable-dep-of: 1ebe8f7e7825 ("PM: EM: Fix late boot with holes in CPU topology")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ kernel/power/energy_model.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/kernel/power/energy_model.c
++++ b/kernel/power/energy_model.c
+@@ -769,7 +769,8 @@ static void em_check_capacity_update(voi
+               }
+               cpufreq_cpu_put(policy);
+-              pd = em_cpu_get(cpu);
++              dev = get_cpu_device(cpu);
++              pd = em_pd_get(dev);
+               if (!pd || em_is_artificial(pd))
+                       continue;
+@@ -793,7 +794,6 @@ static void em_check_capacity_update(voi
+               pr_debug("updating cpu%d cpu_cap=%lu old capacity=%lu\n",
+                        cpu, cpu_capacity, em_max_perf);
+-              dev = get_cpu_device(cpu);
+               em_adjust_new_capacity(dev, pd);
+       }
index bdfe200c491b7d4b6aafb802d61ca32f45a355ee..57c80cc3a91a6f4b7a7faffffa22b63d631a6a6e 100644 (file)
@@ -20,3 +20,7 @@ s390-mm-use-__gfp_account-for-user-page-table-alloca.patch
 smb-server-let-smb_direct_flush_send_list-invalidate.patch
 unbreak-make-tools-for-user-space-targets.patch
 bpf-replace-bpf_map_kmalloc_node-with-kmalloc_nolock.patch
+pm-em-drop-unused-parameter-from-em_adjust_new_capacity.patch
+pm-em-slightly-reduce-em_check_capacity_update-overhead.patch
+pm-em-move-cpu-capacity-check-to-em_adjust_new_capacity.patch
+pm-em-fix-late-boot-with-holes-in-cpu-topology.patch