ia64/xen-unstable
changeset 18842:9be2fe3de567
shadow: fix the fix for promotion/resync race.
Signed-off-by: Gianluca Guida <gianluca.guida@eu.citrix.com>
Signed-off-by: Gianluca Guida <gianluca.guida@eu.citrix.com>
author | Keir Fraser <keir.fraser@citrix.com> |
---|---|
date | Fri Nov 28 12:02:43 2008 +0000 (2008-11-28) |
parents | 90ed7af65570 |
children | abada55aec43 |
files | xen/arch/x86/mm/shadow/multi.c |
line diff
1.1 --- a/xen/arch/x86/mm/shadow/multi.c Thu Nov 27 16:22:14 2008 +0000 1.2 +++ b/xen/arch/x86/mm/shadow/multi.c Fri Nov 28 12:02:43 2008 +0000 1.3 @@ -1886,13 +1886,6 @@ static shadow_l1e_t * shadow_get_and_cre 1.4 if ( r & SHADOW_SET_ERROR ) 1.5 return NULL; 1.6 1.7 -#if (SHADOW_OPTIMIZATIONS && SHOPT_OUT_OF_SYNC ) 1.8 - /* All pages walked are now pagetables. Safe to resync pages 1.9 - in case level 4 or 3 shadows were set. */ 1.10 - if ( resync ) 1.11 - shadow_resync_all(v, 0); 1.12 -#endif 1.13 - 1.14 /* This next line is important: in 32-on-PAE and 32-on-64 modes, 1.15 * the guest l1 table has an 8k shadow, and we need to return 1.16 * the right mfn of the pair. This call will set it for us as a 1.17 @@ -1900,6 +1893,14 @@ static shadow_l1e_t * shadow_get_and_cre 1.18 * compiled out.) */ 1.19 (void) shadow_l1_index(sl1mfn, guest_l1_table_offset(gw->va)); 1.20 } 1.21 + 1.22 +#if (SHADOW_OPTIMIZATIONS && SHOPT_OUT_OF_SYNC ) 1.23 + /* All pages walked are now pagetables. Safe to resync pages 1.24 + in case level 4 or 3 shadows were set. */ 1.25 + if ( resync ) 1.26 + shadow_resync_all(v, 0); 1.27 +#endif 1.28 + 1.29 /* Now follow it down a level. Guaranteed to succeed. */ 1.30 return sh_linear_l1_table(v) + shadow_l1_linear_offset(gw->va); 1.31 } 1.32 @@ -2176,7 +2177,8 @@ static int validate_gl4e(struct vcpu *v, 1.33 result |= SHADOW_SET_ERROR; 1.34 1.35 #if (SHADOW_OPTIMIZATIONS && SHOPT_OUT_OF_SYNC ) 1.36 - shadow_resync_all(v, 0); 1.37 + if ( mfn_valid(sl3mfn) ) 1.38 + shadow_resync_all(v, 0); 1.39 #endif 1.40 } 1.41 l4e_propagate_from_guest(v, new_gl4e, sl3mfn, &new_sl4e, ft_prefetch); 1.42 @@ -2232,7 +2234,8 @@ static int validate_gl3e(struct vcpu *v, 1.43 result |= SHADOW_SET_ERROR; 1.44 1.45 #if (SHADOW_OPTIMIZATIONS && SHOPT_OUT_OF_SYNC ) 1.46 - shadow_resync_all(v, 0); 1.47 + if ( mfn_valid(sl2mfn) ) 1.48 + shadow_resync_all(v, 0); 1.49 #endif 1.50 } 1.51 l3e_propagate_from_guest(v, new_gl3e, sl2mfn, &new_sl3e, ft_prefetch);