Skip to content

Commit a9025cd

Browse files
committed
x86/topology: Don't update cpu_possible_map in topo_set_cpuids()
topo_set_cpuids() updates cpu_present_map and cpu_possible map. It is invoked during enumeration and "physical hotplug" operations. In the latter case this results in a kernel crash because cpu_possible_map is marked read only after init completes. There is no reason to update cpu_possible_map in that function. During enumeration cpu_possible_map is not relevant and gets fully initialized after enumeration completed. On "physical hotplug" the bit is already set because the kernel allows only CPUs to be plugged which have been enumerated and associated to a CPU number during early boot. Remove the bogus update of cpu_possible_map. Fixes: 0e53e7b ("x86/cpu/topology: Sanitize the APIC admission logic") Reported-by: Jonathan Cameron <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/r/87ttkc6kwx.ffs@tglx
1 parent 04f4230 commit a9025cd

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

arch/x86/kernel/cpu/topology.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ static void topo_set_cpuids(unsigned int cpu, u32 apic_id, u32 acpi_id)
123123
early_per_cpu(x86_cpu_to_apicid, cpu) = apic_id;
124124
early_per_cpu(x86_cpu_to_acpiid, cpu) = acpi_id;
125125
#endif
126-
set_cpu_possible(cpu, true);
127126
set_cpu_present(cpu, true);
128127
}
129128

@@ -210,7 +209,11 @@ static __init void topo_register_apic(u32 apic_id, u32 acpi_id, bool present)
210209
topo_info.nr_disabled_cpus++;
211210
}
212211

213-
/* Register present and possible CPUs in the domain maps */
212+
/*
213+
* Register present and possible CPUs in the domain
214+
* maps. cpu_possible_map will be updated in
215+
* topology_init_possible_cpus() after enumeration is done.
216+
*/
214217
for (dom = TOPO_SMT_DOMAIN; dom < TOPO_MAX_DOMAIN; dom++)
215218
set_bit(topo_apicid(apic_id, dom), apic_maps[dom].map);
216219
}

0 commit comments

Comments
 (0)