From 4d247e1408474559b51b3bc3e6490aa6865e28f1 Mon Sep 17 00:00:00 2001 From: Wenhui Fan Date: Wed, 2 Sep 2026 16:24:27 +0800 Subject: [PATCH] anolis: x86/cpu/hygon: Fix node ID overflow for Hygon models 0x4-0x8 ANBZ: #45105 Node ID will overflow when both NUMA and SMT are turned off in BIOS setup on Hygon platform, this cause kernel panic when system boot. Fix the node id calculation according to the scenario describe above. Hygon-SIG: commit none hygon anolis: Fix node ID overflow for Hygon models 0x4-0x8 Signed-off-by: Wenhui Fan --- arch/x86/kernel/cpu/hygon.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/hygon.c b/arch/x86/kernel/cpu/hygon.c index 1e7b5466c963..a52abe29155e 100644 --- a/arch/x86/kernel/cpu/hygon.c +++ b/arch/x86/kernel/cpu/hygon.c @@ -150,8 +150,15 @@ static void srat_detect_node(struct cpuinfo_x86 *c) unsigned int apicid = c->apicid; node = numa_cpu_node(cpu); - if (node == NUMA_NO_NODE) - node = per_cpu(cpu_llc_id, cpu); + if (node == NUMA_NO_NODE) { + if (c->x86_model >= 0x4 && c->x86_model <= 0x8) { + node = cpu_to_node(cpu); + numa_set_node(cpu, node); + return; + } else { + node = per_cpu(cpu_llc_id, cpu); + } + } /* * On multi-fabric platform (e.g. Numascale NumaChip) a -- Gitee