All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thorsten Blum <thorsten.blum@linux.dev>
To: Dave Hansen <dave.hansen@linux.intel.com>,
	Andy Lutomirski <luto@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	Borislav Petkov <bp@alien8.de>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>
Cc: Thorsten Blum <thorsten.blum@linux.dev>, linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] x86/mm/numa: Clean up topology parsing in amd_numa_init()
Date: Sun,  5 Jul 2026 19:16:31 +0200	[thread overview]
Message-ID: <20260705171631.338768-3-thorsten.blum@linux.dev> (raw)

Since commit e23bba604433 ("x86-64, NUMA: Unify emulated distance
mapping"), nodeids[] is only written but never read. Remove it.

Also drop the start variable and the base < start clamp, since start is
always zero and the expression always false.

While at it, use min() for the limit > end clamp and drop the redundant
second limit > end clamp.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 arch/x86/mm/amdtopology.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/arch/x86/mm/amdtopology.c b/arch/x86/mm/amdtopology.c
index f980b0eb0105..d68d345a5b82 100644
--- a/arch/x86/mm/amdtopology.c
+++ b/arch/x86/mm/amdtopology.c
@@ -27,8 +27,6 @@
 #include <asm/apic.h>
 #include <asm/amd/nb.h>
 
-static unsigned char __initdata nodeids[8];
-
 static __init int find_northbridge(void)
 {
 	int num;
@@ -56,7 +54,7 @@ static __init int find_northbridge(void)
 int __init amd_numa_init(void)
 {
 	unsigned int numnodes, cores, apicid;
-	u64 prevbase, start = PFN_PHYS(0);
+	u64 prevbase;
 	u64 end = PFN_PHYS(max_pfn);
 	u32 nodeid, reg;
 	int i, j, nb;
@@ -84,7 +82,7 @@ int __init amd_numa_init(void)
 		base = read_pci_config(0, nb, 1, 0x40 + i*8);
 		limit = read_pci_config(0, nb, 1, 0x44 + i*8);
 
-		nodeids[i] = nodeid = limit & 7;
+		nodeid = limit & 7;
 		if ((base & 3) == 0) {
 			if (i < numnodes)
 				pr_info("Skipping disabled node %d\n", i);
@@ -115,19 +113,12 @@ int __init amd_numa_init(void)
 		limit >>= 16;
 		limit++;
 		limit <<= 24;
-
-		if (limit > end)
-			limit = end;
+		limit = min(limit, end);
 		if (limit <= base)
 			continue;
 
 		base >>= 16;
 		base <<= 24;
-
-		if (base < start)
-			base = start;
-		if (limit > end)
-			limit = end;
 		if (limit == base) {
 			pr_err("Empty node %d\n", nodeid);
 			continue;

             reply	other threads:[~2026-07-05 17:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-05 17:16 Thorsten Blum [this message]
2026-07-05 17:16 ` [PATCH 2/2] x86/mm/numa: Update format specifiers in amd_numa_init() Thorsten Blum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260705171631.338768-3-thorsten.blum@linux.dev \
    --to=thorsten.blum@linux.dev \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.