Thread (1 message) 1 message, 1 author, 2014-11-25

Re: [PATCH] of/fdt: memblock_reserve /memreserve/ regions in the case of partial overlap

From: Rob Herring <hidden>
Date: 2014-11-25 19:31:58

On Tue, Nov 25, 2014 at 8:37 AM, Grant Likely [off-list ref] wrote:
On Tue, 25 Nov 2014 12:54:55 +0000
, Ian Campbell [off-list ref]
 wrote:
quoted
memblock_is_region_reserved() returns true in the case of a partial
overlap, meaning that the current code fails to reserve the
non-overlapping portion.

I observed this causing a Midway system with a buggy fdt (the header
declares itself to be larger than it really is) failing to boot
because the over-inflated size of the fdt was causing it to seem to
run into the swapper_pg_dir region, meaning the DT wasn't reserved.
The symptoms were failing to find an disks or network and failing to
boot. I think it is work printing a warning in this case.

However given the ambiguity of whether things like the initrd are
covered by /memreserve/ and similar I think it is best to also
register the region rather than just ignoring it.

Since memblock_reserve() handles overlaps just fine lets just warn and
carry on.

Signed-off-by: Ian Campbell <redacted>
Cc: Grant Likely <redacted>
Cc: Rob Herring <redacted>
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---
 drivers/of/fdt.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 30e97bc..4f0f24c 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -965,7 +965,8 @@ int __init __weak early_init_dt_reserve_memory_arch(phys_addr_t base,
                                      phys_addr_t size, bool nomap)
 {
      if (memblock_is_region_reserved(base, size))
-             return -EBUSY;
+             pr_warning("DT reserved region at 0x%pa is already reserved\n",
+                        &base);
Since memblock_remove/reserve does the right thing anyway, let's just
drop the test entirely.
If the region completely overlaps, then I agree it is okay to be
quiet. But if we have partially overlapping region already with the
dtb, then we should warn here. We want to know if someone passes a dtb
that is too big.

Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help