1 From 34bf6bae3286a58762711cfbce2cf74ecd42e1b5 Mon Sep 17 00:00:00 2001
2 From: Thomas Gleixner <tglx@linutronix.de>
3 Date: Tue, 28 May 2024 22:21:31 +0200
4 Subject: x86/topology/amd: Evaluate SMT in CPUID leaf 0x8000001e only on family 0x17 and greater
6 From: Thomas Gleixner <tglx@linutronix.de>
8 commit 34bf6bae3286a58762711cfbce2cf74ecd42e1b5 upstream.
10 The new AMD/HYGON topology parser evaluates the SMT information in CPUID leaf
11 0x8000001e unconditionally while the original code restricted it to CPUs with
12 family 0x17 and greater.
14 This breaks family 0x15 CPUs which advertise that leaf and have a non-zero
15 value in the SMT section. The machine boots, but the scheduler complains loudly
16 about the mismatch of the core IDs:
18 WARNING: CPU: 1 PID: 0 at kernel/sched/core.c:6482 sched_cpu_starting+0x183/0x250
19 WARNING: CPU: 0 PID: 1 at kernel/sched/topology.c:2408 build_sched_domains+0x76b/0x12b0
21 Add the condition back to cure it.
23 [ bp: Make it actually build because grandpa is not concerned with
26 Fixes: f7fb3b2dd92c ("x86/cpu: Provide an AMD/HYGON specific topology parser")
27 Closes: https://gitlab.archlinux.org/archlinux/packaging/packages/linux/-/issues/56
28 Reported-by: Tim Teichmann <teichmanntim@outlook.de>
29 Reported-by: Christian Heusel <christian@heusel.eu>
30 Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
31 Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
32 Tested-by: Tim Teichmann <teichmanntim@outlook.de>
33 Cc: stable@vger.kernel.org
34 Link: https://lore.kernel.org/r/7skhx6mwe4hxiul64v6azhlxnokheorksqsdbp7qw6g2jduf6c@7b5pvomauugk
35 Signed-off-by: Christian Heusel <christian@heusel.eu>
36 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
38 arch/x86/kernel/cpu/topology_amd.c | 4 ++--
39 1 file changed, 2 insertions(+), 2 deletions(-)
41 --- a/arch/x86/kernel/cpu/topology_amd.c
42 +++ b/arch/x86/kernel/cpu/topology_amd.c
43 @@ -84,9 +84,9 @@ static bool parse_8000_001e(struct topo_
46 * If leaf 0xb is available, then the domain shifts are set
47 - * already and nothing to do here.
48 + * already and nothing to do here. Only valid for family >= 0x17.
51 + if (!has_0xb && tscan->c->x86 >= 0x17) {
53 * Leaf 0x80000008 set the CORE domain shift already.
54 * Update the SMT domain, but do not propagate it.