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

[Xen-devel] [PATCH] xen/arm: add warning if memory modules overlap


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Brian Woods <brian.woods@xxxxxxxxxx>
  • Date: Wed, 9 Oct 2019 12:47:27 -0700
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.60.83) smtp.rcpttodomain=epam.com smtp.mailfrom=xilinx.com; dmarc=bestguesspass action=none header.from=xilinx.com; dkim=none (message not signed); arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lWBpE0pKeR2Jk4Lh4QmLckDhf4gzK1hkXZqsFTE2UVU=; b=LM6Xts8uZ1/3tfz2ibCTk9lW+AR1M6PTqhE1nST3nCqt1HEFsspPBq4O9rQGvPyLZ4N/Gai6WFkiPp/uTMW2klU+YM14/g1hrT3wbXRfWM6AtNcfTxCuXhJ2Q0VSMu2s9p2ZdRd2lkCgRXDk7FV38Csxm6RtqDc5RIFvjrfynsgxko/estFM6/soKH/h35TR7E4NRiVDywoTBXf7OraCLXUNkXB8wT4l4Gc4soADRepB2T0U+owGWxCtvpngAATEY9+r2PaGuEw20msbagj36rgeaf9rxk67CK+480f/qE3oO5oBzh70msY9NI3/zW7J2J02M7AsC0VH51rMI25Dxw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O0O59CdmHuwlkmz6l8qipzEGoGk1EEk54oC1rio4SLb1yBOXUjofn+B9kud+y7/xC0Zc2fUG3mqBmOABFKVyLDyM5AFIan/+IvII6qVXhfYZ4uTmWos81ov+1o7uQ+QPYr2/LRooCiU4q0T75RsSv0cACvE2KXNUzrfYwAHznf1cM9T2zOTLqZRyFDtSuEPQuN5VBySOtLzLGMVFYtV7TwCZpza3MfXsMboANoZMMiugTAmBV7HXk+Fm3Lo+NFMHcv7aOm9r0LlBmFbQgLv+glptPAYYghqvy+stqbkpcyo+bLe/p7SOLAlO9jxOJZHICO+7ZP/p6mCe2iDBExjB7A==
  • Authentication-results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; epam.com; dkim=none (message not signed) header.d=none;epam.com; dmarc=bestguesspass action=none header.from=xilinx.com;
  • Cc: Brian Woods <brian.woods@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Wed, 09 Oct 2019 19:48:51 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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@xxxxxxxxxx>
---
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@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.