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

Re: [PATCH 2/2] xen/arm: Skip loops in init_pdx() when no PDX compression is used


  • To: Hari Limaye <hari.limaye@xxxxxxx>
  • From: "Orzel, Michal" <michal.orzel@xxxxxxx>
  • Date: Mon, 7 Jul 2025 14:43:26 +0200
  • 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=KD2f056gXRadcWzFz9GJOps42ORGEMCOE9WA+P36POE=; b=VunzDKzxeiUpxqNxbCcg4yQd6tvnpE6nJuRoctywTSGasfqsix+RtH/zNLb4I84kQjBI49SIAHgZEpGZX3s12GsrFzdKSKLYvCqpCiTUOgtjJFBFJb/zvZQwlcbozxScCnxXZdcxdACRzGDRpdMY/pMsIjg0CttF9E7aGPRloWD1FOxf/oYg4ejWKenlU9vCKYPhiUZNERJB/F8IgpOSE+4PyU6+vvy5zVLZ3AfDfnF/KzTZjkAjPMBfWExTziJVG3Y3R8Lk8vDdET+NhCnBdhqaE316D9yN5AUi1uukeqkegsxXYHp9mtWOMKHuVZcni4cgwYnxGPTHTBt+X/q/pQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=oGsKvuZhVrlemsOlqJ0mne+xfTklKr2/MOMHHHWwUhzNGE9FASjIPgExa5FrK9mh0dhhFwKh5+dJc0y3b6UIUER5PSRuvTiKC3kBX/qaRVlvky3M32tAXaCW7/QH5xlRPur8uZM79Y4BChlHpbD0WPYyHq1350XpadOBdQzCf/O96fkkupiw37cRFnIYjDCug+lIySstJnBl7DlWL5BRvG2CCfO9h+r0H9zrU0puh+VNt8Eq60cPq3TQ1zH0yVR38rt2Iy27KpZunzhGs4ieFBXWzq5i8k5siC1Ap886L95Xv0FLKoDlvo6ESW5mCvVXd4XXOB3j9M8JKT8Ob+DZkg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Mon, 07 Jul 2025 12:43:53 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 07/07/2025 13:56, Hari Limaye wrote:
> Hi Michal,
> 
>> On Fri, Jul 04, 2025 at 09:54:28AM +0000, Michal Orzel wrote:
>> When CONFIG_PDX_COMPRESSION=n, pdx_init_mask(), pdx_region_mask() and
>> pfn_pdx_hole_setup() are just stubs doing nothing. It does not make
>> sense to keep the two loops iterating over all the memory banks.
>>
>> Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>
>> ---
>>  xen/arch/arm/setup.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
>> index 93b730ffb5fb..12b76a0a9837 100644
>> --- a/xen/arch/arm/setup.c
>> +++ b/xen/arch/arm/setup.c
>> @@ -255,7 +255,9 @@ void __init init_pdx(void)
>>  {
>>      const struct membanks *mem = bootinfo_get_mem();
>>      paddr_t bank_start, bank_size, bank_end, ram_end = 0;
>> +    int bank;
> 
> Minor/question: Would we potentially prefer to move the declaration of
> the loop counter `bank` variables to each for loop? As the variable is
> not used outside of the loops and is always initialized to 0, this seems
> perhaps better from a variable scope perspective?
Maybe it does but it was too minor for me to be willing to incorporate it in
this patch whose goal was not to reduce the variable scope (I think adding such
change would not fit the purpose of the patch).

> 
>>  
>> +#ifdef CONFIG_PDX_COMPRESSION
>>      /*
>>       * Arm does not have any restrictions on the bits to compress. Pass 0 to
>>       * let the common code further restrict the mask.
>> @@ -264,7 +266,6 @@ void __init init_pdx(void)
>>       * update this function too.
>>       */
>>      uint64_t mask = pdx_init_mask(0x0);
>> -    int bank;
>>  
>>      for ( bank = 0 ; bank < mem->nr_banks; bank++ )
>>      {
>> @@ -284,6 +285,7 @@ void __init init_pdx(void)
>>      }
>>  
>>      pfn_pdx_hole_setup(mask >> PAGE_SHIFT);
>> +#endif
>>  
>>      for ( bank = 0 ; bank < mem->nr_banks; bank++ )
>>      {
> 
> Otherwise, LGTM! Tested (compilation) via both Arm AArch32 and AArch64 builds.
> 
> Many thanks,
> Hari

Thanks.

~Michal




 


Rackspace

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