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

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


  • To: Oleksandr Tyshchenko <Oleksandr_Tyshchenko@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: "Orzel, Michal" <michal.orzel@xxxxxxx>
  • Date: Thu, 26 Mar 2026 17:50:44 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=epam.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • 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=fZO+WnJWMa9OZKHa76ca+JXDuhCjqEGivfnwkU/mccA=; b=s9K25J2it3L2DEc+NZ9lVeTyjrKAHKdUYwPwsOPeSnI1oHbem4LekBVXIgcPSWLSKEydvty0r8456rdGoWxOsYa0XM9GpLkGES1ceJ1tcV0kmZY2j/G72JWtlWuQt6W7yrrBZKnIFYe/YQ2/msAO2KKxNTfzL63IQHp6CTqJhxOJN822GvhA8zCSPdVAsbnPpOmhidh46Ng8vNfm16yiSlgN+AFGfHRjYKXWyLJn4fc8PNWoX0ApQOJ5fqZTGF4pSdJ11Y10xMzyJws4Uulypgek0UAdrn7PB6Ohy34Nuf9Sk78FMjwC3UIoo2jGH5nKHBMHrqC8kUPyA7xssrp4oA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WAc/kr4qwdEjbV3wXfcQ8qeaDIAWmzLMK4LxON1pEceXilUQtffRbrC0647lOHag+1/Qb7vdzNv84hdYSqwXRoJf/bDCqdbA9IcLvu8lTOA0l8MpKewHULJHan1XVsRaE4bsFZZHfxuLDNL4rNuhOL2vqlEImAgEyXUf4i5SIqxoHPTe4JTnZk+EOwLyBLMudr3yC2n6zphQlh9NfxAvlh5eRbJBtLVLvfRUv5deVAVm/MWbULhvLzkTs2M9DeL5gSzwuHOsDrpdeHHUA8aAX9aiWjqVbqQg/huv0RJbC8Qf9mzC38RLXXinkT196dVoI+DdhwILher1lO90bzkiIg==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=amd.com header.i="@amd.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Thu, 26 Mar 2026 16:51:01 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 26/03/2026 14:15, Oleksandr Tyshchenko wrote:
> 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()
Where does this extra /memory node come from? If this is for normal reserved
memory regions, they should be present in the host dtb and therefore accounted
by fdt_totalsize (the host dtb should have reserved regions described in /memory
and /reserved-memory. Are you trying to account for static shm regions?

> 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
This comment would want to be updated because since its introduction things have
changed. Even the 128 came up as a result of adding /hypervisor node.

>   * 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)
>  {

~Michal




 


Rackspace

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