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

[PATCH v2] xen/dom0less: arm: fix hwdom 1:1 low memory allocation


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Grygorii Strashko <grygorii_strashko@xxxxxxxx>
  • Date: Tue, 5 Aug 2025 19:00:19 +0000
  • Accept-language: en-US
  • 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=lOTYkfNxKLpeG0ARDLowPGb0KiB3tfLrFWnPYBRiem4=; b=r+JNInC40g/cLM+SLqxJ/s6+gey/wBHigbkQ3e+YFyLyIiNDvHgXkoPSrIetUJ4OcRUYxjFuP6DW+dDlJElobOzXpPcUYdN1plVwPeaqxdPw9QSVcsp07suVsPqqGUhuhRsbwtmoR4EUImsUCDBQd7LJgdVOZ06wUFlfzm63Ceqz1hdlV767AA+XQPG4qiNNLaO9qGqxFr2Wj89f3hx+4nUHRRo/6Fi8sOf/UJDlT/jJ8JZxvjMukzJc+ZweCx+jn7aGox3kohEHd27Q+H6r5o1t+gBibj4O2dnV5NVfcOpCxzYdX6XNG1VEDn/neVcEo/CtBKSqSW/DgMHCjXUTqg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Oe0UwB3HQLxorOoxNHmp9ns6LuJT3Y4dUv1jRF3UtpMBRtTRTzjVh//MizSFYb3rtibsnGurrXW1D8z6kF8II9wplbyI05502xNS6VFATF4847L5L+eVMpXq3goSi8VOLyLZgBKqRUzrlQ3lDKcm0iC2zDoBaodP0iuJoTCTm6iTE5WWh0cF/MRbCkowIx2+PsNuziuHC7cch27udlcOFkBqOjYJHFGfHVppFU33RyExc6uKMvsiB61bRfie0l28diItouChNM7Ja04I0339jI+CIuGTmMOMXyfBS5tOcsRy4nyX8tm+tqzA+2tOBfRVKSTKB8iexBmpNRBna3VftQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Grygorii Strashko <grygorii_strashko@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Denis Mukhin <dmukhin@xxxxxxxx>, Jason Andryuk <jason.andryuk@xxxxxxx>
  • Delivery-date: Tue, 05 Aug 2025 19:00:35 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHcBjsvROW9CE6cS0mI5regAJMadA==
  • Thread-topic: [PATCH v2] xen/dom0less: arm: fix hwdom 1:1 low memory allocation

From: Grygorii Strashko <grygorii_strashko@xxxxxxxx>

Call stack for dom0less hwdom case (1:1) memory:
create_domUs
|-construct_domU
  |-construct_hwdom()
    |-allocate_memory_11()

And allocate_memory_11() uses "dom0_mem" as:
min_low_order =
  get_order_from_bytes(min_t(paddr_t, dom0_mem, MB(128)));

In case of dom0less boot the "dom0_mem" is not used and defaulted to 0,
which causes min_low_order to get high value > order and so no allocations
happens from low memory.

Fix it, by using kinfo->unassigned_mem instead of "dom0_mem" has correct
memory size in both cases: regular dom0 boot and dom0less boot.

Fixes: 52cb53f1816a ("xen/arm: dom0less hwdom construction")
Signed-off-by: Grygorii Strashko <grygorii_strashko@xxxxxxxx>
Reviewed-by: Denis Mukhin <dmukhin@xxxxxxxx>
Reviewed-by: Jason Andryuk <jason.andryuk@xxxxxxx>
---
Changes in v2:
- changed 'fixes' tag
- fixed comment for allocate_memory_11()
- added reviewer's tags

 xen/arch/arm/domain_build.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 463ae4474d30..a9e4153e3cf9 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -249,7 +249,7 @@ fail:
  *
  * We first allocate the largest allocation we can as low as we
  * can. This then becomes the first bank. This bank must be at least
- * 128MB (or dom0_mem if that is smaller).
+ * 128MB (or memory size requested for domain if that is smaller).
  *
  * Then we start allocating more memory, trying to allocate the
  * largest possible size and trying smaller sizes until we
@@ -278,7 +278,7 @@ static void __init allocate_memory_11(struct domain *d,
                                       struct kernel_info *kinfo)
 {
     const unsigned int min_low_order =
-        get_order_from_bytes(min_t(paddr_t, dom0_mem, MB(128)));
+        get_order_from_bytes(min_t(paddr_t, kinfo->unassigned_mem, MB(128)));
     const unsigned int min_order = get_order_from_bytes(MB(4));
     struct membanks *mem = kernel_info_get_mem(kinfo);
     struct page_info *pg;
-- 
2.34.1



 


Rackspace

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