Skip to contentSkip to conversation

xen/arm: mm: remove unnecessary tlb flush in setup_pagetables

PATCH In review Peng Fan 3 participants 4 messages May 12, 2016 – May 16, 2016

lore
Share & tools
lore

Peng Fan

author
#0 lore raw

PATCH v3 1/2 xen/arm: mm: remove unnecessary tlb flush in setup_pagetables

CPU0 is using the boot pages table before relocating xen and xen_second is not part of them. So, no need to flush the TLB when filling xen_second.

Cc Stefano Stabellini <[email protected]>
Cc Julien Grall <[email protected]>

---
V3:
Add Julien's review tag.

V2:
Following Julien's comments:
split the V1 patch into two patches. This patch only remove tlb flush. refine commit log

 xen/arch/arm/mm.c | 1 -
 1 file changed, 1 deletion(-)
xen/arch/arm/mm.c +0 -1
index 94ea054..addd699 100644
@@ -447,7 +447,6 @@ void __init setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr)
     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;
Signature · 7 lines
2.6.2


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
author
#1 lore raw

PATCH v3 2/2 xen/arm: mm: clean up code in setup_pagetables

The base of address for the relocated xen needs to be mapped at the same virtual address (BOOT_RELOC_VIRT_START) in both the boot and runtime page tables. So we can merge the two pieces of code into on code block

Also no need to use write_pte when mapping BOOT_RELOC_VIRT_START in xen_second, because CPU0 is using boot page tables.

Cc Stefano Stabellini <[email protected]>
Cc Julien Grall <[email protected]>

---

V3:
Refine the commit log.

V2:
Follow Julien's comments:
split the V1 patch into two patches, this patch is the code movement part.

 xen/arch/arm/mm.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
xen/arch/arm/mm.c +4 -6
index addd699..0a4f845 100644
@@ -443,11 +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);
-
     /* Calculate virt-to-phys offset for the new location */
     phys_offset = xen_paddr - (unsigned long) _start;
 
@@ -494,9 +489,12 @@ void __init setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr)
     pte = boot_second[second_table_offset(BOOT_FDT_VIRT_START)];
     xen_second[second_table_offset(BOOT_FDT_VIRT_START)] = pte;
 
-    /* Map the destination in the boot misc area. */
+    /* ... Boot Misc area for xen relocation */
     dest_va = BOOT_RELOC_VIRT_START;
     pte = mfn_to_xen_entry(xen_paddr >> PAGE_SHIFT, WRITEALLOC);
+    /* Map the destination in xen_second. */
+    xen_second[second_table_offset(dest_va)] = pte;
+    /* Map the destination in 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
Signature · 7 lines
2.6.2


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Reviewed-by on v3 2/2
#2 lore raw

Re: [PATCH V3 2/2] xen/arm: mm: clean up code in setup_pagetables

Hi Peng,

Quoted 4 lines · Peng Fan

The base of address for the relocated xen needs to be mapped at the same virtual address (BOOT_RELOC_VIRT_START) in both the boot and runtime page tables. So we can merge the two pieces of code into on code block

s/on/one/ and missing full stop.

Quoted 7 lines

Also no need to use write_pte when mapping BOOT_RELOC_VIRT_START in xen_second, because CPU0 is using boot page tables.

Cc Stefano Stabellini <[email protected]>
Cc Julien Grall <[email protected]>

With the typos above fixed:

Stefano, could you fix the typos before applying this series to your Xen 4.8 branch?

Regards,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#3 lore raw

Re: [PATCH V3 2/2] xen/arm: mm: clean up code in setup_pagetables

Quoted 18 lines · Julien Grall

Hi Peng,

Quoted 4 lines · Peng Fan

The base of address for the relocated xen needs to be mapped at the same virtual address (BOOT_RELOC_VIRT_START) in both the boot and runtime page tables. So we can merge the two pieces of code into on code block

s/on/one/ and missing full stop.

Quoted 7 lines

Also no need to use write_pte when mapping BOOT_RELOC_VIRT_START in xen_second, because CPU0 is using boot page tables.

Cc Stefano Stabellini <[email protected]>
Cc Julien Grall <[email protected]>
Quoted 6 lines

With the typos above fixed:

Stefano, could you fix the typos before applying this series to your Xen 4.8 branch?

Done

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel