Re: [PATCH] of: fdt: Check overlap of reserved memory regions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 11, 2022 at 07:34:00PM +0100, Rob Herring wrote:
> On Tue, Jan 11, 2022 at 6:25 AM Mårten Lindahl <marten.lindahl@xxxxxxxx> wrote:

Hi Rob!
Thanks for looking at this.
> >
> > 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?
> 
Yes, it can potentially be noisy if doing so. But I think notifying this
can be useful. Should it perhaps be a notification instead of a warning?

Kind regards
Mårten
> >
> > Signed-off-by: Mårten Lindahl <marten.lindahl@xxxxxxxx>
> > ---
> >  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
> >



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux