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

Re: [PATCH] arm/domain_build: Make find_unallocated_memory() more generic


  • To: Julien Grall <julien@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Thu, 12 Dec 2024 09:46:37 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=xen.org 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=O9yoGP7yvMHXuM4AIFczLTZmyq3Qzgx8EZRBPMLyyhU=; b=pik9t/A44OIVJA7d7irOLs/Cl7NDyTBuQQeN5HdsIh2zvjHU5dMj03l4Nlp0k4f1udXC0Nst8ho6ySo298Gw+Ipk5d/tyvn3YL9sru6nQZRq4TDy0+M/E1ywR+N25NiFSlIt3r/uJquLAGeGAqtVAC8AnTcnMeIQ4J4Rbo2FUNa5Cdow0lyYqi1AF9FJkdKa/R2wMOQcmGiewcxkx6LWqDI+qvto7098ZmhsXysjfyF1EyibuZjvwEYfzvvcXPVrHzf5EKrUuxRtT74hTDZjoH0S9ZYF2EaWzvvwLN6N3V4QtWNvJRn+k+wCEVsuC2L2USvf88ecmiUaeoJpTQZEQQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=j2MwmssHVDexNZRCtHqFDtcmPqwzNTOyFmPD51mdbpiNbaELk91aHktMzXZoNhNh1z/eSSH5nOJKAiFVvCyvlcdodw1IFF7U/LZDadS4fGR+d0I+e9n23t/e653MDzto3VM2Yf5F+lXqBOfCMM2rEj8jzUaInfiLD85P2bKCzIxl1qvtnF64K7koNE0bz0HR3IuwyzBQrsL7uJVqJPho3tu3V4LrVA6d722braLA38MsFNVM5xKcUidFa8XCkmKTkwTAa3C+wYccg5vxWZOSZN7Z9cZergXXTLJSIpmrPd0knwXWActoV+VlxXmcrXPJgEMxxSBprksgzqGraNNsRw==
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Thu, 12 Dec 2024 08:47:08 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hi Julien,

On 11/12/2024 18:39, Julien Grall wrote:
> 
> 
> Hi Michal,
> 
> On 10/12/2024 10:10, Michal Orzel wrote:
>> At the moment, find_unallocated_memory() is only used to retrieve free
>> memory ranges for direct mapped domains in order to find extended
>> regions. It is not generic as it makes assumptions as for the place at
>> which it's being called (domain memory already allocated, gnttab region
>> already found) and hardcodes the memory banks to be excluded.
>>
>> Make the function more generic, so that it can be used for other
>> purposes whenever there is a need to find free host memory regions (e.g.
>> upcoming LLC coloring series). Allow passing array with memory banks as a
>> parameter together with a callback to populate free regions structure,
>> as the logic may differ depending on the needs.
>>
>> Add find_host_extended_regions() to be called from make_hypervisor_node()
>> to contain the logic to find extended regions for domains using host
>> memory layout that are not permitted to use IOMMU.
>>
>> Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>
> 
> With one remark below:
> 
> Acked-by: Julien Grall <jgrall@xxxxxxxxxx>
> 
>> ---
>> This is a prerequisite patch for LLC coloring series patch 3.
>> For dom0 LLC coloring, we just need to pass resmem and gnttab in mem_banks.
>> ---
>>   xen/arch/arm/domain_build.c | 97 +++++++++++++++++++++----------------
>>   1 file changed, 55 insertions(+), 42 deletions(-)
>>
>> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
>> index 2c30792de88b..500005079b88 100644
>> --- a/xen/arch/arm/domain_build.c
>> +++ b/xen/arch/arm/domain_build.c
>> @@ -901,31 +901,26 @@ int __init add_ext_regions(unsigned long s_gfn, 
>> unsigned long e_gfn,
>>   }
>>
>>   /*
>> - * Find unused regions of Host address space which can be exposed to Dom0
>> - * as extended regions for the special memory mappings. In order to 
>> calculate
>> - * regions we exclude every region assigned to Dom0 from the Host RAM:
>> - * - domain RAM
>> - * - reserved-memory
>> - * - static shared memory
>> - * - grant table space
>> + * Find unused regions of Host address space which can be exposed to domain
>> + * using the host memory layout (i.e. direct mapped or hardware domain). In
> 
> NIT: I would use "e.g." rather than "i.e." because in the future we may
> want to expose the host layout to a guest without necessarily having IPA
> == PA. You could also drop the part in () because one could find the
> definition on top of domain_use_host_layout().
I removed () on commit. Thanks.

~Michal




 


Rackspace

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