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

[PATCH] xen/arm: Increase DOM0_FDT_EXTRA_SIZE to support max reserved memory banks


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Oleksandr Tyshchenko <Oleksandr_Tyshchenko@xxxxxxxx>
  • Date: Thu, 26 Mar 2026 13:15:36 +0000
  • Accept-language: en-US, ru-RU
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hBA45rH/iUDhuUY3wYV77y73MaL2jmNL3rTz0lBSRcY=; b=yWEpnua3vsbM5AfHOOVJoXNyuMUSLSFFW/ceX7UK6sCqZmhBIFg26rkY2wbonZTYOPUs3yPTvR+o83iLOC2aNaIVee/Z2jL6gqoNUKBk8pQLd8nnI/ghPV7kCLiwkb9d9TuiAU0NYcEy9Gp92YGpbi/NGHfCCSs+A9ixTAxveTrhhL3Pb8NYXz6XSZEbTgXMQL67DRb2lceHL/T7zpiKd3JmK5mS0KXZdj4ycO9jW8VaQVDyXgXSfKhoLrvsbtLksre7FeSSwyYhIQ+MfH8CCmUdlAFvrxpObZ7SZiet+uK0ife6OvieFI7ZW8g996NO7uWhSJ5TZHCS3/HOnukNUg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wdZ39SUTbUowxV36x/kD2WxgoRcsf7mB+AnBzChKGV1bBmHQ3klksu5zvYTjGnmqEESk+uc9UFJL/d5sayLlJL9KiCurL6d/ZK8dQmXfVJ/MHweWwxGPJmObs+D3Le6ASQSK72LabTndFMy8nX2ODj13zkBrpQBt2TGmNhlozE1DApzLYqx+VgJVwnVQE5JMDSfvCy4d7xK2mnDU/JMK6H7QASeVkFwx5WYEO+4Q4yHiPGzHX/aoiqh25hV3JNtT/AQDp0F1NEbUxBQp3CNlaSecy3qrB/j4GkcUJgKEy27rmgHkZrWDEiEx8D12C6JqUrHE+bKG/3EHdYvRf0F3Vw==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=epam.com header.i="@epam.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:x-ms-exchange-senderadcheck"
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Thu, 26 Mar 2026 13:15:42 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHcvSKiuRz6O/EU8kCzrBnRPjf18w==
  • Thread-topic: [PATCH] xen/arm: Increase DOM0_FDT_EXTRA_SIZE to support max reserved memory banks

Xen fails to construct the hardware domain's device tree with
FDT_ERR_NOSPACE (-3) when the host memory map is highly fragmented
(e.g., numerous reserved memory regions).

This occurs because DOM0_FDT_EXTRA_SIZE underestimates the space
required for the generated extra /memory node. make_memory_node()
aggregates all reserved regions into a single reg property. With
NR_MEM_BANKS (256) and 64-bit address/size cells, this property
can grow up to 4KB (256 * 16), easily overflowing the allocated
buffer.

Fix this by increasing DOM0_FDT_EXTRA_SIZE to account for
the worst-case size: NR_MEM_BANKS * 16 bytes.

Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>
---
Just to be clear, I have not seen a real-world issue with this.
The issue was observed during testing of limit conditions.
With this patch applied, Xen successfully boots the hardware domain,
exposing 256 reserved memory regions to it (using a synthetically
generated configuration).
---
---
 xen/arch/arm/domain_build.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index e8795745dd..7f9f0f5510 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -100,9 +100,11 @@ int __init parse_arch_dom0_param(const char *s, const char 
*e)
 /*
  * Amount of extra space required to dom0's device tree.  No new nodes
  * are added (yet) but one terminating reserve map entry (16 bytes) is
- * added.
+ * added. Plus space for an extra memory node to cover all possible reserved
+ * memory regions (2 addr cells + 2 size cells).
  */
-#define DOM0_FDT_EXTRA_SIZE (128 + sizeof(struct fdt_reserve_entry))
+#define DOM0_FDT_EXTRA_SIZE (128 + sizeof(struct fdt_reserve_entry) + \
+    (NR_MEM_BANKS * 16))
 
 unsigned int __init dom0_max_vcpus(void)
 {
-- 
2.34.1



 


Rackspace

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