From: kaf24@firebug.cl.cam.ac.uk Date: Sat, 14 Jan 2006 09:35:39 +0000 (+0100) Subject: Fix the issue of system crash in vmx stress test. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~16541^2~39 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=b395f5ac6dc412c103599a4da3b74cf8ea4bdb0c;p=xen.git 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 --- diff --git a/xen/arch/x86/shadow.c b/xen/arch/x86/shadow.c index b2fd143452..6ae54e208a 100644 --- a/xen/arch/x86/shadow.c +++ b/xen/arch/x86/shadow.c @@ -2138,6 +2138,7 @@ static void shadow_update_pagetables(struct vcpu *v) #if CONFIG_PAGING_LEVELS == 2 unsigned long hl2mfn; #endif + int need_sync = 0; int max_mode = ( shadow_mode_external(d) ? SHM_external : shadow_mode_translate(d) ? SHM_translate @@ -2169,8 +2170,17 @@ static void shadow_update_pagetables(struct vcpu *v) #elif CONFIG_PAGING_LEVELS == 4 smfn = shadow_l4_table(d, gpfn, gmfn); #endif - }else - shadow_sync_all(d); + } + else + { + /* + * move sync later in order to avoid this smfn been + * unshadowed occasionally + */ + need_sync = 1; + } + + if ( !get_shadow_ref(smfn) ) BUG(); old_smfn = pagetable_get_pfn(v->arch.shadow_table); @@ -2241,6 +2251,9 @@ static void shadow_update_pagetables(struct vcpu *v) } #endif /* CONFIG_PAGING_LEVELS == 2 */ + if(likely(need_sync)) + shadow_sync_all(d); + #if CONFIG_PAGING_LEVELS == 3 /* FIXME: PAE code to be written */ #endif diff --git a/xen/arch/x86/shadow32.c b/xen/arch/x86/shadow32.c index eb09ea92c5..a36238b3d8 100644 --- a/xen/arch/x86/shadow32.c +++ b/xen/arch/x86/shadow32.c @@ -2896,6 +2896,7 @@ void __update_pagetables(struct vcpu *v) unsigned long gmfn = pagetable_get_pfn(v->arch.guest_table); unsigned long gpfn = __mfn_to_gpfn(d, gmfn); unsigned long smfn, hl2mfn, old_smfn; + int need_sync = 0; int max_mode = ( shadow_mode_external(d) ? SHM_external : shadow_mode_translate(d) ? SHM_translate @@ -2921,7 +2922,13 @@ void __update_pagetables(struct vcpu *v) if ( unlikely(!(smfn = __shadow_status(d, gpfn, PGT_base_page_table))) ) smfn = shadow_l2_table(d, gpfn, gmfn); else - shadow_sync_all(d); + { + /* + * move sync later in order to avoid this smfn been + * unshadowed occasionally + */ + need_sync = 1; + } if ( !get_shadow_ref(smfn) ) BUG(); old_smfn = pagetable_get_pfn(v->arch.shadow_table); @@ -2985,6 +2992,9 @@ void __update_pagetables(struct vcpu *v) // XXX - maybe this can be optimized somewhat?? local_flush_tlb(); } + + if(likely(need_sync)) + shadow_sync_all(d); } void clear_all_shadow_status(struct domain *d)