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

Re: [PATCH v2 6/7] xen: introduce Kconfig HAS_PAGING_MEMPOOL


  • To: Luca Fancellu <luca.fancellu@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: "Orzel, Michal" <michal.orzel@xxxxxxx>
  • Date: Mon, 17 Mar 2025 10:39:02 +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=yzILHqHd65LsP3jWe0txe2a26eqJFnipWa8+hQEp0nE=; b=rcXsnQ5VNYMs32lM5LiQJ+vPqNkMu7u7cIR3K/8W6zCfZ7AO1feFKua9TKs2S3kja4hpLn7omVLvwLYHcvn0W/HKJDeAp8FUPA+06u+ufeOcaZayUm9ltsculd9y/+os2xxAMIVj4WKvGacI9+xxIFyy+WBGvGap3frqDvSroR5HMY6KIf3Jiiq1IZ8XEB3jT1dIVchcPpl5KhA7Q8TQna7bTYYkl6aY3zX4zkZ8dVIB/o1NJVz913tH+maM7K5ApgDbORgUq8g5nPqArHSbVVAg84MTChl4iIc8dlh2uDvP6ej7u2xqo7XunY3UWESv0jBPuKyEhatA/EYJdRS3TA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xXCNJ0/TJk+VPm/k3sWObffGKKIPRNp2mbhz6dpTZvW47Y7VR+wG0f8p0SOONSf2jvmS0lY9atIk1HeYvzMBoZaM8UcuZNcaRG7YObcSXSpnhF72bb+DTYi+i0VdS+1DvNYoU6SA6NnVw49IMSz+FZXyc1t8+ni5Hgeuf9gUqNrPfuSm1sb/UpA9Tjqmc83xBm/eQfCio82wksSbr15ua7wuDLpUNqs+Q7EmdNc3C3Puxhiu9q6dVRsDS2cyZu7Y2ijysYZ4tgqrKEcint5Xj2lnuLka6URcAeryVWRsptH11VcyyuKWnc0YH6k3Na/Se9Zom64Xgup/aUBRFj/jKw==
  • 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>, Wei Chen <wei.chen@xxxxxxx>
  • Delivery-date: Mon, 17 Mar 2025 09:39:23 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 16/03/2025 20:24, 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 HAS_PAGING_MEMPOOL Kconfig common symbol, selected for Arm
> MMU systems.
I think it should be selected by other arches that implement the stubs.
Anyway, Jan added a comment and I do agree with him.

Just a few remarks.

> 
> Wrap the code inside 'construct_domU' that deal with p2m paging
> allocation in a new function 'domu_p2m_set_allocation', protected
> by HAS_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 implementation for MPU
> system.
> 
> 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>
> ---
> 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     | 48 ++++++++++++++++++++++++-------
>  xen/arch/arm/include/asm/domain.h |  2 ++
>  xen/arch/arm/mpu/Makefile         |  1 +
>  xen/arch/arm/mpu/p2m.c            | 25 ++++++++++++++++
>  xen/common/Kconfig                |  3 ++
>  6 files changed, 69 insertions(+), 11 deletions(-)
>  create mode 100644 xen/arch/arm/mpu/p2m.c
> 
> diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
> index 5ac6ec0212d2..6b4bcf12683e 100644
> --- a/xen/arch/arm/Kconfig
> +++ b/xen/arch/arm/Kconfig
> @@ -76,6 +76,7 @@ choice
>  config MMU
>         bool "MMU"
>         select HAS_LLC_COLORING if !NUMA && ARM_64
> +       select HAS_PAGING_MEMPOOL
>         select HAS_PMAP
>         select HAS_VMAP
>         select HAS_PASSTHROUGH
> diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
> index 573b0d25ae41..a65bbbb05301 100644
> --- a/xen/arch/arm/dom0less-build.c
> +++ b/xen/arch/arm/dom0less-build.c
> @@ -673,6 +673,8 @@ static int __init prepare_dtb_domU(struct domain *d, 
> struct kernel_info *kinfo)
>      return -EINVAL;
>  }
> 
> +#ifdef CONFIG_HAS_PAGING_MEMPOOL
> +
>  static unsigned long __init domain_p2m_pages(unsigned long maxmem_kb,
>                                               unsigned int smp_cpus)
>  {
> @@ -688,6 +690,8 @@ static unsigned long __init domain_p2m_pages(unsigned 
> long maxmem_kb,
>      return DIV_ROUND_UP(memkb, 1024) << (20 - PAGE_SHIFT);
>  }
> 
> +#endif
> +
>  static int __init alloc_xenstore_evtchn(struct domain *d)
>  {
>      evtchn_alloc_unbound_t alloc;
> @@ -841,6 +845,38 @@ static void __init domain_vcpu_affinity(struct domain *d,
>      }
>  }
> 
> +#ifdef CONFIG_HAS_PAGING_MEMPOOL
Why can't this be moved to upper CONFIG_HAS_PAGING_MEMPOOL block to avoid
excessive ifdefery?

> +
> +static int __init domu_p2m_set_allocation(struct domain *d, u64 mem,
s/domu/domain/ to match naming of other functions.
uint64_t. Linux types shall no longer be used.

> +                                          const struct dt_device_node *node)
> +{
> +    unsigned long p2m_pages;
> +    u32 p2m_mem_mb;
uint32_t

~Michal




 


Rackspace

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