Skip to content

Commit 882e0cf

Browse files
committed
x86/cpu/topology: Mop up primary thread mask handling
The early initcall to initialize the primary thread mask is not longer required because topology_init_possible_cpus() can mark primary threads correctly when initializing the possible and present map as the number of SMT threads is already determined correctly. The XENPV workaround is not longer required because XENPV now registers fake APIC IDs which will just work like any other enumeration. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Tested-by: Michael Kelley <mhklinux@outlook.com> Tested-by: Sohil Mehta <sohil.mehta@intel.com> Link: https://lore.kernel.org/r/20240213210252.736104257@linutronix.de
1 parent 090610b commit 882e0cf

File tree

1 file changed

+2
-27
lines changed

1 file changed

+2
-27
lines changed

arch/x86/kernel/cpu/topology.c

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -82,30 +82,6 @@ static void cpu_mark_primary_thread(unsigned int cpu, unsigned int apicid)
8282
if (smp_num_siblings == 1 || !(apicid & mask))
8383
cpumask_set_cpu(cpu, &__cpu_primary_thread_mask);
8484
}
85-
86-
/*
87-
* Due to the utter mess of CPUID evaluation smp_num_siblings is not valid
88-
* during early boot. Initialize the primary thread mask before SMP
89-
* bringup.
90-
*/
91-
static int __init smp_init_primary_thread_mask(void)
92-
{
93-
unsigned int cpu;
94-
95-
/*
96-
* XEN/PV provides either none or useless topology information.
97-
* Pretend that all vCPUs are primary threads.
98-
*/
99-
if (xen_pv_domain()) {
100-
cpumask_copy(&__cpu_primary_thread_mask, cpu_possible_mask);
101-
return 0;
102-
}
103-
104-
for (cpu = 0; cpu < topo_info.nr_assigned_cpus; cpu++)
105-
cpu_mark_primary_thread(cpu, cpuid_to_apicid[cpu]);
106-
return 0;
107-
}
108-
early_initcall(smp_init_primary_thread_mask);
10985
#else
11086
static inline void cpu_mark_primary_thread(unsigned int cpu, unsigned int apicid) { }
11187
#endif
@@ -151,9 +127,6 @@ static void topo_set_cpuids(unsigned int cpu, u32 apic_id, u32 acpi_id)
151127
#endif
152128
set_cpu_possible(cpu, true);
153129
set_cpu_present(cpu, true);
154-
155-
if (system_state != SYSTEM_BOOTING)
156-
cpu_mark_primary_thread(cpu, apic_id);
157130
}
158131

159132
static __init bool check_for_real_bsp(u32 apic_id)
@@ -282,6 +255,7 @@ int topology_hotplug_apic(u32 apic_id, u32 acpi_id)
282255

283256
set_bit(apic_id, phys_cpu_present_map);
284257
topo_set_cpuids(cpu, apic_id, acpi_id);
258+
cpu_mark_primary_thread(cpu, apic_id);
285259
return cpu;
286260
}
287261

@@ -414,6 +388,7 @@ void __init topology_init_possible_cpus(void)
414388
if (apicid == BAD_APICID)
415389
continue;
416390

391+
cpu_mark_primary_thread(cpu, apicid);
417392
set_cpu_present(cpu, test_bit(apicid, phys_cpu_present_map));
418393
}
419394
}

0 commit comments

Comments
 (0)