From: Rob Herring <robh@kernel.org>
To: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Cc: saravanak@kernel.org, akpm@linux-foundation.org,
david@kernel.org, ljs@kernel.org, liam@infradead.org,
vbabka@kernel.org, rppt@kernel.org, surenb@google.com,
mhocko@suse.com, m.szyprowski@samsung.com, robin.murphy@arm.com,
baoquan.he@linux.dev, pasha.tatashin@soleen.com,
pratyush@kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
iommu@lists.linux.dev, kexec@lists.infradead.org
Subject: Re: [PATCH 2/4] of: reserved_mem: keep the reservation when node_init returns -EBUSY
Date: Thu, 19 Nov 2026 15:00:43 -0600 [thread overview]
Message-ID: <20261119210043.GA532410-robh@kernel.org> (raw)
In-Reply-To: <20261103162429.2053989-3-radhey.shyam.pandey@amd.com>
On Tue, Nov 03, 2026 at 09:54:27PM +0530, Radhey Shyam Pandey wrote:
> fdt_init_reserved_mem_node() treats any error from a region's init function
> as "this node is unusable" and calls memblock_phys_free() on the whole
> range, although the range was reserved earlier during the FDT scan by code
> unrelated to that init function. Give -EBUSY the meaning "cannot be used as
> described, but must stay reserved" and skip the release for it. Nothing
> returns -EBUSY from node_init today. The next patch does, to refuse a CMA
> pool overlapping the kernel image, which without this would free
> [_text, _end) rather than protect it.
>
> Suggested-by: Pratyush Yadav (Google) <pratyush@kernel.org>
> Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
> ---
> Changes since RFC:
> - New patch
> ---
> drivers/of/of_reserved_mem.c | 14 ++++++++++++++
> include/linux/of_reserved_mem.h | 5 +++++
> 2 files changed, 19 insertions(+)
>
> diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
> index 0fd1683cba01..d67a2b3a4d44 100644
> --- a/drivers/of/of_reserved_mem.c
> +++ b/drivers/of/of_reserved_mem.c
> @@ -621,6 +621,20 @@ static void __init fdt_init_reserved_mem_node(unsigned long node, const char *un
>
> err = __reserved_mem_init_node(rmem, node);
> if (err != 0 && err != -ENODEV) {
> + /*
> + * The region was reserved before its init function ran, so it
> + * is not ours to release. -EBUSY says the init function is
> + * declining it for a reason that outlives this node; freeing
> + * it would hand the range to the page allocator even though
> + * something else still owns it.
> + */
> + if (err == -EBUSY) {
> + pr_info("node %s init failed, keeping reservation\n",
> + rmem->name);
> + rmem->name = NULL;
> + return;
> + }
I would move this out of the outer 'if' and and make the outer if an
'else if'.
Rob
next prev parent reply other threads:[~2026-11-19 21:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 16:24 [PATCH 0/4] kexec,mm/cma: do not run the next kernel from a fixed-base CMA area Radhey Shyam Pandey
2026-11-03 16:24 ` [PATCH 1/4] kexec: do not place the next kernel in a fixed-address " Radhey Shyam Pandey
2026-11-03 16:24 ` [PATCH 2/4] of: reserved_mem: keep the reservation when node_init returns -EBUSY Radhey Shyam Pandey
2026-11-19 21:00 ` Rob Herring [this message]
2026-11-03 16:24 ` [PATCH 3/4] mm/cma: reject CMA areas that overlap the kernel image Radhey Shyam Pandey
2026-11-04 16:29 ` sashiko-bot
2026-11-08 11:05 ` Mike Rapoport
2026-11-13 13:22 ` Pandey, Radhey Shyam
2026-11-03 16:24 ` [PATCH 4/4] mm/cma: drop the duplicate alignment check in rmem_cma_setup() Radhey Shyam Pandey
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=20261119210043.GA532410-robh@kernel.org \
--to=robh@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=baoquan.he@linux.dev \
--cc=david@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=iommu@lists.linux.dev \
--cc=kexec@lists.infradead.org \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=mhocko@suse.com \
--cc=pasha.tatashin@soleen.com \
--cc=pratyush@kernel.org \
--cc=radhey.shyam.pandey@amd.com \
--cc=robin.murphy@arm.com \
--cc=rppt@kernel.org \
--cc=saravanak@kernel.org \
--cc=surenb@google.com \
--cc=vbabka@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox