Re: [Xen-devel] Re: [PATCH 00 of 36] x86/paravirt: groundwork for 64-bit Xen support

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jeremy Fitzhardinge
Date: Monday, June 30, 2008 - 4:04 pm

Ingo Molnar wrote:

Phew.  OK, I've worked this out.  Short version is that's it's a false 
alarm, and there was no real failure here.  Long version:

    * I changed the code to create the physical mapping pagetables to
      reuse any existing mapping rather than replace it.   Specifically,
      reusing an pud pointed to by the pgd caused this symptom to appear.
    * The specific PUD being reused is the one created statically in
      head_64.S, which creates an initial 1GB mapping.
    * That mapping doesn't have _PAGE_GLOBAL set on it, due to the
      inconsistency between __PAGE_* and PAGE_*.
    * The CPA test attempts to clear _PAGE_GLOBAL, and then checks to
      see that the resulting range is 1) shattered into 4k pages, and 2)
      has no _PAGE_GLOBAL.
    * However, since it didn't have _PAGE_GLOBAL on that range to start
      with, change_page_attr_clear() had nothing to do, and didn't
      bother shattering the range,
    * resulting in the reported messages

The simple fix is to set _PAGE_GLOBAL in level2_ident_pgt.

An additional fix to make CPA testing more robust by using some other 
pagetable bit (one of the unused available-to-software ones).  This 
would solve spurious CPA test warnings under Xen which uses _PAGE_GLOBAL 
for its own purposes (ie, not under guest control).

Also, we should revisit the use of _PAGE_GLOBAL in asm-x86/pgtable.h, 
and use it consistently, and drop MAKE_GLOBAL.  The first time I 
proposed it it caused breakages in the very early CPA code; with luck 
that's all fixed now.

Anyway, the simple fix below.  I'll put together RFC patches for the 
other suggestions.  I also split the originating patch into tiny, tiny 
bisectable pieces.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>

---
 arch/x86/kernel/head_64.S |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

===================================================================
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -374,7 +374,7 @@
 	/* Since I easily can, map the first 1G.
 	 * Don't set NX because code runs from these pages.
 	 */
