From: sashiko-bot@kernel.org
To: "K Prateek Nayak" <kprateek.nayak@amd.com>
Cc: "Heiko Carstens" <hca@linux.ibm.com>,
linux-s390@vger.kernel.org,
"Alexander Gordeev" <agordeev@linux.ibm.com>,
"Christian Borntraeger" <borntraeger@linux.ibm.com>,
"Vasily Gorbik" <gor@linux.ibm.com>
Subject: Re: [RFC PATCH v3 03/13] LoongArch: Initialize CPU _PXM relation for disabled CPUs from SRAT
Date: Fri, 02 Oct 2026 09:13:32 +0000 [thread overview]
Message-ID: <20261002091332.63AD11F00899@smtp.kernel.org> (raw)
In-Reply-To: <20261001192849.74788-4-kprateek.nayak@amd.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] loongarch/numa: skip adding disabled CPU node to numa_nodes_parsed
--
commit 9393724eb4ba65d5f1a0cdd15d60f325d36ffc28
Author: K Prateek Nayak <kprateek.nayak@amd.com>
Subject: LoongArch: Initialize CPU _PXM relation for disabled CPUs from SRAT
This commit updates SRAT parsing on LoongArch to initialize the CPU _PXM
(Node) relation even for disabled CPUs. This is intended to help early
topology parsing count LLC domains and set sparsebitmask properties, while
mapping per-CPU areas correctly.
> diff --git a/arch/loongarch/kernel/acpi.c b/arch/loongarch/kernel/acpi.c
> index cb454ee92b204..1f15f78713b7e 100644
> --- a/arch/loongarch/kernel/acpi.c
> +++ b/arch/loongarch/kernel/acpi.c
[ ... ]
> @@ -332,9 +331,12 @@ acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa)
> return;
> }
>
> - early_numa_add_cpu(pa->apic_id, node);
> -
> set_cpuid_to_node(pa->apic_id, node);
> +
> + if ((pa->flags & ACPI_SRAT_CPU_ENABLED) == 0)
> + return;
> +
> + early_numa_add_cpu(pa->apic_id, node);
> node_set(node, numa_nodes_parsed);
[Severity: High]
Does skipping node_set() leave the NUMA node uninitialized?
If the node lacks memory and other enabled CPUs, it won't be added to
numa_nodes_parsed. As a result, alloc_node_data() will not be called,
leaving NODE_DATA(node) as NULL.
Since set_cpuid_to_node() was already called for this disabled CPU,
early_cpu_to_node() will return this uninitialized node instead of
NUMA_NO_NODE.
This can cause smp_prepare_boot_cpu() to bypass the safe rr_node fallback
and assign the uninitialized node to the CPU:
arch/loongarch/kernel/smp.c:smp_prepare_boot_cpu() {
...
if (node != NUMA_NO_NODE)
set_cpu_numa_node(cpu, node);
else {
set_cpu_numa_node(cpu, rr_node);
rr_node = next_node_in(rr_node, node_online_map);
}
...
}
Could this lead to generic per-CPU allocations or CPU hotplug actions blindly
dereferencing the NULL NODE_DATA(node) pointer? For example, when hotplugging
the disabled CPU:
mm/memory_hotplug.c:hotadd_init_pgdat() {
...
pgdat = NODE_DATA(nid);
/* init node's zones as empty zones, we don't have any present pages.*/
if (free_area_init_core_hotplug(pgdat))
...
}
[ ... ]
> @@ -366,9 +367,12 @@ acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa)
> return;
> }
>
> - early_numa_add_cpu(pa->apic_id, node);
> -
> set_cpuid_to_node(pa->apic_id, node);
> +
> + if ((pa->flags & ACPI_SRAT_CPU_ENABLED) == 0)
> + return;
> +
> + early_numa_add_cpu(pa->apic_id, node);
> node_set(node, numa_nodes_parsed);
[Severity: High]
Does this expose hotplugged CPUs in x2apic topologies to the same NULL
pointer dereference?
The exact same early return logic is present here for x2apic, skipping
the node_set() initialization for disabled CPUs.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261001192849.74788-1-kprateek.nayak@amd.com?part=3
next prev parent reply other threads:[~2026-10-02 9:13 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-01 19:28 [RFC PATCH v3 00/13] lib, sched: Introduce sparsebitmap (sbm) K Prateek Nayak
2026-10-01 19:28 ` [RFC PATCH v3 01/13] lib/sbm: Introduce helpers for architectures to configure LLC properties K Prateek Nayak
2026-10-02 9:13 ` sashiko-bot
2026-10-07 5:43 ` Shrikanth Hegde
2026-10-01 19:28 ` [RFC PATCH v3 02/13] drivers/base/arch_topology: Add support for initializing sbm topology K Prateek Nayak
2026-10-02 9:13 ` sashiko-bot
2026-10-01 19:28 ` [RFC PATCH v3 03/13] LoongArch: Initialize CPU _PXM relation for disabled CPUs from SRAT K Prateek Nayak
2026-10-02 9:13 ` sashiko-bot [this message]
2026-10-01 19:28 ` [RFC PATCH v3 04/13] LoongArch: Configure sbm topology during SMP preparation K Prateek Nayak
2026-10-02 9:13 ` sashiko-bot
2026-10-07 3:51 ` [RFC PATCH v3.1 " K Prateek Nayak
2026-10-01 19:28 ` [RFC PATCH v3 05/13] MIPS: Initialize sbm topology on multi-node systems K Prateek Nayak
2026-10-02 9:13 ` sashiko-bot
2026-10-01 19:28 ` [RFC PATCH v3 06/13] powerpc/setup: Initialize sbm topology based on coregroup / NUMA topology K Prateek Nayak
2026-10-02 9:13 ` sashiko-bot
2026-10-07 14:43 ` Shrikanth Hegde
2026-10-01 19:28 ` [RFC PATCH v3 07/13] s390/topology: Initialize sbm topology during topology_init_early() K Prateek Nayak
2026-10-02 9:13 ` sashiko-bot
2026-10-07 10:19 ` Mete Durlu
2026-10-01 19:28 ` [RFC PATCH v3 08/13] sparc64: Initialize sbm topology on multi-LLC system K Prateek Nayak
2026-10-02 9:13 ` sashiko-bot
2026-10-01 19:28 ` [RFC PATCH v3 09/13] x86/cpu/topology: Initialize sbm topology after topology parsing K Prateek Nayak
2026-10-02 9:13 ` sashiko-bot
2026-10-03 8:27 ` Chen Yu
2026-10-04 6:17 ` K Prateek Nayak
2026-10-07 3:52 ` [RFC PATCH v3.1 " K Prateek Nayak
2026-10-01 19:28 ` [RFC PATCH v3 10/13] lib/sbm: Dynamically allocate sbm index when CPU is activated K Prateek Nayak
2026-10-02 9:13 ` sashiko-bot
2026-10-01 19:28 ` [RFC PATCH v3 11/13] lib/sbm: Add helpers to allocate, set, clear, and traverse the bits on sbm K Prateek Nayak
2026-10-02 9:13 ` sashiko-bot
2026-10-01 19:28 ` [RFC PATCH v3 12/13] sched/fair: Allocate nohz.idle_cpus_mask during sched_init_smp() K Prateek Nayak
2026-10-02 9:13 ` sashiko-bot
2026-10-01 19:28 ` [RFC PATCH v3 13/13] sched/fair: Switch nohz.idle_cpus to use sbm K Prateek Nayak
2026-10-02 9:13 ` sashiko-bot
2026-10-03 9:10 ` [RFC PATCH v3 00/13] lib, sched: Introduce sparsebitmap (sbm) Chen Yu
2026-10-04 6:13 ` K Prateek Nayak
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=20261002091332.63AD11F00899@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-s390@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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