All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@arm.com>
To: Peng Fan <van.freenix@gmail.com>,
	xen-devel@lists.xen.org, sstabellini@kernel.org
Subject: Re: [PATCH] xen/arm: mm: optimize setup_pagetables
Date: Wed, 11 May 2016 10:31:49 +0100	[thread overview]
Message-ID: <5732FC05.1020504@arm.com> (raw)
In-Reply-To: <1462953598-20802-1-git-send-email-van.freenix@gmail.com>

Hi Peng,

I would rename the title: "xen/arm: mm: remove unnecessary tlb flush in 
setup_pagetables".

On 11/05/2016 08:59, Peng Fan wrote:
> Before relocating xen to high address, need to build
> the mapping BOOT_RELOC_VIRT_START to xen_paddr into
> boot_pgtable and xen_pgtable.
>
> In setup_pagetables, relocate_xen will switch the root
> page table from boot_pgtable to xen_pgtable/cpu0_pgtable.
>
> Before relocate_xen:
> If touching xen_pgtable, no need to flush_xen_data_tlb_range_va_local.
> We only need to flush tlb when touch boot_pgtable.
> And no need to use write_pte for xen_pgtable, we can simply use
> "xen_second[second_table_offset(dest_va)] = pte;"
>
> Also move the piece code near DTB/Fixmap/XEN_VIRT_START to
> be more easier to understand.

The commit message is rather hard to understand. Can you please rework 
it say:
   - CPU0 is using the boot pages table and xen_second is not part of 
them => No need to flush the TLB
   - Clean up the code (i.e the code movement)

However, I would prefer to see 2 patches, one for removing the tlb 
flush, the other to move the code.

[...]

> diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
> index 94ea054..bebd82f 100644
> --- a/xen/arch/arm/mm.c
> +++ b/xen/arch/arm/mm.c
> @@ -443,12 +443,6 @@ void __init setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr)
>       lpae_t pte, *p;
>       int i;
>
> -    /* Map the destination in the boot misc area. */
> -    dest_va = BOOT_RELOC_VIRT_START;
> -    pte = mfn_to_xen_entry(xen_paddr >> PAGE_SHIFT, WRITEALLOC);
> -    write_pte(xen_second + second_table_offset(dest_va), pte);
> -    flush_xen_data_tlb_range_va_local(dest_va, SECOND_SIZE);
> -
>       /* Calculate virt-to-phys offset for the new location */
>       phys_offset = xen_paddr - (unsigned long) _start;
>
> @@ -498,6 +492,11 @@ void __init setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr)
>       /* Map the destination in the boot misc area. */
>       dest_va = BOOT_RELOC_VIRT_START;
>       pte = mfn_to_xen_entry(xen_paddr >> PAGE_SHIFT, WRITEALLOC);
> +    xen_second[second_table_offset(dest_va)] = pte;
> +
> +    /* Map the destination in the boot misc area. */
> +    dest_va = BOOT_RELOC_VIRT_START;
> +    pte = mfn_to_xen_entry(xen_paddr >> PAGE_SHIFT, WRITEALLOC);

Why do you need to recompute "pte" and "dest_va"? They will be the same 
for "boot_second" and "xen_second".

Also, I think the code is still confusing in the current state because 
of the comments "Map the destination in the boot misc area.". They need 
to be updated to differentiate xen_second vs boot_second.

>       write_pte(boot_second + second_table_offset(dest_va), pte);
>       flush_xen_data_tlb_range_va_local(dest_va, SECOND_SIZE);
>   #ifdef CONFIG_ARM_64
>

Regards,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2016-05-11  9:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-11  7:59 [PATCH] xen/arm: mm: optimize setup_pagetables Peng Fan
2016-05-11  9:31 ` Julien Grall [this message]
2016-05-11  9:57   ` Peng Fan
2016-05-11 10:03     ` Julien Grall
2016-05-11 10:08       ` Peng Fan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5732FC05.1020504@arm.com \
    --to=julien.grall@arm.com \
    --cc=sstabellini@kernel.org \
    --cc=van.freenix@gmail.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.