All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Sang-Heon Jeon" <ekffu200098@gmail.com>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH v2 3/9] of/numa: remove redundant numa_nodes_parsed node_set()
Date: Fri, 03 Jul 2026 04:27:14 +0000	[thread overview]
Message-ID: <20260703042714.DB91A1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260703041329.2797584-4-ekffu200098@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] The function's final return status is order-dependent, improperly shadowing earlier successes if the last evaluated memory node lacks a 'numa-node-id' property.
--

commit a42c5d6d6a0d76bbe5386c6e6e6307393d31c628
Author: Sang-Heon Jeon <ekffu200098@gmail.com>

of/numa: remove redundant numa_nodes_parsed node_set()

This commit simplifies of_numa_parse_memory_nodes() by removing a redundant
node_set() call. The operation is now handled internally by
numa_add_memblk().

> diff --git a/drivers/of/of_numa.c b/drivers/of/of_numa.c
> index cd2dc8e825c92..230d5f628c1b4 100644
> --- a/drivers/of/of_numa.c
> +++ b/drivers/of/of_numa.c
> @@ -59,11 +59,8 @@ 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);
> -		}

[Severity: High]
This is a pre-existing issue, but does this function accidentally return an
error if the last memory node evaluated lacks a NUMA node ID?

Looking at of_numa_parse_memory_nodes(), if the device tree contains multiple
memory nodes and the final iterated node does not have a "numa-node-id"
property, the loop handles it like this:

    for_each_node_by_type(np, "memory") {
        r = of_property_read_u32(np, "numa-node-id", &nid);
        if (r == -EINVAL)
            continue;
        ...

This clobbers the r variable with -EINVAL and continues to the end of the
loop. If this is the last iteration, the loop terminates and the function
returns -EINVAL, discarding prior successful parses.

Could this lead to NUMA initialization failing entirely on valid system
configurations and falling back to a single node?

>  
>  		if (!i || r) {
>  			of_node_put(np);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260703041329.2797584-1-ekffu200098@gmail.com?part=3

  reply	other threads:[~2026-07-03  4:27 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-03  4:13 [PATCH v2 0/9] treewide, numa_memblks: remove redundant work during NUMA init Sang-Heon Jeon
2026-07-03  4:13 ` [PATCH v2 1/9] mm: numa_memblks: set numa_nodes_parsed in numa_add_memblk() Sang-Heon Jeon
2026-07-03  4:13 ` [PATCH v2 2/9] ACPI: NUMA: remove redundant numa_nodes_parsed node_set() Sang-Heon Jeon
2026-07-06 17:57   ` Rafael J. Wysocki (Intel)
2026-07-07  5:42     ` Mike Rapoport
2026-07-03  4:13 ` [PATCH v2 3/9] of/numa: " Sang-Heon Jeon
2026-07-03  4:27   ` sashiko-bot [this message]
2026-07-03  4:51     ` Sang-Heon Jeon
2026-07-03  4:13 ` [PATCH v2 4/9] x86/numa: " Sang-Heon Jeon
2026-07-03  4:13 ` [PATCH v2 5/9] arch_numa: " Sang-Heon Jeon
2026-07-03  4:13 ` [PATCH v2 6/9] LoongArch: " Sang-Heon Jeon
2026-07-03  4:13 ` [PATCH v2 7/9] mm: numa_memblks: remove redundant numa_nodemask_from_meminfo() Sang-Heon Jeon
2026-07-03  4:13 ` [PATCH v2 8/9] arch_numa: remove redundant node_possible_map assignment Sang-Heon Jeon
2026-07-03  4:13 ` [PATCH v2 9/9] mm: numa_memblks: use numa_add_reserved_memblk() in numa_cleanup_meminfo() Sang-Heon Jeon
2026-07-03  9:43 ` [PATCH v2 0/9] treewide, numa_memblks: remove redundant work during NUMA init Mike Rapoport

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=20260703042714.DB91A1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=ekffu200098@gmail.com \
    --cc=robh@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 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.