summaryrefslogtreecommitdiff
path: root/arch/x86
diff options
context:
space:
mode:
authorZhang Rui <rui.zhang@intel.com>2022-10-14 12:01:47 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-11-10 20:14:15 +0300
commit5bdbccc79c86424fef1960de76abab9e83cfbdc9 (patch)
tree0bc8797c04cc6e9f8781ebf64f5f40e08fc69e62 /arch/x86
parent6c31fc028a657e8d53cec5127a39a35cce6dba08 (diff)
downloadlinux-5bdbccc79c86424fef1960de76abab9e83cfbdc9.tar.xz
x86/topology: Fix duplicated core ID within a package
[ Upstream commit 71eac7063698b7d7b8fafb1683ac24a034541141 ] Today, core ID is assumed to be unique within each package. But an AlderLake-N platform adds a Module level between core and package, Linux excludes the unknown modules bits from the core ID, resulting in duplicate core ID's. To keep core ID unique within a package, Linux must include all APIC-ID bits for known or unknown levels above the core and below the package in the core ID. It is important to understand that core ID's have always come directly from the APIC-ID encoding, which comes from the BIOS. Thus there is no guarantee that they start at 0, or that they are contiguous. As such, naively using them for array indexes can be problematic. [ dhansen: un-known -> unknown ] Fixes: 7745f03eb395 ("x86/topology: Add CPUID.1F multi-die/package support") Suggested-by: Len Brown <len.brown@intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Reviewed-by: Len Brown <len.brown@intel.com> Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/20221014090147.1836-5-rui.zhang@intel.com Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kernel/cpu/topology.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/kernel/cpu/topology.c b/arch/x86/kernel/cpu/topology.c
index 696309749d62..37d48ab3d077 100644
--- a/arch/x86/kernel/cpu/topology.c
+++ b/arch/x86/kernel/cpu/topology.c
@@ -141,7 +141,7 @@ int detect_extended_topology(struct cpuinfo_x86 *c)
sub_index++;
}
- core_select_mask = (~(-1 << core_plus_mask_width)) >> ht_mask_width;
+ core_select_mask = (~(-1 << pkg_mask_width)) >> ht_mask_width;
die_select_mask = (~(-1 << die_plus_mask_width)) >>
core_plus_mask_width;