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

Re: [PATCH] device-tree: Improve hwdom memory allocation for DMA


  • To: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • From: "Orzel, Michal" <michal.orzel@xxxxxxx>
  • Date: Tue, 21 Apr 2026 08:41:46 +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=EXtxGL3mNOR7yTJYPCO6B4KfUixMlSqaYU8wmwhUh4M=; b=MVC5R5TON03ptjCNspIvXNOJSeW6qDYyLzTNObt0aiYbJDQjJySMs7B3cVXBlMVHs7qzCgjP0OvbNlXWu7enevtD5SUpf6O8HUpJxHKFwDKQ/txykD/c/8tUkhM7E4fc4pKRvqFf3FfSkHFd3/f0bAw1PTdKuM+fpCeHZI+eIbDD++NMRx5ufwpTv/QoNgUcj+VT++tcr/IEeKZe6OXY7xsR0XBfc0rTF3mhbvtI6JfFea/4Tvukv2imdaMUSapjyZtSRWe3iCd0wMqWo54AcUYFKWTZhp9uRK3i664rtnQzp9DFXe+BcouiJtstkSJyG975PbTvEybolIIBSpdRbQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xURz+Wp7TBUI4HY/F7dKhuoK1f7sZb0U9lu2WhgnIMJDNjz1PKAew6VyozdtlSUh9FMSnvaqRHNzObFW52xHFfjpdEzBE05cQORTKEdtrjFL7pLyom5OyqPbPBnE9pwcGiXjCLfLD32XHN0WHH0uOL16LbD6/QBmguxL4ziSVfvQ0TZ4qLhA594sX/vy6RVQDMEsTLDuue3HoyFrGySWM4geP/AfnI/UrnN3PKsX+98KojKIBCncjEx1EnBDmvVsU2zqkf+gxp7N+YRFP7GwVuC2J6+lPLnr/WP09M8q2VRLQ+iGCeRkYb+jMGJPGI1GIKxa0suDCLk76uKyI43qcQ==
  • 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>
  • Delivery-date: Tue, 21 Apr 2026 06:41:58 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 20/04/2026 16:54, Luca Fancellu wrote:
> Hi Michal,
> 
>> On 17 Apr 2026, at 10:11, Michal Orzel <michal.orzel@xxxxxxx> wrote:
>>
>> When LLC coloring is enabled, the hardware domain gets memory from
>> host free regions rather than the fixed guest RAM banks.  The previous
>> code sorted these regions by descending size, which usually causes
>> high-address memory to be allocated first.
>>
>> All allocated memory could reside above 4 GB leaving DMA non-functional
>> for devices with limited addressing capabilities.
>>
>> Improve the handling as follows:
>> - Sort free regions by ascending address instead of descending size,
>>  so low-memory banks are allocated first,
>> - Skip banks smaller than 128 MB (or the total remaining allocation,
>>  whichever is less) until the first bank is placed, ensuring
>>  place_modules() has enough contiguous space,
>> - Extract the hardware domain allocation path into its own function
>>  (allocate_hwdom_memory) for clarity.
>>
>> Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>
>> ---
>> xen/common/device-tree/domain-build.c | 152 ++++++++++++++++----------
>> 1 file changed, 96 insertions(+), 56 deletions(-)
> 
> It looks ok to me, the only thing is that if we have many smaller banks < 128 
> Mb before reaching
> one that is at least 128 Mb, we won’t allocate them and loose them forever.
> 
> It feels only a corner case so for me it’s ok
Yes, that's something documented in the commit msg, so if we ever face upon the
issue due to that we could revisit the implementation. For now, we haven't
observed any issues.

> 
> Reviewed-by: Luca Fancellu <luca.fancellu@xxxxxxx 
> <mailto:luca.fancellu@xxxxxxx>>
Thanks.

~Michal

> 
> Cheers,
> Luca
> 
> 




 


Rackspace

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