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

Re: [PATCH v6 2/7] xen/arm: Alloc XenStore page for Dom0less DomUs from hypervisor


  • To: "Stabellini, Stefano" <stefano.stabellini@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: "Orzel, Michal" <Michal.Orzel@xxxxxxx>
  • Date: Fri, 7 Feb 2025 11:10:54 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.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=vKZrFFRO0E0PIi9tvB7WeaMqhf4SKIUY0el4WGf3yEY=; b=jac1G53NZ38VHSZSa2MPuyNirqt3+wwomzqw5m9G3Jei8ZRO3voT3tcCFOv3k9lQJ2kDEBltGYjyaOrPKwsagNrd19I7D4hVzga553hbyLVtWJWf5rl0j+bMf2WQPdc3enCvD99byEfH1XRnsoH4ujV5JZOZvYBBRWZEK9WkO8J8REcOkLw4d9ySJbnfhJ9gtTYpGXX6Lwan4Olo2RMFQGOzHEJGK2zfqM34Ya3IqmjxF6jA6mL67s21az1W2qT/4rSHQ5qTq8rTRlAa0kqdsrKD55IUWgTQ0RyEl0kjnP9QT3IR/7I4FK4AxmPsKT7MVeo0eFsil789KdQuTPCKUg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=erIVb+16wgq1nn5tQu45zheGGY+NxksASScwBg1pu8z8pkhu0ZoxNmnuDBsVPwcX8V6aZcfVjtN3AQtOIO9HP11kvuYqlrJxoOg2Fah4ucA5PBsPw1gPWnjazHabpPT3y7LRf7/CV9fi9M1nVgokkFBwUla5pPi+xsRJFl2EdBqcVFSvPlux1a8Cyl21mSmjfMYa+JJZQnTwm4nrvHiFUJzKLmhhMV0jCAA/+QNytKcC/yYoSKATWApbqrrnBG0QRwVD6kykHfc0yt2w3st2HIlYEdvTB5HlA/78Er2MMvmCFcsrpsSYP6ygsZZ/HldSupPziDaLq2piiRX3FSaR5Q==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: "sstabellini@xxxxxxxxxx" <sstabellini@xxxxxxxxxx>, "bertrand.marquis@xxxxxxx" <bertrand.marquis@xxxxxxx>, "julien@xxxxxxx" <julien@xxxxxxx>, "Volodymyr_Babchuk@xxxxxxxx" <Volodymyr_Babchuk@xxxxxxxx>, Henry Wang <xin.wang2@xxxxxxx>, Alec Kwapis <alec.kwapis@xxxxxxxxxxxxx>
  • Delivery-date: Fri, 07 Feb 2025 11:11:01 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHbeQMghub2t/SQJ0SB0U0fJ2L5b7M7r+GA
  • Thread-topic: [PATCH v6 2/7] xen/arm: Alloc XenStore page for Dom0less DomUs from hypervisor


On 07/02/2025 02:53, Stefano Stabellini wrote:
> From: Henry Wang <xin.wang2@xxxxxxx>
> 
> There are use cases (for example using the PV driver) in Dom0less
> setup that require Dom0less DomUs start immediately with Dom0, but
> initialize XenStore later after Dom0's successful boot and call to
> the init-dom0less application.
> 
> An error message can seen from the init-dom0less application on
> 1:1 direct-mapped domains:
> ```
> Allocating magic pages
> memory.c:238:d0v0 mfn 0x39000 doesn't belong to d1
> Error on alloc magic pages
> ```
> 
> The "magic page" is a terminology used in the toolstack as reserved
> pages for the VM to have access to virtual platform capabilities.
> Currently the magic pages for Dom0less DomUs are populated by the
> init-dom0less app through populate_physmap(), and populate_physmap()
> automatically assumes gfn == mfn for 1:1 direct mapped domains. This
> cannot be true for the magic pages that are allocated later from the
> init-dom0less 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.
> 
> Since for init-dom0less, the magic page region is only for XenStore.
> To solve above issue, this commit allocates the XenStore page for
> Dom0less DomUs at the domain construction time. The PFN will be
> noted and communicated to the init-dom0less application executed
> from Dom0. To keep the XenStore late init protocol, set the connection
> status to XENSTORE_RECONNECT.
> 
> Since the guest magic region allocation from init-dom0less is for
> XenStore, and the XenStore page is now allocated from the hypervisor,
> instead of hardcoding the guest magic pages region, use
> xc_hvm_param_get() to get the XenStore page PFN. Rename alloc_xs_page()
> to get_xs_page() to reflect the changes.
> 
> With this change, some existing code is not needed anymore, including:
> (1) The definition of the XenStore page offset.
> (2) Call to xc_domain_setmaxmem() and xc_clear_domain_page() as we
>     don't need to set the max mem and clear the page anymore.
> (3) Foreign mapping of the XenStore page, setting of XenStore interface
>     status and HVM_PARAM_STORE_PFN from init-dom0less, as they are set
>     by the hypervisor.
> 
> Take the opportunity to do some coding style improvements when possible.
> 
> Reported-by: Alec Kwapis <alec.kwapis@xxxxxxxxxxxxx>
> Signed-off-by: Henry Wang <xin.wang2@xxxxxxx>
> Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxx>
Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>

I tested all 3 configurations: regular domU and static mem domU w\o direct map:
Tested-by: Michal Orzel <michal.orzel@xxxxxxx>

~Michal


 


Rackspace

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