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

Re: [PATCH v5 8/9] xen/arm: introduce legacy dom0less option for xenstore allocation


  • To: Stefano Stabellini <stefano.stabellini@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: "Orzel, Michal" <michal.orzel@xxxxxxx>
  • Date: Thu, 6 Feb 2025 13:08:15 +0100
  • 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=UqGROAZ9/KnJDlwnuw9FL87U90fZXGlq5Ybgk+pDw14=; b=eS72HxT2KCB93dR0AeWRJ5RFivZvzcIZdPktq19+2VzSUqN0z+ELy4/y4vkrdVTTtT7/Eh7j2osD5cJ5vTOXgYR4jaIRM4cnHRqL9TpyP4krvcsL/z2WSmUya4B39SFQadzFrvrKoO7q0qd1ph/aYaFGhJhyIkpNbHMQmupD5KW+XQnOKbcuxZp5+gfsNzcsBChnvhuSkJDiqCp69RK+sPcMZMQs8Ouavvww9wwkgXaWO+T28OiNSL+jdctlIg+KWa4omPcWwAFBPDH+ydXneT3lVAef0aWeS8jwYgJdMU5LvObkRh7rT56FjW1k3frmmgBC4qCl4Mo6flTy7r53KA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=uVdFVXpzmFDeX0/QQR/FBYMZtpC0Kn3JhQnApPtzenJiPbxu+W9TuHUyzojVIyO96GIzpzSRa8Ec7feHlq/4w4cbN/QotoXCCb+900bNGcXXGkoWEQ1cB0VOMRh1ii3sQ60GyyiG4xdYl7BSTRum8yvGtrML69Tfzaoo9EGJOCqhqMuOrNc8yY3tnZOawACgbKE6Wt9hg/kJ8A/6sarDIRSFuRCGJsfmd/ieMTbFWDmamg62rzAZQ0N43cg9JrNAy70wIuNZIsu2G3uxeSRuU1WzTE3bPQnFuFpJYL6BXhpfIg434xGA+VpwpqWrFuqKnCqEGoQe1BCYyH8OATuRnQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: sstabellini@xxxxxxxxxx, bertrand.marquis@xxxxxxx, julien@xxxxxxx, Volodymyr_Babchuk@xxxxxxxx
  • Delivery-date: Thu, 06 Feb 2025 12:08:39 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 06/02/2025 02:08, Stefano Stabellini wrote:
> The new xenstore page allocation scheme might break older unpatches
> Linux kernels that do not check for the Xenstore connection status
> before proceeding with Xenstore initialization.
> 
> Introduce a dom0less configuration option to retain the older behavior,
> which is not compatible with 1:1 mapped guests, but it will work with
The issue is for static domains in general - not only for 1:1 guests.
Static domains without direct map will simply fail on acquire_reserved_page().

> older legacy kernel versions.
> 
> Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxx>
> ---
>  docs/misc/arm/device-tree/booting.txt |  5 +++++
>  xen/arch/arm/dom0less-build.c         | 13 ++++++++++++-
>  xen/arch/arm/include/asm/kernel.h     | 14 +++++++++++---
>  3 files changed, 28 insertions(+), 4 deletions(-)
> 
> diff --git a/docs/misc/arm/device-tree/booting.txt 
> b/docs/misc/arm/device-tree/booting.txt
> index ff70d44462..8fa3da95be 100644
> --- a/docs/misc/arm/device-tree/booting.txt
> +++ b/docs/misc/arm/device-tree/booting.txt
> @@ -222,6 +222,11 @@ with the following properties:
>      Xen PV interfaces, including grant-table and xenstore, will be
>      enabled for the VM.
>  
> +    - "legacy"
> +    Same as above, but the way the xenstore page is allocated is not
> +    compatible with 1:1 mapped guests. On the other hand, it works with
Same remark about 1:1

