Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 5754ace

Browse files
KAGA-KOKObp3tk0v
authored andcommitted
x86/topology/amd: Ensure that LLC ID is initialized
The original topology evaluation code initialized cpu_data::topo::llc_id with the die ID initialy and then eventually overwrite it with information gathered from a CPUID leaf. The conversion analysis failed to spot that particular detail and omitted this initial assignment under the assumption that each topology evaluation path will set it up. That assumption is mostly correct, but turns out to be wrong in case that the CPUID leaf 0x80000006 does not provide a LLC ID. In that case, LLC ID is invalid and as a consequence the setup of the scheduling domain CPU masks is incorrect which subsequently causes the scheduler core to complain about it during CPU hotplug: BUG: arch topology borken the CLS domain not a subset of the MC domain Cure it by reusing legacy_set_llc() and assigning the die ID if the LLC ID is invalid after all possible parsers have been tried. Fixes: f7fb3b2 ("x86/cpu: Provide an AMD/HYGON specific topology parser") Reported-by: Yuezhang Mo <Yuezhang.Mo@sony.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Tested-by: Yuezhang Mo <Yuezhang.Mo@sony.com> Link: https://lore.kernel.org/r/PUZPR04MB63168AC442C12627E827368581292@PUZPR04MB6316.apcprd04.prod.outlook.com
1 parent 0e640f0 commit 5754ace

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

arch/x86/kernel/cpu/topology_amd.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ static bool parse_8000_001e(struct topo_scan *tscan, bool has_0xb)
119119
return true;
120120
}
121121

122-
static bool parse_fam10h_node_id(struct topo_scan *tscan)
122+
static void parse_fam10h_node_id(struct topo_scan *tscan)
123123
{
124124
union {
125125
struct {
@@ -131,20 +131,20 @@ static bool parse_fam10h_node_id(struct topo_scan *tscan)
131131
} nid;
132132

133133
if (!boot_cpu_has(X86_FEATURE_NODEID_MSR))
134-
return false;
134+
return;
135135

136136
rdmsrl(MSR_FAM10H_NODE_ID, nid.msr);
137137
store_node(tscan, nid.nodes_per_pkg + 1, nid.node_id);
138138
tscan->c->topo.llc_id = nid.node_id;
139-
return true;
140139
}
141140

142141
static void legacy_set_llc(struct topo_scan *tscan)
143142
{
144143
unsigned int apicid = tscan->c->topo.initial_apicid;
145144

146-
/* parse_8000_0008() set everything up except llc_id */
147-
tscan->c->topo.llc_id = apicid >> tscan->dom_shifts[TOPO_CORE_DOMAIN];
145+
/* If none of the parsers set LLC ID then use the die ID for it. */
146+
if (tscan->c->topo.llc_id == BAD_APICID)
147+
tscan->c->topo.llc_id = apicid >> tscan->dom_shifts[TOPO_CORE_DOMAIN];
148148
}
149149

150150
static void topoext_fixup(struct topo_scan *tscan)
@@ -187,17 +187,15 @@ static void parse_topology_amd(struct topo_scan *tscan)
187187
return;
188188

189189
/* Try the NODEID MSR */
190-
if (parse_fam10h_node_id(tscan))
191-
return;
192-
193-
legacy_set_llc(tscan);
190+
parse_fam10h_node_id(tscan);
194191
}
195192

196193
void cpu_parse_topology_amd(struct topo_scan *tscan)
197194
{
198195
tscan->amd_nodes_per_pkg = 1;
199196
topoext_fixup(tscan);
200197
parse_topology_amd(tscan);
198+
legacy_set_llc(tscan);
201199

202200
if (tscan->amd_nodes_per_pkg > 1)
203201
set_cpu_cap(tscan->c, X86_FEATURE_AMD_DCM);

0 commit comments

Comments
 (0)