direct-io.hg

changeset 10467:69f7e0ea2985

[XEN] Fix PAE PDPT shadowing coherence.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Tue Jun 20 17:04:13 2006 +0100 (2006-06-20)
parents 46e853c34a2e
children 06b10ad218f4
files xen/arch/x86/mm.c
line diff
     1.1 --- a/xen/arch/x86/mm.c	Tue Jun 20 14:45:46 2006 +0100
     1.2 +++ b/xen/arch/x86/mm.c	Tue Jun 20 17:04:13 2006 +0100
     1.3 @@ -268,18 +268,20 @@ void share_xen_page_with_privileged_gues
     1.4  
     1.5  #if defined(CONFIG_X86_PAE)
     1.6  
     1.7 -#if 1 /*def NDEBUG*/ /* KAF: Non-debug case is suspect: let's always use it. */
     1.8 +#ifdef NDEBUG
     1.9  /* Only PDPTs above 4GB boundary need to be shadowed in low memory. */
    1.10  #define l3tab_needs_shadow(mfn) ((mfn) >= 0x100000)
    1.11  #else
    1.12  /*
    1.13 - * In debug builds we aggressively shadow PDPTs to exercise code paths.
    1.14 + * In debug builds we shadow a selection of <4GB PDPTs to exercise code paths.
    1.15   * We cannot safely shadow the idle page table, nor shadow-mode page tables
    1.16 - * (detected by lack of an owning domain). Always shadow PDPTs above 4GB.
    1.17 + * (detected by lack of an owning domain). As required for correctness, we
    1.18 + * always shadow PDPTs aboive 4GB.
    1.19   */
    1.20  #define l3tab_needs_shadow(mfn)                         \
    1.21      (((((mfn) << PAGE_SHIFT) != __pa(idle_pg_table)) && \
    1.22 -      (page_get_owner(mfn_to_page(mfn)) != NULL)) ||    \
    1.23 +      (page_get_owner(mfn_to_page(mfn)) != NULL) &&     \
    1.24 +      ((mfn) & 1)) || /* odd MFNs are shadowed */       \
    1.25       ((mfn) >= 0x100000))
    1.26  #endif
    1.27  
    1.28 @@ -305,6 +307,8 @@ static void __write_ptbase(unsigned long
    1.29      if ( !l3tab_needs_shadow(mfn) )
    1.30      {
    1.31          write_cr3(mfn << PAGE_SHIFT);
    1.32 +        /* Cache is no longer in use or valid (/after/ write to %cr3). */
    1.33 +        cache->high_mfn = 0;
    1.34          return;
    1.35      }
    1.36