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

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


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>, "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>
  • From: Henry Wang <xin.wang2@xxxxxxx>
  • Date: Fri, 26 Apr 2024 13:22:41 +0800
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.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=6vytwGUy1hKWudBKRSbCfWm3aCFgq/b6/j8kTZ5XFk8=; b=a9KpNPj5STlfvRX5VK7Vf9bICxj6o5Zw2X/27yY+zLdZ1yve1sB/E+RpuUiCwJLU7wdTrqhP0WiuNEhji3gqxKhRayaUmFUM4clkBbBjYVXY7pZE2gr8F23itnAYjUjmXHQnkOv/H3spiZEKgIqbghcaU76Kuvl/9mLKKkc1P3A6RLxf8xjjmEEzuS5UtafxMro4zC2QlL59f2uiH3KLkHCN3tPdH++LvWYLcvoyfk/7mvqxobPJE5Ex3t0+IjlSox/+kpNIJJkuH3KdVCPmJvo/irFrd9dRJpyhufUA8qR2JS/ZqLzHFDBYC9PV8MPVvRpX5wbz9f70rrWGLAXCog==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HYC6MU45rgYhWaaeQbl3aYprubnLAtuYb7YujmFjiX3FN/UOpM76W8HUEMoQUJPkdoyA3b5Hpei/p2coO65poDElnTvjCqsYalkXV2LOC0Xps8VAQCq5VA89ofuGM/9crNFHp3wIAL11EDdool2P8LB72taHHSfQZjqM15bNZ1qRFMyDFZYOwFmk5nNbSqQN3Gh2SiKq7uTazvNVHDoDvV7L404qKTMqN/lnsxlSt6gXdyeiqGDEs1r66qZer6bY1ftId1L+PJBFfo9Vd0+COA6aY7uO2fi9nVEvMGNioxWgUZbPVaePIKkJ6dSiA32USqf5mMb/f6J01uPO+UtaHg==
  • Cc: <xen-devel@xxxxxxxxxxxxxxxxxxxx>, 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>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, "Volodymyr Babchuk" <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Fri, 26 Apr 2024 05:23:02 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hi Stefano, Daniel,

On 4/26/2024 6:18 AM, Stefano Stabellini wrote:
On Thu, 18 Apr 2024, Daniel P. Smith wrote:
On 4/9/24 00:53, Henry Wang wrote:
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.
Hey Henry,

To help provide some perspective, these issues are not experienced with
hyperlaunch. This is because we understood early on that you cannot move a
lightweight version of the toolstack into hypervisor init and not provide a
mechanism to communicate what it did to the runtime control plane. We
evaluated the possible mechanism, to include introducing a new hypercall op,
and ultimately settled on using hypfs. The primary reason is this information
is static data that, while informative later, is only necessary for the
control plane to understand the state of the system. As a result, hyperlaunch
is able to allocate any and all special pages required as part of domain
construction and communicate their addresses to the control plane. As for XSM,
hypfs is already protected and at this time we do not see any domain builder
information needing to be restricted separately from the data already present
in hypfs.

I would like to make the suggestion that instead of continuing down this path,
perhaps you might consider adopting the hyperlaunch usage of hypfs. Then
adjust dom0less domain construction to allocate the special pages at
construction time. The original hyperlaunch series includes a patch that
provides the helper app for the xenstore announcement. And I can provide you
with updated versions if that would be helpful.
I also think that the new domctl is not needed and that the dom0less
domain builder should allocate the magic pages.

Yes this is indeed much better. Thanks Daniel for suggesting this.

On ARM, we already
allocate HVM_PARAM_CALLBACK_IRQ during dom0less domain build and set
HVM_PARAM_STORE_PFN to ~0ULL. I think it would be only natural to extend
that code to also allocate the magic pages and set HVM_PARAM_STORE_PFN
(and others) correctly. If we do it that way it is simpler and
consistent with the HVM_PARAM_CALLBACK_IRQ allocation, and we don't even
need hypfs. Currently we do not enable hypfs in our safety
certifiability configuration.

It is indeed very important to consider the safety certification (which I completely missed). Therefore I've sent an updated version based on HVMOP [1]. In the future we can switch to hypfs if needed.

[1] https://lore.kernel.org/xen-devel/20240426031455.579637-1-xin.wang2@xxxxxxx/

Kind regards,
Henry




 


Rackspace

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