> +    older Linux kernels.
> +
>      - "disabled"
>      Xen PV interfaces are disabled.
>  
> diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
> index 046439eb87..9afdbca8b8 100644
> --- a/xen/arch/arm/dom0less-build.c
> +++ b/xen/arch/arm/dom0less-build.c
> @@ -799,6 +799,13 @@ static int __init construct_domU(struct domain *d,
>          else
>              panic("At the moment, Xenstore support requires dom0 to be 
> present\n");
>      }
> +    else if ( rc == 0 && !strcmp(dom0less_enhanced, "legacy") )
> +    {
> +        if ( hardware_domain )
> +            kinfo.dom0less_feature = DOM0LESS_ENHANCED_LEGACY;
> +        else
> +            panic("At the moment, Xenstore support requires dom0 to be 
> present\n");
> +    }
>      else if ( rc == 0 && !strcmp(dom0less_enhanced, "no-xenstore") )
>          kinfo.dom0less_feature = DOM0LESS_ENHANCED_NO_XS;
>  
> @@ -848,13 +855,17 @@ static int __init construct_domU(struct domain *d,
>      if ( rc < 0 )
>          return rc;
>  
> -    if ( kinfo.dom0less_feature & DOM0LESS_XENSTORE )
> +    if ( kinfo.dom0less_feature & (DOM0LESS_XENSTORE|DOM0LESS_XS_LEGACY) )
Spaces around | operator.

>      {
>          ASSERT(hardware_domain);
>          rc = alloc_xenstore_evtchn(d);
>          if ( rc < 0 )
>              return rc;
> +        d->arch.hvm.params[HVM_PARAM_STORE_PFN] = ~0ULL;
> +    }
>  
> +    if ( kinfo.dom0less_feature & DOM0LESS_XENSTORE )
> +    {
Can I talk you into moving all of these into separate function e.g. 
alloc_xenstore_params(struct kernel_info *kinfo)?
It would simplify construct_domU() in which we tend to just call functions 
responsible for a given functionality.

>          rc = alloc_xenstore_page(d);
>          if ( rc < 0 )
>              return rc;
> diff --git a/xen/arch/arm/include/asm/kernel.h 
> b/xen/arch/arm/include/asm/kernel.h
> index de3f945ae5..4c2ae0b32b 100644
> --- a/xen/arch/arm/include/asm/kernel.h
> +++ b/xen/arch/arm/include/asm/kernel.h
> @@ -17,16 +17,24 @@
>   *                          default features (excluding Xenstore) will be
>   *                          available. Note that an OS *must* not rely on the
>   *                          availability of Xen features if this is not set.
> - * DOM0LESS_XENSTORE:       Xenstore will be enabled for the VM. This feature
> - *                          can't be enabled without the
> - *                          DOM0LESS_ENHANCED_NO_XS.
> + * DOM0LESS_XENSTORE:       Xenstore will be enabled for the VM. The
> + *                          xenstore page allocation is done by Xen at
> + *                          domain creation. This feature can't be
> + *                          enabled without the DOM0LESS_ENHANCED_NO_XS.
> + * DOM0LESS_XS_LEGACY       Xenstore will be enabled for the VM, the
> + *                          xenstore page allocation will happen in
> + *                          init-dom0less. This feature can't be enabled
> + *                          without the DOM0LESS_ENHANCED_NO_XS.
>   * DOM0LESS_ENHANCED:       Notify the OS it is running on top of Xen. All 
> the
>   *                          default features (including Xenstore) will be
>   *                          available. Note that an OS *must* not rely on the
>   *                          availability of Xen features if this is not set.
> + * DOM0LESS_ENHANCED_LEGACY:Same as before, but using DOM0LESS_XS_LEGACY.
NIT: I would just >> all text by one to have a space after :

>   */
>  #define DOM0LESS_ENHANCED_NO_XS  BIT(0, U)
>  #define DOM0LESS_XENSTORE        BIT(1, U)
> +#define DOM0LESS_XS_LEGACY       BIT(2, U)
> +#define DOM0LESS_ENHANCED_LEGACY (DOM0LESS_ENHANCED_NO_XS | 
> DOM0LESS_XS_LEGACY)
>  #define DOM0LESS_ENHANCED        (DOM0LESS_ENHANCED_NO_XS | 
> DOM0LESS_XENSTORE)
>  
>  struct kernel_info {

Otherwise, patch is ok.

~Michal




 


Rackspace

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