Skip to content

Commit 1ebe8f7

Browse files
cloehlerafaeljw
authored andcommitted
PM: EM: Fix late boot with holes in CPU topology
Commit e3f1164 ("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: e3f1164 ("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>
1 parent e042354 commit 1ebe8f7

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

kernel/power/energy_model.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ void em_adjust_cpu_capacity(unsigned int cpu)
799799
static void em_check_capacity_update(void)
800800
{
801801
cpumask_var_t cpu_done_mask;
802-
int cpu;
802+
int cpu, failed_cpus = 0;
803803

804804
if (!zalloc_cpumask_var(&cpu_done_mask, GFP_KERNEL)) {
805805
pr_warn("no free memory\n");
@@ -817,10 +817,8 @@ static void em_check_capacity_update(void)
817817

818818
policy = cpufreq_cpu_get(cpu);
819819
if (!policy) {
820-
pr_debug("Accessing cpu%d policy failed\n", cpu);
821-
schedule_delayed_work(&em_update_work,
822-
msecs_to_jiffies(1000));
823-
break;
820+
failed_cpus++;
821+
continue;
824822
}
825823
cpufreq_cpu_put(policy);
826824

@@ -835,6 +833,9 @@ static void em_check_capacity_update(void)
835833
em_adjust_new_capacity(cpu, dev, pd);
836834
}
837835

836+
if (failed_cpus)
837+
schedule_delayed_work(&em_update_work, msecs_to_jiffies(1000));
838+
838839
free_cpumask_var(cpu_done_mask);
839840
}
840841

0 commit comments

Comments
 (0)