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

[PATCH v3 0/4] DOMCTL-based guest magic region allocation for 11 domUs


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Henry Wang <xin.wang2@xxxxxxx>
  • Date: Wed, 3 Apr 2024 16:16:22 +0800
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org 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=arcselector9901; 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=shwxAnYik38Fuwf+xRsQq+WZDXb5Gq5iIlZdElM45SI=; b=km+cCAZ0ktSsiNpQrd2uYHoM7OO/7lZuMQ5xc0Se0P+/EAy8ZMt9sbGRIlbOMeNXfB/gkR8L1JjmV8GeAf0Aqj3jqaAi1MyR7BbYpNrcYmpxijpkJo1G1BBCrzREzVZZevdbdyBJhHvS575seBkiNcWCLvNMjl1g1W1QrNFQ1rNd9ds6FKvXG/VoKC3tI5wWWAQys90EbDgvAipLu3vZM2Fncr+NR/q7kCtLgatA2xvkoaImRvtkVyxXMqU6LDciSeEcm7mLNsyL5LVNPU/ZOOG8A6I0EnIkcthSkqsSvczWDvEaU/vy6L3oiBQjBHi4ErqYTzDN/28DBoYA7lAHBA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nnjP4XEDgfg4oEAthI6FZk80NTl2MV+iyD3OSqK++BJ2EFN3xeLBnpBNcrDpsOQbyWGizm0L/Mj29Uc/1MldHVOoyGXm0g8r8U0JqRXvaPseAjB0ehjaeTnDi+2z/avlScXepwx618Dsy/p8A6XX1ZkfobaCi9/yhsJcJC1b0mHYcBI54EvGDk9MG9ybS9jq4hH8jjLpxFJ/EdVH9oFwgkybH3MVTc1+0OcWGQUMQmq1ZS3l6bOhm75eWBqhPAc/y0ls3GhMcMdTg9Qoit+5oHZN7gdHc8WHdxBfTVGzqs0Weg9givXi4G7o8yucZJvihziIOL07LVKRrrTT0yFCLg==
  • Cc: Henry Wang <xin.wang2@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, "Jan Beulich" <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, "Stefano Stabellini" <sstabellini@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, "Volodymyr Babchuk" <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Wed, 03 Apr 2024 08:16:46 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

An error message can seen from the init-dom0less application on
direct-mapped 1:1 domains:
```
Allocating magic pages
memory.c:238:d0v0 mfn 0x39000 doesn't belong to d1
Error on alloc magic pages
```

This is because populate_physmap() automatically assumes gfn == mfn
for direct mapped domains. This cannot be true for the magic pages
that are allocated later for 1:1 Dom0less DomUs from the init-dom0less
helper application executed in Dom0. For domain using statically
allocated memory but not 1:1 direct-mapped, similar error "failed to
retrieve a reserved page" can be seen as the reserved memory list
is empty at that time.

This series tries to fix this issue using a DOMCTL-based approach,
because for 1:1 direct-mapped domUs, we need to avoid the RAM regions
and inform the toolstack about the region found by hypervisor for
mapping the magic pages. Patch 1 introduced a new DOMCTL to get the
guest memory map, currently only used for the magic page regions.
Patch 2 generalized the extended region finding logic so that it can
be reused for other use cases such as finding 1:1 domU magic regions.
Patch 3 uses the same approach as finding the extended regions to find
the guest magic page regions for direct-mapped DomUs. Patch 4 avoids
hardcoding all base addresses of guest magic region in the init-dom0less
application by consuming the newly introduced DOMCTL.

Gitlab pipeline for this series:
https://gitlab.com/xen-project/people/henryw/xen/-/pipelines/1238005196

Henry Wang (4):
  xen/domctl, tools: Introduce a new domctl to get guest memory map
  xen/arm: Generalize the extended region finding logic
  xen/arm: Find unallocated spaces for magic pages of direct-mapped domU
  xen/memory, tools: Avoid hardcoding GUEST_MAGIC_BASE in init-dom0less

 tools/helpers/init-dom0less.c            |  36 +++++--
 tools/include/xenctrl.h                  |   4 +
 tools/libs/ctrl/xc_domain.c              |  33 ++++++
 xen/arch/arm/dom0less-build.c            |  11 ++
 xen/arch/arm/domain.c                    |  15 +++
 xen/arch/arm/domain_build.c              | 131 +++++++++++++++--------
 xen/arch/arm/domctl.c                    |  32 +++++-
 xen/arch/arm/include/asm/domain.h        |   8 ++
 xen/arch/arm/include/asm/domain_build.h  |   4 +
 xen/arch/arm/include/asm/setup.h         |   5 +
 xen/arch/arm/include/asm/static-memory.h |   7 ++
 xen/arch/arm/static-memory.c             |  39 +++++++
 xen/common/memory.c                      |  22 +++-
 xen/include/public/arch-arm.h            |  11 ++
 xen/include/public/domctl.h              |  27 +++++
 xen/include/public/memory.h              |   5 +
 xen/include/xen/mm.h                     |   7 ++
 17 files changed, 339 insertions(+), 58 deletions(-)

-- 
2.34.1




 


Rackspace

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