mbox series

[v2,0/4] Guest magic region allocation for 11 Dom0less domUs - Take two

Message ID 20240511005611.83125-1-xin.wang2@amd.com (mailing list archive)
Headers show
Series Guest magic region allocation for 11 Dom0less domUs - Take two | expand

Message

Henry Wang May 11, 2024, 12:56 a.m. UTC
Hi all,

This series is trying to fix the reported guest magic region allocation
issue for 11 Dom0less domUs, an error message can seen from the
init-dom0less application on 1:1 direct-mapped Dom0less DomUs:
```
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.

In [1] I've tried to fix this issue by the domctl approach, and
discussions in [2] and [3] indicates that a domctl is not really
necessary, as we can simplify the issue to "allocate the Dom0less
guest magic regions at the Dom0less DomU build time and pass the
region base PFN to init-dom0less application". Therefore, the first
patch in this series will allocate magic pages for Dom0less DomUs,
the second patch will store the allocated region base PFN to HVMOP
params like HVM_PARAM_CALLBACK_IRQ, and the third patch uses the
HVMOP to get the stored guest magic region base PFN to avoid hardcoding
GUEST_MAGIC_BASE. The last patch will update documentation.

Gitlab CI for this series can be found in [4].

[1] https://lore.kernel.org/xen-devel/20240409045357.236802-1-xin.wang2@amd.com/
[2] https://lore.kernel.org/xen-devel/c7857223-eab8-409a-b618-6ec70f6165aa@apertussolutions.com/
[3] https://lore.kernel.org/xen-devel/alpine.DEB.2.22.394.2404251508470.3940@ubuntu-linux-20-04-desktop/
[4] https://gitlab.com/xen-project/people/henryw/xen/-/pipelines/1285727622

Henry Wang (4):
  xen/arm: Alloc hypervisor reserved pages as magic pages for Dom0less
    DomUs
  xen/arm: Add new HVM_PARAM_HV_RSRV_{BASE_PFN,SIZE} keys in HVMOP
  tools/init-dom0less: Avoid hardcoding GUEST_MAGIC_BASE
  docs/features/dom0less: Update the late XenStore init protocol

 docs/features/dom0less.pandoc   |  8 ++++---
 tools/helpers/init-dom0less.c   | 40 ++++++++++++++-------------------
 tools/libs/guest/xg_dom_arm.c   |  6 -----
 xen/arch/arm/dom0less-build.c   | 35 +++++++++++++++++++++++++++++
 xen/arch/arm/hvm.c              |  2 ++
 xen/include/public/arch-arm.h   |  6 +++++
 xen/include/public/hvm/params.h | 11 ++++++++-
 7 files changed, 75 insertions(+), 33 deletions(-)