[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] Fix cleanup path if an HVM guest fails very early, before direct map is built.
# HG changeset patch # User kaf24@xxxxxxxxxxxxxxxxxxxx # Node ID 1fd6e9c32b034126128ff4fcd2bb6d209446d146 # Parent e8d04411931640322013a1f97726ce64137e94ce Fix cleanup path if an HVM guest fails very early, before direct map is built. Signed-off-by: Xin Li <xin.b.li@xxxxxxxxx> diff -r e8d044119316 -r 1fd6e9c32b03 xen/arch/x86/shadow32.c --- a/xen/arch/x86/shadow32.c Tue Feb 21 17:19:16 2006 +++ b/xen/arch/x86/shadow32.c Tue Feb 21 17:21:13 2006 @@ -1110,22 +1110,30 @@ void shadow_direct_map_clean(struct vcpu *v) { int i; + unsigned long mfn; + struct domain *d = v->domain; l2_pgentry_t *l2e; - l2e = map_domain_page( - pagetable_get_pfn(v->domain->arch.phys_table)); + mfn = pagetable_get_pfn(d->arch.phys_table); + + /* + * We may fail very early before direct map is built. + */ + if ( !mfn ) + return; + + l2e = map_domain_page(mfn); for ( i = 0; i < L2_PAGETABLE_ENTRIES; i++ ) { if ( l2e_get_flags(l2e[i]) & _PAGE_PRESENT ) free_domheap_page(mfn_to_page(l2e_get_pfn(l2e[i]))); } - - free_domheap_page( - mfn_to_page(pagetable_get_pfn(v->domain->arch.phys_table))); + free_domheap_page(mfn_to_page(mfn)); unmap_domain_page(l2e); - v->domain->arch.phys_table = mk_pagetable(0); + + d->arch.phys_table = mk_pagetable(0); } int __shadow_mode_enable(struct domain *d, unsigned int mode) diff -r e8d044119316 -r 1fd6e9c32b03 xen/arch/x86/shadow_public.c --- a/xen/arch/x86/shadow_public.c Tue Feb 21 17:19:16 2006 +++ b/xen/arch/x86/shadow_public.c Tue Feb 21 17:21:13 2006 @@ -59,12 +59,21 @@ void shadow_direct_map_clean(struct vcpu *v) { + unsigned long mfn; + struct domain *d = v->domain; l2_pgentry_t *l2e; l3_pgentry_t *l3e; int i, j; - l3e = (l3_pgentry_t *)map_domain_page( - pagetable_get_pfn(v->domain->arch.phys_table)); + mfn = pagetable_get_pfn(d->arch.phys_table); + + /* + * We may fail very early before direct map is built. + */ + if ( !mfn ) + return; + + l3e = (l3_pgentry_t *)map_domain_page(mfn); for ( i = 0; i < PAE_L3_PAGETABLE_ENTRIES; i++ ) { @@ -81,12 +90,11 @@ free_domheap_page(mfn_to_page(l3e_get_pfn(l3e[i]))); } } - - free_domheap_page( - mfn_to_page(pagetable_get_pfn(v->domain->arch.phys_table))); + free_domheap_page(mfn_to_page(mfn)); unmap_domain_page(l3e); - v->domain->arch.phys_table = mk_pagetable(0); + + d->arch.phys_table = mk_pagetable(0); } /****************************************************************************/ _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |