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

Re: [PATCH v2 2/2] xen/arm: skip holes in physical address space when setting up frametable


  • To: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • From: "Orzel, Michal" <michal.orzel@xxxxxxx>
  • Date: Mon, 4 May 2026 16:46:06 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=arm.com 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=qeu0C7yFDtU2qsVJ6OUoEtzQRQj/QaIlxDJII66T0r4=; b=ebgSUc+xi6E1uBlGS7seUTgK4xUfA12AX2XI5kROF+kes5vMMZAEpANkMmZvCRrHGMQRjlA+E31BnRseCQo4+hU0fzgbaLzd7Fb6nsWxT4Dd8SVax3cH17mMzOU1+Qe9NchlNVxbElcVWE94MkFK4A+regiFWWQQ5Xo3Uf8UNJTV3VFolOAmtX85Fe6uqSChX4cBnaCRG7KMgEvQwzHBEj1N3+oCTSVsHvc8YN6F4zEEg0vrfxQgg8MTb4h4SdSFGFsrWLBQIMYQnXA9aGk6hI+YTzou8wxprPbPrq/KW2zhUbBZ+kAo66cOEoXJpBdhr+vRlXns7bFw3FhMizWKTQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rBhcClR3tBuLLoUIFt7oy/K5FGNSppWFTMQegJZmL0mtwad23n8knUPchYzs/BFlp3YAyA/zL0lKfuG+sIk/LfJnWsfetZRE0HHOpj0bmYLTttTvLWyH2CZlGK4ajztQNdvrH0MTMmEVT/aqYW0Y0uLCsMmIfaG/ibq/eXAb2e1NcGSxWmtB31qz7Tb9A5iY4NtUjqxfVnwsRXi+xsknzx7FbzckUsMXQZfARexQvGXe4iA4is+N5ML5BKHkXEw0ElQsjQ69890svJMcxgtFl/cFRj0avy2/E/5L6MpUpfQb6wEAK5ko7OHiJJXKr0RUsR1sQpUT3be+nzq/qcaaeQ==
  • 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: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "Stefano Stabellini" <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, "Bertrand Marquis" <Bertrand.Marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Mon, 04 May 2026 14:46:20 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 01-May-26 17:00, Luca Fancellu wrote:
> Hi Michal,
> 
>> diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
>> index faef0efb327c..7297cca01551 100644
>> --- a/xen/arch/arm/mm.c
>> +++ b/xen/arch/arm/mm.c
>> @@ -63,7 +63,7 @@ void __init setup_mm(void)
>>
>>     setup_mm_helper();
>>
>> -    setup_frametable_mappings(ram_start, ram_end);
>> +    init_frametable(ram_start);
> 
> I think that now ram_end and bank_end can be removed
Right, will do.

> 
>>
>>     init_staticmem_pages();
>>     init_sharedmem_pages();
>> diff --git a/xen/arch/arm/mmu/mm.c b/xen/arch/arm/mmu/mm.c
>> index 6604f3bf4e6a..dfc888c8ee0e 100644
>> --- a/xen/arch/arm/mmu/mm.c
>> +++ b/xen/arch/arm/mmu/mm.c
>> @@ -6,18 +6,45 @@
>> #include <xen/mm.h>
>> #include <xen/mm-frame.h>
>> #include <xen/pdx.h>
>> +#include <xen/sizes.h>
>> #include <xen/string.h>
>>
>> -/* Map a frame table to cover physical addresses ps through pe */
>> -void __init setup_frametable_mappings(paddr_t ps, paddr_t pe)
>> +static void __init init_frametable_chunk(unsigned long pdx_s,
>> +                                         unsigned long pdx_e)
>> {
>> -    unsigned long nr_pdxs = mfn_to_pdx(mfn_add(maddr_to_mfn(pe), -1)) -
>> -                            mfn_to_pdx(maddr_to_mfn(ps)) + 1;
>> -    unsigned long frametable_size = nr_pdxs * sizeof(struct page_info);
>> -    mfn_t base_mfn;
>> -    const unsigned long mapping_size = frametable_size < MB(32) ? MB(2)
>> -                                                                : MB(32);
>> +    unsigned long nr_pdxs = pdx_e - pdx_s;
>> +    unsigned long chunk_size = nr_pdxs * sizeof(struct page_info);
>> +    unsigned long virt;
>>     int rc;
>> +    mfn_t base_mfn;
>> +
>> +    /*
>> +     * In-loop chunks span whole PDX groups, which are always page-size
>> +     * aligned. The last chunk ending at max_pdx may not be, so round up.
>> +     */
>> +    chunk_size = ROUNDUP(chunk_size, PAGE_SIZE);
>> +
>> +    /*
>> +     * Align the allocation to the contiguous mapping size so that
>> +     * map_pages_to_xen() can use the contiguous bit.
>> +     */
>> +    base_mfn = alloc_boot_pages(chunk_size >> PAGE_SHIFT,
>> +                                MB(32) >> PAGE_SHIFT);
> 
> This fixed 32Mb alignment feels a bit more than we need, If for example the
> chunk is less than 32Mb? If we had some variable alignment for chunks less
> than 32MB we would maybe help alloc_boot_pages job, in the end if the chunk
> is less than 32Mb it won’t get the contiguous bit anyway.
Good point. On Arm64 this affects any chunk spanning fewer than 3 valid PDX
groups (~14MB per group). I'll use 32MB if chunk size >= 32MB, 2MB otherwise.

> 
> But I’m fine also if you leave it as it is.
> 
> With the above fixed:
> 
> Reviewed-by: Luca Fancellu <luca.fancellu@xxxxxxx>
I can take this one but ...

> Tested-by: Luca Fancellu <luca.fancellu@xxxxxxx>
not this one given the change.

~Michal




 


Rackspace

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