Skip to content
/ linux Public

Commit 8498738

Browse files
Sean V KelleySasha Levin
authored andcommitted
ACPI: CPPC: Fix remaining for_each_possible_cpu() to use online CPUs
[ Upstream commit 56eb0c0 ] per_cpu(cpc_desc_ptr, cpu) object is initialized for only the online CPUs via acpi_soft_cpu_online() --> __acpi_processor_start() --> acpi_cppc_processor_probe(). However, send_pcc_cmd() and acpi_get_psd_map() still iterate over all possible CPUs. In acpi_get_psd_map(), encountering an offline CPU returns -EFAULT, causing cppc_cpufreq initialization to fail. This breaks systems booted with "nosmt" or "nosmt=force". Fix by using for_each_online_cpu() in both functions. Fixes: 80b8286 ("ACPI / CPPC: support for batching CPPC requests") Signed-off-by: Sean V Kelley <skelley@nvidia.com> Link: https://patch.msgid.link/20260211212254.30190-1-skelley@nvidia.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent b271c9c commit 8498738

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/acpi/cppc_acpi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ static int send_pcc_cmd(int pcc_ss_id, u16 cmd)
342342
end:
343343
if (cmd == CMD_WRITE) {
344344
if (unlikely(ret)) {
345-
for_each_possible_cpu(i) {
345+
for_each_online_cpu(i) {
346346
struct cpc_desc *desc = per_cpu(cpc_desc_ptr, i);
347347

348348
if (!desc)
@@ -504,7 +504,7 @@ int acpi_get_psd_map(unsigned int cpu, struct cppc_cpudata *cpu_data)
504504
else if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ANY)
505505
cpu_data->shared_type = CPUFREQ_SHARED_TYPE_ANY;
506506

507-
for_each_possible_cpu(i) {
507+
for_each_online_cpu(i) {
508508
if (i == cpu)
509509
continue;
510510

0 commit comments

Comments
 (0)