-	PMDS(0, __PAGE_KERNEL_LARGE_EXEC, PTRS_PER_PMD)
+	PMDS(0, __PAGE_KERNEL_LARGE_EXEC | _PAGE_GLOBAL, PTRS_PER_PMD)
 
 NEXT_PAGE(level2_kernel_pgt)
 	/*


--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 00 of 36] x86/paravirt: groundwork for 64-bit Xen s ..., Jeremy Fitzhardinge, (Tue Jun 24, 9:18 pm)
[PATCH 01 of 36] x86: asm-x86/pgtable.h: fix compiler warning, Jeremy Fitzhardinge, (Tue Jun 24, 9:18 pm)
[PATCH 02 of 36] x86: add memory clobber to save/loadsegment, Jeremy Fitzhardinge, (Tue Jun 24, 9:18 pm)
[PATCH 03 of 36] x86: add memory barriers to wrmsr, Jeremy Fitzhardinge, (Tue Jun 24, 9:18 pm)
[PATCH 04 of 36] x86: remove open-coded save/load segment ..., Jeremy Fitzhardinge, (Tue Jun 24, 9:19 pm)
[PATCH 05 of 36] x86_64: use write_gdt_entry in vsyscall_s ..., Jeremy Fitzhardinge, (Tue Jun 24, 9:19 pm)
[PATCH 06 of 36] x86_64: use p??_populate() to attach page ..., Jeremy Fitzhardinge, (Tue Jun 24, 9:19 pm)
[PATCH 07 of 36] x86_64: unify early_ioremap, Jeremy Fitzhardinge, (Tue Jun 24, 9:19 pm)
[PATCH 08 of 36] x86_64: Add gate_offset() and gate_segmen ..., Jeremy Fitzhardinge, (Tue Jun 24, 9:19 pm)
[PATCH 09 of 36] x86_64: Use __pgd() on mk_kernel_pgd(), Jeremy Fitzhardinge, (Tue Jun 24, 9:19 pm)
[PATCH 10 of 36] x86: unify pgd_index, Jeremy Fitzhardinge, (Tue Jun 24, 9:19 pm)
[PATCH 11 of 36] x86: unify mmu_context.h, Jeremy Fitzhardinge, (Tue Jun 24, 9:19 pm)
[PATCH 12 of 36] x86_64: replace end_pfn with num_physpages, Jeremy Fitzhardinge, (Tue Jun 24, 9:19 pm)
[PATCH 13 of 36] x86_64: add prototype for x86_64_start_ke ..., Jeremy Fitzhardinge, (Tue Jun 24, 9:19 pm)
[PATCH 14 of 36] x86_64: add sync_cmpxchg, Jeremy Fitzhardinge, (Tue Jun 24, 9:19 pm)
[PATCH 15 of 36] x86: simplify vmalloc_sync_all, Jeremy Fitzhardinge, (Tue Jun 24, 9:19 pm)
[PATCH 16 of 36] x86/paravirt: add a pgd_alloc/free hooks, Jeremy Fitzhardinge, (Tue Jun 24, 9:19 pm)
[PATCH 17 of 36] x86: preallocate and prepopulate separately, Jeremy Fitzhardinge, (Tue Jun 24, 9:19 pm)
[PATCH 18 of 36] x86/paravirt: add debugging for missing o ..., Jeremy Fitzhardinge, (Tue Jun 24, 9:19 pm)
[PATCH 19 of 36] paravirt_ops: define PARA_INDIRECT for in ..., Jeremy Fitzhardinge, (Tue Jun 24, 9:19 pm)
[PATCH 20 of 36] paravirt/x86_64: move __PAGE_OFFSET to le ..., Jeremy Fitzhardinge, (Tue Jun 24, 9:19 pm)
[PATCH 21 of 36] x86-64: add FIX_PARAVIRT_BOOTMAP fixmap slot, Jeremy Fitzhardinge, (Tue Jun 24, 9:19 pm)
[PATCH 22 of 36] x86_64: split x86_64_start_kernel, Jeremy Fitzhardinge, (Tue Jun 24, 9:19 pm)
[PATCH 23 of 36] x86_64: adjust mapping of physical pageta ..., Jeremy Fitzhardinge, (Tue Jun 24, 9:19 pm)
[PATCH 24 of 36] x86_64: create small vmemmap mappings if ..., Jeremy Fitzhardinge, (Tue Jun 24, 9:19 pm)
[PATCH 25 of 36] x86_64: PSE no longer a hard requirement, Jeremy Fitzhardinge, (Tue Jun 24, 9:19 pm)
[PATCH 26 of 36] x86_64: Split set_pte_vaddr(), Jeremy Fitzhardinge, (Tue Jun 24, 9:19 pm)
[PATCH 27 of 36] x86_64: __switch_to(): Move arch_leave_la ..., Jeremy Fitzhardinge, (Tue Jun 24, 9:19 pm)
[PATCH 28 of 36] Save %fs and %gs before load_TLS() and ar ..., Jeremy Fitzhardinge, (Tue Jun 24, 9:19 pm)
[PATCH 29 of 36] Use __KERNEL_DS as SS when returning to a ..., Jeremy Fitzhardinge, (Tue Jun 24, 9:19 pm)
[PATCH 30 of 36] x86/paravirt_ops: split sysret and sysexit, Jeremy Fitzhardinge, (Tue Jun 24, 9:19 pm)
[PATCH 31 of 36] x86_64 pvops: don't restore user rsp with ..., Jeremy Fitzhardinge, (Tue Jun 24, 9:19 pm)
[PATCH 32 of 36] Add sysret/sysexit pvops for returning to ..., Jeremy Fitzhardinge, (Tue Jun 24, 9:19 pm)
[PATCH 33 of 36] x86_64: ia32entry: replace privileged ins ..., Jeremy Fitzhardinge, (Tue Jun 24, 9:19 pm)
[PATCH 34 of 36] x86_64: swapgs pvop with a user-stack can ..., Jeremy Fitzhardinge, (Tue Jun 24, 9:19 pm)
[PATCH 35 of 36] x86_64/paravirt: add adjust_exception_frame, Jeremy Fitzhardinge, (Tue Jun 24, 9:19 pm)
[PATCH 36 of 36] x86_64/paravirt: Make load_gs_index() a p ..., Jeremy Fitzhardinge, (Tue Jun 24, 9:19 pm)
Re: [PATCH 03 of 36] x86: add memory barriers to wrmsr, Arjan van de Ven, (Tue Jun 24, 9:44 pm)
Re: [PATCH 00 of 36] x86/paravirt: groundwork for 64-bit X ..., Jeremy Fitzhardinge, (Wed Jun 25, 4:46 am)
Re: [PATCH 36 of 36] x86_64/paravirt: Make load_gs_index() ..., Jeremy Fitzhardinge, (Wed Jun 25, 4:48 am)
Re: [PATCH 00 of 36] x86/paravirt: groundwork for 64-bit X ..., Jeremy Fitzhardinge, (Wed Jun 25, 1:03 pm)
Re: [PATCH 00 of 36] x86/paravirt: groundwork for 64-bit X ..., Jeremy Fitzhardinge, (Wed Jun 25, 1:12 pm)
Re: [PATCH 03 of 36] x86: add memory barriers to wrmsr, Jeremy Fitzhardinge, (Wed Jun 25, 2:08 pm)
Re: [PATCH 03 of 36] x86: add memory barriers to wrmsr, Arjan van de Ven, (Wed Jun 25, 3:31 pm)
Re: [PATCH 03 of 36] x86: add memory barriers to wrmsr, Jeremy Fitzhardinge, (Wed Jun 25, 4:05 pm)
Re: [PATCH 03 of 36] x86: add memory barriers to wrmsr, H. Peter Anvin, (Wed Jun 25, 4:18 pm)
Re: [PATCH 03 of 36] x86: add memory barriers to wrmsr, Jeremy Fitzhardinge, (Wed Jun 25, 4:37 pm)
Re: [PATCH 03 of 36] x86: add memory barriers to wrmsr, H. Peter Anvin, (Wed Jun 25, 4:42 pm)
Re: [PATCH 00 of 36] x86/paravirt: groundwork for 64-bit X ..., Jeremy Fitzhardinge, (Thu Jun 26, 7:28 am)
Re: [Xen-devel] Re: [PATCH 00 of 36] x86/paravirt: groundw ..., Jeremy Fitzhardinge, (Thu Jun 26, 7:34 am)
Re: [PATCH 00 of 36] x86/paravirt: groundwork for 64-bit X ..., Jeremy Fitzhardinge, (Thu Jun 26, 11:25 am)
Re: [PATCH 00 of 36] x86/paravirt: groundwork for 64-bit X ..., Jeremy Fitzhardinge, (Thu Jun 26, 12:02 pm)
Re: [Xen-devel] Re: [PATCH 00 of 36] x86/paravirt: groundw ..., Jeremy Fitzhardinge, (Fri Jun 27, 9:02 am)
Re: [Xen-devel] Re: [PATCH 00 of 36] x86/paravirt: groundw ..., Jeremy Fitzhardinge, (Fri Jun 27, 9:25 am)
Re: [Xen-devel] Re: [PATCH 00 of 36] x86/paravirt: groundw ..., Jeremy Fitzhardinge, (Fri Jun 27, 12:04 pm)
Re: [Xen-devel] Re: [PATCH 00 of 36] x86/paravirt: groundw ..., Jeremy Fitzhardinge, (Sun Jun 29, 8:02 pm)
Re: [Xen-devel] Re: [PATCH 00 of 36] x86/paravirt: groundw ..., Jeremy Fitzhardinge, (Sun Jun 29, 10:32 pm)
Re: [Xen-devel] Re: [PATCH 00 of 36] x86/paravirt: groundw ..., Jeremy Fitzhardinge, (Mon Jun 30, 10:17 am)
Re: [Xen-devel] Re: [PATCH 00 of 36] x86/paravirt: groundw ..., Jeremy Fitzhardinge, (Mon Jun 30, 10:57 am)
Re: [Xen-devel] Re: [PATCH 00 of 36] x86/paravirt: groundw ..., Jeremy Fitzhardinge, (Mon Jun 30, 11:36 am)
Re: [Xen-devel] Re: [PATCH 00 of 36] x86/paravirt: groundw ..., Jeremy Fitzhardinge, (Mon Jun 30, 4:04 pm)
Re: [Xen-devel] Re: [PATCH 00 of 36] x86/paravirt: groundw ..., Jeremy Fitzhardinge, (Tue Jul 1, 9:10 am)
Re: [Xen-devel] Re: [PATCH 00 of 36] x86/paravirt: groundw ..., Jeremy Fitzhardinge, (Tue Jul 1, 9:14 am)
Re: [Xen-devel] Re: [PATCH 00 of 36] x86/paravirt: groundw ..., Jeremy Fitzhardinge, (Thu Jul 3, 8:47 am)
Re: [Xen-devel] Re: [PATCH 00 of 36] x86/paravirt: groundw ..., Jeremy Fitzhardinge, (Thu Jul 3, 11:25 am)
Re: [Xen-devel] Re: [PATCH 00 of 36] x86/paravirt: groundw ..., Jeremy Fitzhardinge, (Thu Jul 3, 11:41 am)