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

Re: [PATCH 1/1] xen/arm: populate a default P2M pool for new domains


  • To: Julian Vetter <julian.vetter@xxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: "Orzel, Michal" <michal.orzel@xxxxxxx>
  • Date: Fri, 23 Oct 2026 12:29:03 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vates.tech 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=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=Z85FzhDw98EF2IONjo3MUPpsoTPX1b6G+PCnPwD5v3c=; b=N5XFEx3lT8z4nrWA0wNBy82Jg7fybIbKmZY6MilhcawjshLybtfYk8H4Q7UDH1MTHoyXkfz9p/EYJgKT0ZtR0VHHZBQXhpL+f1HB/BXH1azSU9ROzss+mwcn29R93VsRj1R4N55gAPh9neJo40sPxciprYgu3FR+4AxL36xbwEYib6MiBFU2cxlV7++tzPsGMB/cBX74zx+5u5MHdVXW5MDlXe+1k95irc24hwUEgzMCGTgPnSRpS22LFAUcjgZYs7PBwj2hZH8uElj3KYJnRkWn2FhcKBvKjeaJy0jDBY+00SupZOhNrczFlqf1/LUyFypL1Tj2XaN2VgkHi0QOnQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pM7Oi2aUUA/SfTRd/S+GS2WbK2glG+LdynilJx6+1vjO1EkzmcNuGOsvdPgRwdDkA/5WOFS2cBcWt5DdK77Y87xjTnJQBDVCc7BRMh1KE0qvawgnaOmI0psLNb289IAlWDOTHP2ThTzeBd5NvfhdwNLBu2GuDou0nJ8/10yUGU7+5ioKKl4sXRp/t+Tc+5V89WFKsFZFp/7uVhrJKvycchYWSWkc1Nb+eogDJ7EZLs0a3Y7Ry+S/yNX26VQmY3o701Hma7wbSaUmc94JG5+NnD3Epo4kccvJ+t9FA7pG57KE5F6dfovmOvUhqDu0Ai1gCMaoN8xJd+YCDNNRL2AtVA==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=amd.com header.i="@amd.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Fri, 23 Oct 2026 10:29:29 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 16-Oct-26 10:16, Julian Vetter wrote:
> Since commit 9c962e07fb ("xen/arm: Clean-up in p2m_init() and
> p2m_final_teardown()"), ARM domains start with an empty P2M pool. So,
> populating the physmap fails, as no page tables can be allocated until
> the pool is sized by, e.g., the toolstack.
The history on Arm I found is as follows:
 - no dedicated P2M pool for domains
 - cbea5a1149 adds a dedicated P2M pool for non-hw domains
 - c7cff11888 adds initial P2M pool due to GICv2 requirements
 - 9c962e07fb removes the above

> 
> Restore the call to add a small default pool of 16 pages in p2m_init()
> again, as before 9c962e07fb. The hardware domain is skipped, as it
> doesn't allocate its P2M pages from the page pool. Also skip it if LLC
> coloring is enabled. The colors are only configured after domain
> creation, so the pool pages would be allocated with the default colors.
This does not say anything about why we need to have a default pool. The cover
letter you sent mentions that x86 does that but does not rationalize why. Also,
why 16 and not any other number (previously on Arm it was 16 due to GICv2
worst-case). And if we really need to have a default pool, then shouldn't we
just initialize it to the default set in dom0less case by
domain_p2m_set_allocation() and in xl case by 
libxl__get_required_paging_memory()?

~Michal

> 
> Signed-off-by: Julian Vetter <julian.vetter@xxxxxxxxxx>
> ---
>  xen/arch/arm/mmu/p2m.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/xen/arch/arm/mmu/p2m.c b/xen/arch/arm/mmu/p2m.c
> index 2cf35d8a37..de8dd26a72 100644
> --- a/xen/arch/arm/mmu/p2m.c
> +++ b/xen/arch/arm/mmu/p2m.c
> @@ -3,6 +3,7 @@
>  #include <xen/domain_page.h>
>  #include <xen/ioreq.h>
>  #include <xen/lib.h>
> +#include <xen/llc-coloring.h>
>  #include <xen/sched.h>
>  #include <xen/softirq.h>
>  
> @@ -1541,6 +1542,21 @@ int p2m_init(struct domain *d)
>      if ( rc )
>          return rc;
>  
> +    /* Populate 16 pages to the P2M pages pool here.
> +     *
> +     * Skip the hardware domain, which allocates its P2M pages from the heap,
> +     * and LLC colored setups, as the domain's colors are only configured 
> after
> +     * domain creation.
> +     */
> +    if ( !is_hardware_domain(d) && !llc_coloring_enabled )
> +    {
> +        spin_lock(&d->arch.paging.lock);
> +        rc = p2m_set_allocation(d, 16, false);
> +        spin_unlock(&d->arch.paging.lock);
> +        if ( rc )
> +            return rc;
> +    }
> +
>      return 0;
>  }
>  




 


Rackspace

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