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

Re: [PATCH v5 11/13] xen/arm: mmu: move MMU specific P2M code to mmu/p2m.{c,h}


  • To: Julien Grall <julien@xxxxxxx>
  • From: Henry Wang <Henry.Wang@xxxxxxx>
  • Date: Wed, 23 Aug 2023 01:41:51 +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=N+N+nKzBgAS5utOMHckaYI2DSxktHRan19Jlv1A2XEM=; b=eff0iikyVLN/BQ0AVgDHizGQFsgg3r2ULuUQz6WmE+aMUSOEavXWNwaGD/AHYrLZIJVlu8YJiNugJ6T7WMez7WPpAeZx3YiLh5rS9RGZ54C2Z3dO0yCojjXoED6B6S2zuOs0QTx4gou0VWCQ9FJP/O6G3NZKjvt2+JRPTDBB9jNRHvT9yKwUTBrLERaoadNU9UFuN4bLNW9mPYiqBw+P92eRiB8JjypgpgwwKEkxOVDQDlCz2TebNZSRQdoQIDl2+AdGDMql4kjdNi1ImxgzRXRwBKHdc3SpZAU8lC+Mn6MNWEvCv764weG1UZ6PePyAbq7D1A/rdiPsuHPlrXzTpw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EF0NaH9RQ4RpaXtRtFWQtM09s3Q3CSOljaJB6mqosDp23yF8RxJDqHfCLjZYxXlBWVzcXGwkidtIim35w81F8CQNGkkBktp8Hh39gnSwxDvbKT/hctouRhm/BMXadSEK/bax4sjk22R/4y37sQe2x/xazOxGuo9SKJf4TRaV31OlEHXkWFmKaTziYBbqIYv7cah1ME8AODb/b00wYzz3Rw0IkJPiNh/rXJtO0n1Hot2wyvHUarSBjik6C41D467Xj0oRj7+u3io2BIEep7u93H/Yo4UiyfMX+brov9nAFBAno5ONpsaZjYg8HQIE8StLcMBCJwTh2IGQ/2hLdWnV7A==
  • 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>, Penny Zheng <Penny.Zheng@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Wei Chen <Wei.Chen@xxxxxxx>
  • Delivery-date: Wed, 23 Aug 2023 01:42:30 +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: AQHZzmeLeyiYpsCVck6zI0bQS/LJfq/2qHQAgACAqQA=
  • Thread-topic: [PATCH v5 11/13] xen/arm: mmu: move MMU specific P2M code to mmu/p2m.{c,h}

Hi Julien,

> On Aug 23, 2023, at 02:01, Julien Grall <julien@xxxxxxx> wrote:
> 
> Hi Henry,
> 
> On 14/08/2023 05:25, Henry Wang wrote:
>> From: Penny Zheng <penny.zheng@xxxxxxx>
>> Current P2M implementation is designed for MMU system only.
>> We move the MMU-specific codes into mmu/p2m.c, and only keep generic
>> codes in p2m.c, like VMID allocator, etc. We also move MMU-specific
>> definitions and declarations to mmu/p2m.h, such as p2m_tlb_flush_sync().
>> Also expose previously static functions p2m_vmid_allocator_init(),
>> p2m_alloc_vmid(), __p2m_set_entry() and setup_virt_paging_one()
> 
> Looking at the code, it seemsm that you need to keep expose __p2m_set_entry() 
> because of p2m_relinquish_mapping(). However, it is not clear how this code 
> is supposed to work for the MPU. So should we instead from 
> p2m_relinquish_mapping() to mmu/p2m.c?

Sure, I will try that.

> 
> Other functions which doesn't seem to make sense in p2m.c are:
>  * p2m_clear_root_pages(): AFAIU there is no concept of root in the MPU. This 
> also means that we possibly want to move out anything specific to the MMU 
> from 'struct p2m'. This could be done separately.
>  * p2m_flush_vm(): This is built with MMU in mind as we can use the 
> page-table to track access pages. You don't have that fine granularity in the 
> MPU.

I agree, will also move these to mmu/ in v6.

> 
>> for futher MPU usage.
> 
> typo: futher/further/

Thanks, will fix.

> 
>> With the code movement, global variable max_vmid is used in multiple
>> files instead of a single file (and will be used in MPU P2M
>> implementation), declare it in the header and remove the "static" of
>> this variable.
>> Add #ifdef CONFIG_HAS_MMU to p2m_write_unlock() since future MPU
>> work does not need p2m_tlb_flush_sync().
> 
> And there are no specific barrier required? Overall, I am not sure I like the 
> #ifdef rather than providing a stub helper.

I think for MPU systems we don’t need to flush the TLB, hence the #ifdef. Do 
you mean we should
provide a stub helper of p2m_tlb_flush_sync() for MPU? If so I think maybe the 
naming of this stub
helper is not really ideal?

Kind regards,
Henry

> 
> If the other like the idea of the #ifdef. I think a comment on top would be 
> necessary to explain why there is nothing to do in the context of the MPU.
> 
> Cheers,
> 
> -- 
> Julien Grall


 


Rackspace

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