Skip to content
/ linux Public

Commit 7279921

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 a584b9d commit 7279921

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
@@ -347,7 +347,7 @@ static int send_pcc_cmd(int pcc_ss_id, u16 cmd)
347347
end:
348348
if (cmd == CMD_WRITE) {
349349
if (unlikely(ret)) {
350-
for_each_possible_cpu(i) {
350+
for_each_online_cpu(i) {
351351
struct cpc_desc *desc = per_cpu(cpc_desc_ptr, i);
352352

353353
if (!desc)
@@ -509,7 +509,7 @@ int acpi_get_psd_map(unsigned int cpu, struct cppc_cpudata *cpu_data)
509509
else if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ANY)
510510
cpu_data->shared_type = CPUFREQ_SHARED_TYPE_ANY;
511511

512-
for_each_possible_cpu(i) {
512+
for_each_online_cpu(i) {
513513
if (i == cpu)
514514
continue;
515515

0 commit comments

Comments
 (0)