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

Re: [PATCH v6 06/13] xen/arm: Split page table related code to mmu/pt.c


  • To: Julien Grall <julien@xxxxxxx>
  • From: Henry Wang <Henry.Wang@xxxxxxx>
  • Date: Tue, 26 Sep 2023 01:22:40 +0000
  • Accept-language: zh-CN, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=BT+6fsnEkJ6JZvZHojF93bIJVFm5eWHfBnsMyJDuFVc=; b=di398i6Gycpqmvnv7Vp1gG5+upVpdoCNmcrRYpAyoArKn4WZqVVsZ9fI2HSW2CtuihrZV5zd3+Fg443Pe2itvm5Hkz0kiA8qiQcBMX77rI6XuZ3eERNhZOrz/vck/TpaSX9TQPOMQy33U/00TzuOS0cE9Krv1HcRiBHivJMlJGzEMDmn9BwKwHxA/SlydwbR5H+JPMunDJURYXdgK2iioqtvgzXAWVgOiRqsAvlAhUZVV98gTk1b217RZc2j08mfC7Ax9pa6INkIePclkB/ADbHZt3k+aTEJ+empJ6TkyfPVhyuWp47uRmA20KHtvm2cBjS/04XbETrdaTf5cGboTA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mS3OnJNu2T4SQa4HvOTecvHGWnv5JgSiYjwuh+dHw8+QTQIDlxubwHGm+rg1zAu2WlkXdZcXuvJ+2Ujww9ZNSSb+03fEp6dwkHRYPYem6La+Y/Gx45sPAO59lBl2ALjhnLwVLGTT2PHseZAZfV5W3uhU7rsDU3So2NC+tYpEaX52N/NI8rBTUv0ZP8GI1veXKtywFCmKiX7C4gm2a+UckUSzDvd/vSr/tSg8Iz0RfdCPLOFL7IBX0TgVXD03P0t2zBc6cJRB7q9rovbbeR+PRtvVO67AH3f9js8xcXXSk2ee0oLxhMYBmgqbf3lNCtonS8JuJoRJi20p9KtHuorHFg==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Wei Chen <Wei.Chen@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Penny Zheng <Penny.Zheng@xxxxxxx>
  • Delivery-date: Tue, 26 Sep 2023 01:23:22 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHZ2U+aje2PKtXU80iuXwonhzBTpLAsEaAAgABrlgA=
  • Thread-topic: [PATCH v6 06/13] xen/arm: Split page table related code to mmu/pt.c

Hi Julien,

> On Sep 26, 2023, at 02:57, Julien Grall <julien@xxxxxxx> wrote:
> 
> Hi Henry,
> 
> I haven't checked that the code movement is just a code movement. For now, I 
> am mainly looking at the split.

No problem, thank you. I will rebase v6 and use text comparison tools
to check if the code movement is just code movement before sending v7
to make sure I won’t make the same mistake again. You can double check
the final version. 

> 
> On 28/08/2023 02:32, Henry Wang wrote:
>> The extraction of MMU related code is the basis of MPU support.
>> This commit starts this work by firstly splitting the page table
>> related code to mmu/pt.c, so that we will not end up with again
>> massive mm.c files.
>> Introduce a mmu specific directory and setup the Makefiles for it.
>> Move the page table related functions and macros from arch/arm/mm.c
>> to arch/arm/mmu/pt.c. Expose the previously static global variable
>> "phys_offset".
> 
> I don't much like the idea to expose phys_offset everywhere. Looking at the 
> code there are two users:
>  * pte_of_xenaddr(): I realize you suggested to add it in pt.c and I agreed. 
> However, looking at the split, this function is exclusively used for boot 
> (and you confirmed below). So I think it would be preferable to move it in 
> mmu/setup.c.

Sounds good, I will fix this in v7.

>  * prepare_secondary_mm(): I think we could switch to virt_to_mfn().

Actually I found the third use of phys_offset in setup_pagetables(), but it
looks like the usage is similar as the usage here, so probably these two
are the same case.

Also, please correct me if I am wrong, by suggesting the “switch”, do you
mean using virt_to_mfn() on xen_pgtable to change it to min, then change
the mfn to PA and delete the phys_offset? If so, why not use virt_to_maddr()? 

> 
> I can understand if you don't want to make the second change. So I would at 
> least request to ...
> 
>> While moving, mark pte_of_xenaddr() as __init to make clear that
>> this helper is only intended to be used during early boot.
>> Take the opportunity to fix the in-code comment coding styles when
>> possible, and drop the unnecessary #include headers in the original
>> arch/arm/mm.c.
>> Signed-off-by: Henry Wang <Henry.Wang@xxxxxxx>
>> Signed-off-by: Penny Zheng <penny.zheng@xxxxxxx>
>> ---
>> v6:
>> - Rework the original patch "[v5,07/13] xen/arm: Extract MMU-specific
>>   code", only split the page table related code out in this patch.
>> ---
>>  xen/arch/arm/Makefile         |   1 +
>>  xen/arch/arm/include/asm/mm.h |   2 +
> 
> ... declare phys_offset in asm/mmu/mm.h because this variable doesn't make a 
> lot of sense when the MPU is used (it will always be equal to 0).
> 
> The rest of the split looks good to me.

Thanks for confirming, I will see what the above discussion ends and then
do the change accordingly.

> 
> 
> [...]
> 
>> -lpae_t pte_of_xenaddr(vaddr_t va)
>> -{
>> -    paddr_t ma = va + phys_offset;
>> -
>> -    return mfn_to_xen_entry(maddr_to_mfn(ma), MT_NORMAL);
>> -}
>> -
> 
> See above. I think this should stay here for now and the be moved to setup.c 
> in a follow-up patch.

Sure.

Kind regards,
Henry

> 
> Cheers,
> 
> -- 
> Julien Grall


 


Rackspace

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