All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xen-devel] [PATCH] xen/arm: add warning if memory modules overlap
@ 2019-10-09 19:47 Brian Woods
  2019-10-10 15:39 ` Julien Grall
  2019-10-17 20:07 ` [Xen-devel] [PATCH v2] " Brian Woods
  0 siblings, 2 replies; 16+ messages in thread
From: Brian Woods @ 2019-10-09 19:47 UTC (permalink / raw)
  To: xen-devel
  Cc: Brian Woods, Stefano Stabellini, Julien Grall, Volodymyr Babchuk

It's possible for a misconfigured device tree to cause Xen to crash when
there are overlapping addresses in the memory modules.  Add a warning
when printing the addresses to let the user know there's a possible
issue when DEBUG is enabled.

Signed-off-by: Brian Woods <brian.woods@xilinx.com>
---
sample output:
...
(XEN) MODULE[0]: 0000000001400000 - 000000000153b8f1 Xen         
(XEN) MODULE[1]: 00000000076d2000 - 00000000076dc080 Device Tree 
(XEN) MODULE[2]: 00000000076df000 - 0000000007fff364 Ramdisk     
(XEN) MODULE[3]: 0000000000080000 - 0000000003180000 Kernel      
(XEN)  RESVD[0]: 00000000076d2000 - 00000000076dc000
(XEN)  RESVD[1]: 00000000076df000 - 0000000007fff364
(XEN) 
(XEN) WARNING: modules Xen          and Kernel       overlap
(XEN) 
(XEN) Command line: console=dtuart dtuart=serial0 dom0_mem=1G bootscrub=0 maxcpus=1 timer_slop=0
...

 xen/arch/arm/bootfdt.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c
index 08fb59f..3cb0c43 100644
--- a/xen/arch/arm/bootfdt.c
+++ b/xen/arch/arm/bootfdt.c
@@ -387,6 +387,23 @@ static void __init early_print_info(void)
                mem_resv->bank[j].start + mem_resv->bank[j].size - 1);
     }
     printk("\n");
+
+#ifndef NDEBUG
+    /*
+     * Assuming all combinations are checked, only the starting address
+     * has to be checked if it's in another memory module's range.
+     */
+    for ( i = 0 ; i < mods->nr_mods; i++ )
+        for ( j = 0 ; j < mods->nr_mods; j++ )
+            if ( (i != j) &&
+                 (mods->module[i].start >= mods->module[j].start) &&
+                 (mods->module[i].start <
+                  mods->module[j].start + mods->module[j].size) )
+                printk("WARNING: modules %-12s and %-12s overlap\n",
+                       boot_module_kind_as_string(mods->module[i].kind),
+                       boot_module_kind_as_string(mods->module[j].kind));
+#endif
+
     for ( i = 0 ; i < cmds->nr_mods; i++ )
         printk("CMDLINE[%"PRIpaddr"]:%s %s\n", cmds->cmdline[i].start,
                cmds->cmdline[i].dt_name,
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2019-10-18 15:41 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-09 19:47 [Xen-devel] [PATCH] xen/arm: add warning if memory modules overlap Brian Woods
2019-10-10 15:39 ` Julien Grall
2019-10-11 16:43   ` Brian Woods
2019-10-11 16:58     ` Julien Grall
2019-10-11 18:06       ` Brian Woods
2019-10-11 18:17         ` Julien Grall
2019-10-11 19:07           ` Brian Woods
2019-10-17  9:20             ` Julien Grall
2019-10-17 19:48               ` Brian Woods
2019-10-17 20:23                 ` Julien Grall
2019-10-17 20:07 ` [Xen-devel] [PATCH v2] " Brian Woods
2019-10-17 20:34   ` Julien Grall
2019-10-17 21:20     ` Brian Woods
2019-10-17 21:49       ` Julien Grall
2019-10-17 22:34         ` Brian Woods
2019-10-18 15:41           ` Julien Grall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.