提交 d065f1f2 编写于 作者: Z Zhang Rui 提交者: Lipeng Sang

x86/topology: Fix duplicated core ID within a package

stable inclusion
from stable-v5.10.154
commit 5bdbccc79c86424fef1960de76abab9e83cfbdc9
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I64YCB

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=5bdbccc79c86424fef1960de76abab9e83cfbdc9

--------------------------------

[ Upstream commit 71eac706 ]

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: 7745f03e ("x86/topology: Add CPUID.1F multi-die/package support")
Suggested-by: NLen Brown <len.brown@intel.com>
Signed-off-by: NZhang Rui <rui.zhang@intel.com>
Signed-off-by: NDave Hansen <dave.hansen@linux.intel.com>
Reviewed-by: NLen Brown <len.brown@intel.com>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/20221014090147.1836-5-rui.zhang@intel.comSigned-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NLipeng Sang <sanglipeng1@jd.com>
上级 c73302dc
...@@ -141,7 +141,7 @@ int detect_extended_topology(struct cpuinfo_x86 *c) ...@@ -141,7 +141,7 @@ int detect_extended_topology(struct cpuinfo_x86 *c)
sub_index++; 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)) >> die_select_mask = (~(-1 << die_plus_mask_width)) >>
core_plus_mask_width; core_plus_mask_width;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册