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

Re: [PATCH v3 6/7] xen: introduce Kconfig ARCH_PAGING_MEMPOOL


  • To: Luca Fancellu <luca.fancellu@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: "Orzel, Michal" <michal.orzel@xxxxxxx>
  • Date: Tue, 18 Mar 2025 10:11:58 +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=kLPPgGTK9HylPVrOwJYuBNxEb/0iuNwnUEvckPcU/ns=; b=WqorycOOuMPJC7kJNIww7dSoNyC+ZJ5qMHSby+lXQfq/tW11cSovQU1okTzHBKj/pJvtsLrdsDLboZOhma4bNATVZJa4tuRHkanoWsAS+60bw3mJh+EoTJ8ERJIf0BNzwg8Aeu6yMEMfg6JIt6CSIjcS834bTw/LXYUx2SXkyn55nizfiRcTSGIqttk5IIgrT3TOMhbs7sPknkg1aLuF/+eheaiDr7X425QOY8hnw8pMiZNaNKe4ATsYNYHjW5OduKu7/ofNRKsPGH2JCp8wpnp3dlDhNBtkhIu7gvovVLRZSlatC7lRSXP5XEXk11LopqvmAfsdOjQOsUpLbsDypg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GvVgILuZgWzzd4iqBdg7dA+hh8855jpKkFOw4cYlWuHZb+R+O9GtUbtGk43rio/tH1kD/HkC8KbPz5gG4KTnqHiOOOFdMYSytJMEtzhe0njhmPJF+BUBW7CsIp7PzeDjqlci/sbdDzOUcMxcJ5tAk4LqxXhLEO9yxzT4TzBYLf7J6e/58dLvRZOVTauSFkyiRXWC5v3XRa1sFzColB7louLefkVz6J5uIb5xxYLdTD35E6oC35fUMM/0/kNJCWRD7N/VvMAWUHPlYrAo8d7JSkDak2UO5vjDD7NpyuLrCmMVFWTbLT7ixoWGU89xALWuw9+lGn2GIc1fuJ1JwR2yqg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: Penny Zheng <Penny.Zheng@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Alistair Francis <alistair.francis@xxxxxxx>, Bob Eshleman <bobbyeshleman@xxxxxxxxx>, Connor Davis <connojdavis@xxxxxxxxx>, Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>, Wei Chen <wei.chen@xxxxxxx>
  • Delivery-date: Tue, 18 Mar 2025 09:12:13 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 17/03/2025 21:07, Luca Fancellu wrote:
> 
> 
> From: Penny Zheng <Penny.Zheng@xxxxxxx>
> 
> ARM MPU system doesn't need to use paging memory pool, as MPU memory
> mapping table at most takes only one 4KB page, which is enough to
> manage the maximum 255 MPU memory regions, for all EL2 stage 1
> translation and EL1 stage 2 translation.
> 
> Introduce ARCH_PAGING_MEMPOOL Kconfig common symbol, selected for Arm
> MMU systems, x86 and RISC-V.
> 
> Wrap the code inside 'construct_domU' that deal with p2m paging
> allocation in a new function 'domain_p2m_set_allocation', protected
> by ARCH_PAGING_MEMPOOL, this is done in this way to prevent polluting
> the former function with #ifdefs and improve readability
> 
> Introduce arch_{get,set}_paging_mempool_size stubs for architecture
> with !ARCH_PAGING_MEMPOOL.
> 
> Remove 'struct paging_domain' from Arm 'struct arch_domain' when the
> field is not required.
> 
> Signed-off-by: Penny Zheng <penny.zheng@xxxxxxx>
> Signed-off-by: Wei Chen <wei.chen@xxxxxxx>
> Signed-off-by: Luca Fancellu <luca.fancellu@xxxxxxx>
> ---
> v3 changes:
>  - Introduced ARCH_PAGING_MEMPOOL instead of HAS_PAGING_MEMPOOL
> v2 changes:
>  - make Kconfig HAS_PAGING_MEMPOOL common
>  - protect also "xen,domain-p2m-mem-mb" reading with HAS_PAGING_MEMPOOL
>  - do not define p2m_teardown{_allocation} in this patch
>  - change commit message
> ---
>  xen/arch/arm/Kconfig              |  1 +
>  xen/arch/arm/dom0less-build.c     | 74 ++++++++++++++++++++-----------
>  xen/arch/arm/include/asm/domain.h |  2 +
>  xen/arch/riscv/Kconfig            |  1 +
>  xen/arch/x86/Kconfig              |  1 +
>  xen/common/Kconfig                |  3 ++
>  xen/include/xen/domain.h          | 17 +++++++
>  7 files changed, 73 insertions(+), 26 deletions(-)
> 
> diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
> index 5ac6ec0212d2..a4af0b85f158 100644
> --- a/xen/arch/arm/Kconfig
> +++ b/xen/arch/arm/Kconfig
> @@ -75,6 +75,7 @@ choice
> 
>  config MMU
>         bool "MMU"
> +       select ARCH_PAGING_MEMPOOL
>         select HAS_LLC_COLORING if !NUMA && ARM_64
>         select HAS_PMAP
>         select HAS_VMAP
> diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
> index 573b0d25ae41..6eef6ba91444 100644
> --- a/xen/arch/arm/dom0less-build.c
> +++ b/xen/arch/arm/dom0less-build.c
> @@ -673,21 +673,6 @@ static int __init prepare_dtb_domU(struct domain *d, 
> struct kernel_info *kinfo)
>      return -EINVAL;
>  }
> 
> -static unsigned long __init domain_p2m_pages(unsigned long maxmem_kb,
> -                                             unsigned int smp_cpus)
> -{
> -    /*
> -     * Keep in sync with libxl__get_required_paging_memory().
> -     * 256 pages (1MB) per vcpu, plus 1 page per MiB of RAM for the P2M map,
> -     * plus 128 pages to cover extended regions.
> -     */
> -    unsigned long memkb = 4 * (256 * smp_cpus + (maxmem_kb / 1024) + 128);
> -
> -    BUILD_BUG_ON(PAGE_SIZE != SZ_4K);
> -
> -    return DIV_ROUND_UP(memkb, 1024) << (20 - PAGE_SHIFT);
> -}
> -
>  static int __init alloc_xenstore_evtchn(struct domain *d)
>  {
>      evtchn_alloc_unbound_t alloc;
> @@ -841,6 +826,53 @@ static void __init domain_vcpu_affinity(struct domain *d,
>      }
>  }
> 
> +#ifdef CONFIG_ARCH_PAGING_MEMPOOL
> +
NIT: here and elsewhere. We don't usually separate code from #idef/#else/#endif
with empty lines.

For Arm:
Reviewed-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®.