ia64/xen-unstable

changeset 8605:4b1efe4c9e0b

Fix the issue of system crash in vmx stress test.
There is a path that shadow L2 table is assigned
after it is unshadowed in stress test.

Signed-off-by: Xiaofeng Ling <xiaofeng.ling@intel.com>
author kaf24@firebug.cl.cam.ac.uk
date Sat Jan 14 10:35:39 2006 +0100 (2006-01-14)
parents 468d2a6fc0af
children ef88c2db00ad
files xen/arch/x86/shadow.c xen/arch/x86/shadow32.c
line diff
     1.1 --- a/xen/arch/x86/shadow.c	Fri Jan 13 23:41:28 2006 +0100
     1.2 +++ b/xen/arch/x86/shadow.c	Sat Jan 14 10:35:39 2006 +0100
     1.3 @@ -2138,6 +2138,7 @@ static void shadow_update_pagetables(str
     1.4  #if CONFIG_PAGING_LEVELS == 2
     1.5      unsigned long hl2mfn;
     1.6  #endif
     1.7 +    int need_sync = 0;
     1.8  
     1.9      int max_mode = ( shadow_mode_external(d) ? SHM_external
    1.10                       : shadow_mode_translate(d) ? SHM_translate
    1.11 @@ -2169,8 +2170,17 @@ static void shadow_update_pagetables(str
    1.12  #elif CONFIG_PAGING_LEVELS == 4
    1.13          smfn = shadow_l4_table(d, gpfn, gmfn);
    1.14  #endif
    1.15 -    }else
    1.16 -        shadow_sync_all(d);
    1.17 +    }
    1.18 +    else
    1.19 +    {
    1.20 +        /*
    1.21 +         *  move sync later in order to avoid this smfn been 
    1.22 +         *  unshadowed occasionally
    1.23 +         */
    1.24 +        need_sync = 1;
    1.25 +    }
    1.26 +
    1.27 +
    1.28      if ( !get_shadow_ref(smfn) )
    1.29          BUG();
    1.30      old_smfn = pagetable_get_pfn(v->arch.shadow_table);
    1.31 @@ -2241,6 +2251,9 @@ static void shadow_update_pagetables(str
    1.32      }
    1.33  #endif /* CONFIG_PAGING_LEVELS == 2 */
    1.34  
    1.35 +    if(likely(need_sync))
    1.36 +        shadow_sync_all(d);
    1.37 +
    1.38  #if CONFIG_PAGING_LEVELS == 3
    1.39      /* FIXME: PAE code to be written */
    1.40  #endif
     2.1 --- a/xen/arch/x86/shadow32.c	Fri Jan 13 23:41:28 2006 +0100
     2.2 +++ b/xen/arch/x86/shadow32.c	Sat Jan 14 10:35:39 2006 +0100
     2.3 @@ -2896,6 +2896,7 @@ void __update_pagetables(struct vcpu *v)
     2.4      unsigned long gmfn = pagetable_get_pfn(v->arch.guest_table);
     2.5      unsigned long gpfn = __mfn_to_gpfn(d, gmfn);
     2.6      unsigned long smfn, hl2mfn, old_smfn;
     2.7 +    int need_sync = 0;
     2.8  
     2.9      int max_mode = ( shadow_mode_external(d) ? SHM_external
    2.10                       : shadow_mode_translate(d) ? SHM_translate
    2.11 @@ -2921,7 +2922,13 @@ void __update_pagetables(struct vcpu *v)
    2.12      if ( unlikely(!(smfn = __shadow_status(d, gpfn, PGT_base_page_table))) )
    2.13          smfn = shadow_l2_table(d, gpfn, gmfn);
    2.14      else
    2.15 -        shadow_sync_all(d);
    2.16 +    {
    2.17 +        /*
    2.18 +         *  move sync later in order to avoid this smfn been 
    2.19 +         *  unshadowed occasionally
    2.20 +         */
    2.21 +        need_sync = 1;
    2.22 +    }
    2.23      if ( !get_shadow_ref(smfn) )
    2.24          BUG();
    2.25      old_smfn = pagetable_get_pfn(v->arch.shadow_table);
    2.26 @@ -2985,6 +2992,9 @@ void __update_pagetables(struct vcpu *v)
    2.27          // XXX - maybe this can be optimized somewhat??
    2.28          local_flush_tlb();
    2.29      }
    2.30 +
    2.31 +    if(likely(need_sync))
    2.32 +        shadow_sync_all(d);
    2.33  }
    2.34  
    2.35  void clear_all_shadow_status(struct domain *d)