Skip to content

Commit 4cf2b0e

Browse files
committed
x86/topology: Fix duplicated core ID within a package
Bugzilla: https://bugzilla.redhat.com/2159554 commit 71eac70 Author: Zhang Rui <rui.zhang@intel.com> Date: Fri Oct 14 17:01:47 2022 +0800 x86/topology: Fix duplicated core ID within a package 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: 7745f03 ("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: David Arcari <darcari@redhat.com>
1 parent 8b05589 commit 4cf2b0e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/kernel/cpu/topology.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ int detect_extended_topology(struct cpuinfo_x86 *c)
141141
sub_index++;
142142
}
143143

144-
core_select_mask = (~(-1 << core_plus_mask_width)) >> ht_mask_width;
144+
core_select_mask = (~(-1 << pkg_mask_width)) >> ht_mask_width;
145145
die_select_mask = (~(-1 << die_plus_mask_width)) >>
146146
core_plus_mask_width;
147147

0 commit comments

Comments
 (0)