2024-01-23 12:56:02

by Thomas Gleixner

[permalink] [raw]
Subject: [patch v5 10/19] x86/smpboot: Teach it about topo.amd_node_id

From: Thomas Gleixner <[email protected]>

When switching AMD over to the new topology parser then the match functions
need to look for AMD systems with the extended topology feature at the new
topo.amd_node_id member which is then holding the node id information.

Signed-off-by: Thomas Gleixner <[email protected]>
Tested-by: Juergen Gross <[email protected]>
Tested-by: Sohil Mehta <[email protected]>
Tested-by: Michael Kelley <[email protected]>


---
arch/x86/kernel/smpboot.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
---
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -488,6 +488,7 @@ static bool match_smt(struct cpuinfo_x86

if (c->topo.pkg_id == o->topo.pkg_id &&
c->topo.die_id == o->topo.die_id &&
+ c->topo.amd_node_id == o->topo.amd_node_id &&
per_cpu_llc_id(cpu1) == per_cpu_llc_id(cpu2)) {
if (c->topo.core_id == o->topo.core_id)
return topology_sane(c, o, "smt");
@@ -509,10 +510,13 @@ static bool match_smt(struct cpuinfo_x86

static bool match_die(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o)
{
- if (c->topo.pkg_id == o->topo.pkg_id &&
- c->topo.die_id == o->topo.die_id)
- return true;
- return false;
+ if (c->topo.pkg_id != o->topo.pkg_id || c->topo.die_id != o->topo.die_id)
+ return false;
+
+ if (boot_cpu_has(X86_FEATURE_TOPOEXT) && topology_amd_nodes_per_pkg() > 1)
+ return c->topo.amd_node_id == o->topo.amd_node_id;
+
+ return true;
}

static bool match_l2c(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o)



2024-02-06 16:16:19

by Borislav Petkov

[permalink] [raw]
Subject: Re: [patch v5 10/19] x86/smpboot: Teach it about topo.amd_node_id

On Tue, Jan 23, 2024 at 01:53:45PM +0100, Thomas Gleixner wrote:
> static bool match_die(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o)
> {
> - if (c->topo.pkg_id == o->topo.pkg_id &&
> - c->topo.die_id == o->topo.die_id)
> - return true;
> - return false;
> + if (c->topo.pkg_id != o->topo.pkg_id || c->topo.die_id != o->topo.die_id)
> + return false;
> +
> + if (boot_cpu_has(X86_FEATURE_TOPOEXT) && topology_amd_nodes_per_pkg() > 1)

check_for_deprecated_apis: WARNING: arch/x86/kernel/smpboot.c:516: Do not use boot_cpu_has() - use cpu_feature_enabled() instead.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette