summaryrefslogtreecommitdiff
path: root/arch/x86/kernel/cpu/topology_common.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2024-02-13 22:06:03 +0100
committerThomas Gleixner <tglx@linutronix.de>2024-02-15 22:07:44 +0100
commit090610ba704a66d7a58919be3bad195f24499ecb (patch)
tree240519e75fbb7f210c5b9b0ae9059ee08d443812 /arch/x86/kernel/cpu/topology_common.c
parent354da4cf57af5d8b5302251204d6077600b6d3d6 (diff)
x86/cpu/topology: Use topology bitmaps for sizing
Now that all possible APIC IDs are tracked in the topology bitmaps, its trivial to retrieve the real information from there. This gets rid of the guesstimates for the maximal packages and dies per package as the actual numbers can be determined before a single AP has been brought up. The number of SMT threads can now be determined correctly from the bitmaps in all situations. Up to now a system which has SMT disabled in the BIOS will still claim that it is SMT capable, because the lowest APIC ID bit is reserved for that and CPUID leaf 0xb/0x1f still enumerates the SMT domain accordingly. By calculating the bitmap weights of the SMT and the CORE domain and setting them into relation the SMT disabled in BIOS situation reports correctly that the system is not SMT capable. It also handles the situation correctly when a hybrid systems boot CPU does not have SMT as it takes the SMT capability of the APs fully into account. 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.681709880@linutronix.de
Diffstat (limited to 'arch/x86/kernel/cpu/topology_common.c')
-rw-r--r--arch/x86/kernel/cpu/topology_common.c24
1 files changed, 0 insertions, 24 deletions
diff --git a/arch/x86/kernel/cpu/topology_common.c b/arch/x86/kernel/cpu/topology_common.c
index b0b68c867aaf..0276978bc272 100644
--- a/arch/x86/kernel/cpu/topology_common.c
+++ b/arch/x86/kernel/cpu/topology_common.c
@@ -196,16 +196,6 @@ void cpu_parse_topology(struct cpuinfo_x86 *c)
tscan.dom_shifts[dom], x86_topo_system.dom_shifts[dom]);
}
- /* Bug compatible with the existing parsers */
- if (tscan.dom_ncpus[TOPO_SMT_DOMAIN] > smp_num_siblings) {
- if (system_state == SYSTEM_BOOTING) {
- pr_warn_once("CPU%d: SMT detected and enabled late\n", cpu);
- smp_num_siblings = tscan.dom_ncpus[TOPO_SMT_DOMAIN];
- } else {
- pr_warn_once("CPU%d: SMT detected after init. Too late!\n", cpu);
- }
- }
-
topo_set_ids(&tscan);
topo_set_max_cores(&tscan);
}
@@ -232,20 +222,6 @@ void __init cpu_init_topology(struct cpuinfo_x86 *c)
topo_set_max_cores(&tscan);
/*
- * Bug compatible with the existing code. If the boot CPU does not
- * have SMT this ends up with one sibling. This needs way deeper
- * changes further down the road to get it right during early boot.
- */
- smp_num_siblings = tscan.dom_ncpus[TOPO_SMT_DOMAIN];
-
- /*
- * Neither it's clear whether there are as many dies as the APIC
- * space indicating die level is. But assume that the actual number
- * of CPUs gives a proper indication for now to stay bug compatible.
- */
- __max_die_per_package = tscan.dom_ncpus[TOPO_DIE_DOMAIN] /
- tscan.dom_ncpus[TOPO_DIE_DOMAIN - 1];
- /*
* AMD systems have Nodes per package which cannot be mapped to
* APIC ID.
*/