From: Mike Rapoport <rppt@kernel.org>
To: Yin Tirui <yintirui@huawei.com>
Cc: robh@kernel.org, saravanak@google.com, dan.j.williams@intel.com,
akpm@linux-foundation.org, david@redhat.com,
Jonathan.Cameron@huawei.com, devicetree@vger.kernel.org,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
wangkefeng.wang@huawei.com, chenjun102@huawei.com
Subject: Re: [PATCH v2] of_numa: fix uninitialized memory nodes causing kernel panic
Date: Sun, 17 Aug 2025 09:27:33 +0300 [thread overview]
Message-ID: <aKF2VZ1y8OuEChmw@kernel.org> (raw)
In-Reply-To: <20250816073131.2674809-1-yintirui@huawei.com>
Hi,
On Sat, Aug 16, 2025 at 03:31:31PM +0800, Yin Tirui wrote:
> When the number of CPUs is fewer than the number of memory nodes,
> some memory nodes may not be properly initialized because they are
> not added to numa_nodes_parsed during memory parsing.
Why the issue happens when there are less CPUs than nodes?
Does anything updates numa_nodes_parsed when there are more CPUs than
nodes?
> In of_numa_parse_memory_nodes(), after successfully adding a memory
> block via numa_add_memblk(), the corresponding node ID should be
> marked as parsed. However, the current implementation in numa_add_memblk()
... current implementation of of_numa_parse_memory_nodes()?
> only adds the memory block to numa_meminfo but fails to update
maybe "... but skips updating"
> numa_nodes_parsed, leaving some nodes uninitialized.
>
> During boot in a QEMU-emulated ARM64 NUMA environment, the kernel
> panics when free_area_init() attempts to access NODE_DATA() for
> memory nodes that were uninitialized.
>
> [ 0.000000] Call trace:
> [ 0.000000] free_area_init+0x620/0x106c (P)
> [ 0.000000] bootmem_init+0x110/0x1dc
> [ 0.000000] setup_arch+0x278/0x60c
> [ 0.000000] start_kernel+0x70/0x748
> [ 0.000000] __primary_switched+0x88/0x90
Would have be nice to have the full crash trace here and more details how
qemu was run.
> Cc: stable@vger.kernel.org
> Fixes: 767507654c22 ("arch_numa: switch over to numa_memblks")
> Signed-off-by: Yin Tirui <yintirui@huawei.com>
>
> ---
>
> v2: Move the changes to the of_numa related. Correct the fixes tag.
> ---
> drivers/of/of_numa.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/of/of_numa.c b/drivers/of/of_numa.c
> index 230d5f628c1b..cd2dc8e825c9 100644
> --- a/drivers/of/of_numa.c
> +++ b/drivers/of/of_numa.c
> @@ -59,8 +59,11 @@ static int __init of_numa_parse_memory_nodes(void)
> r = -EINVAL;
> }
>
> - for (i = 0; !r && !of_address_to_resource(np, i, &rsrc); i++)
> + for (i = 0; !r && !of_address_to_resource(np, i, &rsrc); i++) {
> r = numa_add_memblk(nid, rsrc.start, rsrc.end + 1);
> + if (!r)
> + node_set(nid, numa_nodes_parsed);
> + }
>
> if (!i || r) {
> of_node_put(np);
> --
> 2.43.0
>
--
Sincerely yours,
Mike.
next prev parent reply other threads:[~2025-08-17 6:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-16 7:31 [PATCH v2] of_numa: fix uninitialized memory nodes causing kernel panic Yin Tirui
2025-08-17 6:27 ` Mike Rapoport [this message]
2025-08-18 2:33 ` 印体锐
2025-08-18 7:43 ` David Hildenbrand
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=aKF2VZ1y8OuEChmw@kernel.org \
--to=rppt@kernel.org \
--cc=Jonathan.Cameron@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=chenjun102@huawei.com \
--cc=dan.j.williams@intel.com \
--cc=david@redhat.com \
--cc=devicetree@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=robh@kernel.org \
--cc=saravanak@google.com \
--cc=wangkefeng.wang@huawei.com \
--cc=yintirui@huawei.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;
as well as URLs for NNTP newsgroup(s).