Skip to content

DOMCTL-based guest magic region allocation for 11 domUs

Henry Wang xen-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest5 patches 11 repliesIn review
  2. v34 patches 12 repliesSuperseded

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5xen/domctl, tools: Introduce a new domctl to get guest memory maptools/include/xenctrl.h tools/libs/ctrl/xc_domain.c xen/arch/arm/domain.c +4 more+126 -13 replies
2/5xen/arm: Generalize the extended region finding logicxen/arch/arm/domain_build.c xen/arch/arm/include/asm/domain_build.h xen/arch/arm/include/asm/setup.h+70 -440 replies
3/5xen/arm: Find unallocated spaces for magic pages of direct-mapped domUxen/arch/arm/dom0less-build.c xen/arch/arm/domain_build.c xen/arch/arm/include/asm/domain_build.h +2 more+82 -10 replies
4/5xen/memory, tools: Avoid hardcoding GUEST_MAGIC_BASE in init-dom0lesstools/helpers/init-dom0less.c tools/include/xenctrl.h tools/libs/ctrl/xc_domain.c +2 more+120 -344 replies
5/5tools/libs/ctrl: Simplify xc helpers related to populate_physmap()tools/libs/ctrl/xc_domain.c+62 -1160 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [PATCH v4 0/5] DOMCTL-based guest magic region allocation for 11 domUs

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. Patch 5 is a simple patch to do some code duplication clean-up in xc.

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

Henry Wang (5):
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/libs/ctrl: Simplify xc helpers related to populate_physmap()

 tools/helpers/init-dom0less.c            |  35 ++--
 tools/include/xenctrl.h                  |  11 ++
 tools/libs/ctrl/xc_domain.c              | 204 +++++++++++++----------
 xen/arch/arm/dom0less-build.c            |  11 ++
 xen/arch/arm/domain.c                    |  14 ++
 xen/arch/arm/domain_build.c              | 131 ++++++++++-----
 xen/arch/arm/domctl.c                    |  28 +++-
 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                      |  30 +++-
 xen/include/public/arch-arm.h            |   7 +
 xen/include/public/domctl.h              |  29 ++++
 xen/include/public/memory.h              |   3 +-
 16 files changed, 415 insertions(+), 151 deletions(-)
Signature · 1 line
2.34.1