Commit 8821c8e8 authored by Gautham R. Shenoy's avatar Gautham R. Shenoy Committed by Rafael J. Wysocki
Browse files

ACPI: CPPC: Perform fast check switch only for online CPUs



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 the function cppc_allow_fast_switch() checks for the validity
of the _CPC object for all the present CPUs. This breaks when the
kernel is booted with "nosmt=force".

Check fast_switch capability only on online CPUs

Fixes: 15eece6c ("ACPI: CPPC: Fix NULL pointer dereference when nosmp is used")
Reviewed-by: default avatar"Mario Limonciello (AMD) (kernel.org)" <superm1@kernel.org>
Signed-off-by: default avatarGautham R. Shenoy <gautham.shenoy@amd.com>
Link: https://patch.msgid.link/20251107074145.2340-4-gautham.shenoy@amd.com


Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 6dd3b8a7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -476,7 +476,7 @@ bool cppc_allow_fast_switch(void)
	struct cpc_desc *cpc_ptr;
	int cpu;

	for_each_present_cpu(cpu) {
	for_each_online_cpu(cpu) {
		cpc_ptr = per_cpu(cpc_desc_ptr, cpu);
		desired_reg = &cpc_ptr->cpc_regs[DESIRED_PERF];
		if (!CPC_IN_SYSTEM_MEMORY(desired_reg) &&