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

Re: [PATCH v5 12/13] xen/arm: mmu: relocate copy_from_paddr() to setup.c


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: Henry Wang <Henry.Wang@xxxxxxx>
  • Date: Wed, 23 Aug 2023 00:58:57 +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=m0Vb+PFpyVNmv4TmOKhB0VIx+EXYu/A3OO+at38wZOE=; b=GH5Ia1yNvF15KX0x8jPu39GzXjE8pY5V9N2UjqvUtk+iSs4vFkLueOsvSdJQAoftOnA5O1IKobazncN7cw3qw9CikOqbXK288uCmwcN4BGPFn4c1Cq/Evyc74YQ9rMkrAO53Q3AwLA3bFi7lmWdEUp28Fll3GlI6V7vwe/vzcarVn9QV1wNG/cxp+evqeeRHmcWaCQA7Nk+pohUbVbqY1QmYd+XOhYaT8u/FeMsamtTiwWauSOcVnOU8zre6iWnQQQpuPWMQajp+ZOkZh4W50jDgqET7qO9xlylajgobTiUGW3LB3Q4aC3v7wnSC3dU4UmOZ5xXO9CuUvV68k6Xa3w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GK85c2z5woaqKS6Jho6UHIhKWJkimf4sxIzBaEN5Y4Erbui114G1p4ZxQThJSJ15Z766/jZQZvQxYZ1PTyvt4dv9zmoptrqqQPHRGoPGBBnfjrhkAzG0VDw2b/uyAKQJGO54L92s2awxhZLayi0RO7NRTkHDdCiQKIbBjGtpS5Cu8ximPh6Z1NFgqJ/sXna7wudnEHRHL5trDabZGyOvMyHZUiavJKmlYbd1lRXLiwu3663Py7FFpIGX0hAraTZVy9IZCPZ4Y9DjfUebthaaQdq9athMLsZH40FyOQuZ3aCICQw22+EYihq9axC135rG9vEpHdtdUtHTDCS12Ccunw==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Julien Grall <julien@xxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Penny Zheng <Penny.Zheng@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Wei Chen <Wei.Chen@xxxxxxx>
  • Delivery-date: Wed, 23 Aug 2023 00:59:33 +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: AQHZzmeOkWUgiqEb9U2fOmI3mEWP3a/1UMEAgACrQQCAABBYAIABAyyAgAANmwA=
  • Thread-topic: [PATCH v5 12/13] xen/arm: mmu: relocate copy_from_paddr() to setup.c

Hi Stefano,

> On Aug 23, 2023, at 08:10, Stefano Stabellini <sstabellini@xxxxxxxxxx> wrote:
> 
> On Tue, 22 Aug 2023, Julien Grall wrote:
>>>> I also don't like the idea of having again a massive mm.c files. So maybe
>>>> we need a split like:
>>>>  * File 1: Boot CPU0 MM bringup (mmu/setup.c)
>>>>  * File 2: Secondary CPUs MM bringup (mmu/smpboot.c)
>>>>  * File 3: Page tables update. (mmu/pt.c)
>>>> 
>>>> Ideally file 1 should contain only init code/data so it can be marked as
>>>> .init. So the static pagetables may want to be defined in mmu/pt.c.
>>> 
>>> So based on Julien’s suggestion, Penny and I worked a bit on the current
>>> functions in “arch/arm/mm.c” and we would like to propose below split
>>> scheme, would you please comment on if below makes sense to you,
>>> thanks!
>>> 
>>> """
>>> static void __init __maybe_unused build_assertions()      -> arch/arm/mm.c
>> 
>> All the existing build assertions seems to be MMU specific. So shouldn't they
>> be moved to mmu/mm.c.
>> 
>>> static lpae_t *xen_map_table()                            -> mmu/pt.c
>>> static void xen_unmap_table()                             -> mmu/pt.c
>>> void dump_pt_walk()                                       -> mmu/pt.c
>>> void dump_hyp_walk()                                      -> mmu/pt.c
>>> lpae_t mfn_to_xen_entry()                                 -> mmu/pt.c
>>> void set_fixmap()                                         -> mmu/pt.c
>>> void clear_fixmap()                                       -> mmu/pt.c
>>> void flush_page_to_ram()                                  -> arch/arm/mm.c?
>> 
>> I think it should stay in arch/arm/mm.c because you will probably need to
>> clean a page even on MPU systems.
> 
> I take you are referring to flush_page_to_ram() only, and not the other
> functions above
> 
> 
>>> lpae_t pte_of_xenaddr()                                   -> mmu/pt.c
>>> void * __init early_fdt_map()                             -> mmu/setup.c
>>> void __init remove_early_mappings()                       -> mmu/setup.c
>>> static void xen_pt_enforce_wnx()                          -> mmu/pt.c,
>>> export it
>> 
>> AFAIU, it would be called from smpboot.c and setup.c. For the former, the
>> caller is mmu_init_secondary_cpu() which I think can be folded in head.S.
>> 
>> If we do that, then xen_pt_enforce_wnx() can be moved in setup.c and doesn't
>> need to be exported.
>> 
>>> static void clear_table()                                 -> mmu/smpboot.c
>>> void __init setup_pagetables()                            -> mmu/setup.c
>>> static void clear_boot_pagetables()                       -> mmu/smpboot.c
> 
> Why clear_table() and clear_boot_pagetables() in mmu/smpboot.c rather
> than mmu/setup.c ? It is OK either way as it does seem to make much of a
> difference but I am curious.

I think it is because below call sequence:
init_secondary_mm() -> clear_boot_pagetables() -> clear_table()

We have the suggestion from Julien that:
"File 2: Secondary CPUs MM bringup (mmu/smpboot.c)”, and hence
I suggested the smpboot.c

>> 
>> The placement of all the ones I didn't comment on look fine to me. It would 
>> be
>> good to have a second opinion from either Bertrand or Stefano before you 
>> start
>> moving the functions.
> 
> It looks good in principle and it also looks like a great clean up. It
> is not always super clear to me the distinction between mmu/pt.c,
> mmu/smpboot.c and mmu/setup.c but it doesn't seem important. The
> distinction between mmu/* and arch/arm/mm.c is clear and looks fine to
> me.

I generally followed:
"* File 1: Boot CPU0 MM bringup (mmu/setup.c)
 * File 2: Secondary CPUs MM bringup (mmu/smpboot.c)
 * File 3: Page tables update. (mmu/pt.c)"

> 
> I am looking forward to this!

+1, will post the updated patch soon!

Kind regards,
Henry



 


Rackspace

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