2024-05-28 20:53:03

by Thomas Gleixner

[permalink] [raw]
Subject: [PATCH Resend] x86/topology/amd: Evaluate SMT in CPUID leaf 0x8000001e only on family 0x17 and greater

The new AMD/HYGON topology parser evaluates the SMT information in CPUID
leaf 0x8000001e unconditionally while the original code restricted it to
CPUs with family 0x17 and greater.

This breaks family 0x15 CPUs which advertise that leaf and have a non-zero
value in the SMT section. The machine boots, but the scheduler complains
loudly about the mismatch of the core IDs:

WARNING: CPU: 1 PID: 0 at kernel/sched/core.c:6482 sched_cpu_starting+0x183/0x250
WARNING: CPU: 0 PID: 1 at kernel/sched/topology.c:2408 build_sched_domains+0x76b/0x12b0

Add the condition back to cure it.

Fixes: f7fb3b2dd92c ("x86/cpu: Provide an AMD/HYGON specific topology parser")
Reported-by: Tim Teichmann <[email protected]>
Bisected-by: Christian Heusel <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Tested-by: Tim Teichmann <[email protected]>
Cc: [email protected]
Cc: [email protected]
Closes: https://gitlab.archlinux.org/archlinux/packaging/packages/linux/-/issues/56
---
Resend with LKML in Cc. Sorry for the noise.
---
arch/x86/kernel/cpu/topology_amd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

--- a/arch/x86/kernel/cpu/topology_amd.c
+++ b/arch/x86/kernel/cpu/topology_amd.c
@@ -84,9 +84,9 @@ static bool parse_8000_001e(struct topo_

/*
* If leaf 0xb is available, then the domain shifts are set
- * already and nothing to do here.
+ * already and nothing to do here. Only valid for family >= 0x17.
*/
- if (!has_topoext) {
+ if (!has_topoext && c->x86 >= 0x17) {
/*
* Leaf 0x80000008 set the CORE domain shift already.
* Update the SMT domain, but do not propagate it.