From: Mike Rapoport <rppt@kernel.org>
To: Lucas Tanure <tanure@linux.com>
Cc: Rob Herring <robh+dt@kernel.org>,
Frank Rowand <frowand.list@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, jbrunet@baylibre.com,
linux-amlogic@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
martin.blumenstingl@googlemail.com, narmstrong@baylibre.com,
stefan@agner.ch
Subject: Re: [PATCH v2 1/1] of: fdt: Scan /memreserve/ last
Date: Mon, 10 Apr 2023 19:40:54 +0300 [thread overview]
Message-ID: <ZDQ8FpOtO7UINuFn@kernel.org> (raw)
In-Reply-To: <20230410120017.41664-2-tanure@linux.com>
On Mon, Apr 10, 2023 at 08:00:17AM -0400, Lucas Tanure wrote:
> Change the order of scanning /memreserve/ and /reserved-memory node.
> /reserved-memory node should go first, as it has a more updated
> description of the memory regions and it can apply flags, like nomap.
> Also, /memreserve/ should avoid reserving regions described in
> /reserved-memory node.
>
> Signed-off-by: Lucas Tanure <tanure@linux.com>
> ---
> drivers/of/fdt.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index d1a68b6d03b3..26e608d8025d 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -635,16 +635,21 @@ void __init early_init_fdt_scan_reserved_mem(void)
> if (!initial_boot_params)
> return;
>
> + fdt_scan_reserved_mem();
> + fdt_reserve_elfcorehdr();
> +
> /* Process header /memreserve/ fields */
> for (n = 0; ; n++) {
> fdt_get_mem_rsv(initial_boot_params, n, &base, &size);
> if (!size)
> break;
> + if (memblock_overlaps_region(&memblock.memory, base, size) &&
> + memblock_is_region_reserved(base, size))
> + break;
I don't think this is really needed, it's ok to reserve the same ranges
multiple times.
Both checks are not cheap, so it'll be better to just reserve everything
both from performance and simplicity points of view.
> +
> memblock_reserve(base, size);
> }
>
> - fdt_scan_reserved_mem();
> - fdt_reserve_elfcorehdr();
> fdt_init_reserved_mem();
> }
>
> --
> 2.40.0
>
--
Sincerely yours,
Mike.
prev parent reply other threads:[~2023-04-10 16:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-10 12:00 [PATCH v2 0/1] Fix Random Kernel panic from when fail to reserve memory Lucas Tanure
2023-04-10 12:00 ` [PATCH v2 1/1] of: fdt: Scan /memreserve/ last Lucas Tanure
2023-04-10 12:52 ` Rob Herring
2023-04-10 14:58 ` Lucas Tanure
2023-04-10 16:40 ` Mike Rapoport [this message]
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=ZDQ8FpOtO7UINuFn@kernel.org \
--to=rppt@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=jbrunet@baylibre.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=martin.blumenstingl@googlemail.com \
--cc=narmstrong@baylibre.com \
--cc=robh+dt@kernel.org \
--cc=stefan@agner.ch \
--cc=tanure@linux.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