From: Yazen Ghannam <yazen.ghannam@amd.com>
To: Phineas Su <pohaosu@google.com>
Cc: bp@alien8.de, tony.luck@intel.com, muralidhara.mk@amd.com,
linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] EDAC/amd64: Only translate Node ID if GPU nodes are present
Date: Mon, 22 Jun 2026 13:07:17 -0400 [thread overview]
Message-ID: <20260622170717.GA1571@yaz-khff2.amd.com> (raw)
In-Reply-To: <20260614150618.696249-1-pohaosu@google.com>
On Sun, Jun 14, 2026 at 03:06:18PM +0000, Phineas Su wrote:
> The fixup_node_id() function adjusts the AMD Node ID for GPU memory
> controllers (which report as SMCA_UMC_V2) on heterogeneous systems.
> CPU memory controllers typically report as SMCA_UMC (v1) and do not
> require translation.
>
> If a CPU memory controller on a CPU-only system were to report as
> SMCA_UMC_V2 (e.g. due to future hardware iterations, firmware reporting,
> or kernel enumeration differences), the code would attempt to apply the
> GPU translation. Since gpu_node_map is uninitialized on CPU-only systems,
> this would lead to an unintended translation being applied.
>
> Harden the translation logic by checking that GPU nodes are actually
> present in the system (gpu_node_map.node_count > 0) before applying the
> translation. This ensures CPU-only systems are always safely bypassed.
>
> Signed-off-by: Phineas Su <pohaosu@google.com>
> ---
> v2:
> - Reframed commit message to focus on robustness rather than a confirmed
> bug, as Zen4 CPUs do not generally report UMC_V2. (Yazen)
>
> drivers/edac/amd64_edac.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
> index c6aa69dbd9fb..1e688123a50c 100644
> --- a/drivers/edac/amd64_edac.c
> +++ b/drivers/edac/amd64_edac.c
> @@ -1047,6 +1047,10 @@ static int fixup_node_id(int node_id, struct mce *m)
> if (smca_get_bank_type(m->extcpu, m->bank) != SMCA_UMC_V2)
> return node_id;
>
> + /* If no GPU nodes are present, no fixup is needed. */
> + if (!gpu_node_map.node_count)
> + return node_id;
> +
Thanks Phineas for the patch.
I do agree, in principle, about hardening against possible new
configurations.
I think your patch could go a bit further.
I don't see any users of gpu_node_map.node_count. So rather than add a
user, we could remove it.
In fact, we don't even need the entire struct. We just need the
'gpu_base_node_id'.
> /* Nodes below the GPU base node are CPU nodes and don't need a fixup. */
> if (nid < gpu_node_map.base_node_id)
> return node_id;
You could add the "unintialized" check here. ^^^
if (!gpu_base_node_id || nid < gpu_base_node_id)
return node_id;
What do you think?
Thanks,
Yazen
next prev parent reply other threads:[~2026-06-22 17:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-08 7:26 [PATCH] EDAC/amd64: Fix incorrect Node ID mapping on CPU-only Zen4+ systems Phineas Su
2026-06-09 16:07 ` Yazen Ghannam
2026-06-14 14:15 ` Phineas Su
2026-06-14 15:06 ` [PATCH v2] EDAC/amd64: Only translate Node ID if GPU nodes are present Phineas Su
2026-06-22 17:07 ` Yazen Ghannam [this message]
2026-06-23 0:49 ` Borislav Petkov
2026-06-23 15:49 ` Yazen Ghannam
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=20260622170717.GA1571@yaz-khff2.amd.com \
--to=yazen.ghannam@amd.com \
--cc=bp@alien8.de \
--cc=linux-edac@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=muralidhara.mk@amd.com \
--cc=pohaosu@google.com \
--cc=tony.luck@intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox