From: Rob Herring <robh+dt@kernel.org>
To: "Mårten Lindahl" <marten.lindahl@axis.com>,
"Stephen Boyd" <swboyd@chromium.org>
Cc: Frank Rowand <frowand.list@gmail.com>,
Kees Cook <keescook@chromium.org>,
Anton Vorontsov <anton@enomsg.org>,
Colin Cross <ccross@android.com>, Tony Luck <tony.luck@intel.com>,
kernel <kernel@axis.com>,
devicetree@vger.kernel.org
Subject: Re: [PATCH] of: fdt: Check overlap of reserved memory regions
Date: Tue, 11 Jan 2022 12:34:00 -0600 [thread overview]
Message-ID: <CAL_JsqLbYmxtG8w7aDxR9kZL3TvhZXyPy3fvPuiqmHa3c8ewJQ@mail.gmail.com> (raw)
In-Reply-To: <20220111122111.3869046-1-marten.lindahl@axis.com>
On Tue, Jan 11, 2022 at 6:25 AM Mårten Lindahl <marten.lindahl@axis.com> wrote:
>
> If a DT specified reserved memory region overlaps an already registered
> reserved region no notification is made. Starting the system with
> overlapped memory regions can make it very hard to debug what is going
> wrong. This is specifically true in case the ramoops console intersects
> with initrd since the console overwrites memory that is used for initrd,
> which leads to memory corruption.
>
> Highlight this by printing a message about overlapping memory regions.
Won't this be noisy if a region is described in both /memreserve/ and
/reserved-memory node?
>
> Signed-off-by: Mårten Lindahl <marten.lindahl@axis.com>
> ---
> drivers/of/fdt.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index bdca35284ceb..c6b88a089b35 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -521,6 +521,11 @@ static int __init __reserved_mem_reserve_reg(unsigned long node,
> base = dt_mem_next_cell(dt_root_addr_cells, &prop);
> size = dt_mem_next_cell(dt_root_size_cells, &prop);
>
> + if (size && memblock_is_reserved(base)) {
> + pr_warn("WARNING: 0x%08llx+0x%08llx overlaps reserved memory region\n",
> + (u64)base, (u64)size);
> + }
> +
> if (size &&
> early_init_dt_reserve_memory_arch(base, size, nomap) == 0)
> pr_debug("Reserved memory: reserved region for node '%s': base %pa, size %lu MiB\n",
> --
> 2.30.2
>
next prev parent reply other threads:[~2022-01-11 18:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-11 12:21 [PATCH] of: fdt: Check overlap of reserved memory regions Mårten Lindahl
2022-01-11 18:34 ` Rob Herring [this message]
2022-01-13 15:56 ` Marten Lindahl
2022-01-13 22:12 ` Stephen Boyd
2022-01-17 16:00 ` Marten Lindahl
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=CAL_JsqLbYmxtG8w7aDxR9kZL3TvhZXyPy3fvPuiqmHa3c8ewJQ@mail.gmail.com \
--to=robh+dt@kernel.org \
--cc=anton@enomsg.org \
--cc=ccross@android.com \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=keescook@chromium.org \
--cc=kernel@axis.com \
--cc=marten.lindahl@axis.com \
--cc=swboyd@chromium.org \
--cc=tony.luck@intel.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).