[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 1/5] x86: don't BUG() post-boot in alloc_xen_pagetable()
Instead, propagate the condition to the caller, all of which also get adjusted to check for that situation. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx> --- 2011-03-09.orig/xen/arch/x86/mm.c +++ 2011-03-09/xen/arch/x86/mm.c @@ -5141,8 +5141,11 @@ int map_pages_to_xen( while ( nr_mfns != 0 ) { #ifdef __x86_64__ - l3_pgentry_t *pl3e = virt_to_xen_l3e(virt); - l3_pgentry_t ol3e = *pl3e; + l3_pgentry_t ol3e, *pl3e = virt_to_xen_l3e(virt); + + if ( !pl3e ) + return -ENOMEM; + ol3e = *pl3e; if ( cpu_has_page1gb && !(((virt >> PAGE_SHIFT) | mfn) & @@ -5262,6 +5265,8 @@ int map_pages_to_xen( #endif pl2e = virt_to_xen_l2e(virt); + if ( !pl2e ) + return -ENOMEM; if ( ((((virt>>PAGE_SHIFT) | mfn) & ((1<<PAGETABLE_ORDER)-1)) == 0) && (nr_mfns >= (1<<PAGETABLE_ORDER)) && --- 2011-03-09.orig/xen/arch/x86/x86_32/mm.c +++ 2011-03-09/xen/arch/x86/x86_32/mm.c @@ -48,7 +48,8 @@ void *alloc_xen_pagetable(void) if ( !early_boot ) { void *v = alloc_xenheap_page(); - BUG_ON(v == NULL); + + BUG_ON(!dom0 && !v); return v; } --- 2011-03-09.orig/xen/arch/x86/x86_64/mm.c +++ 2011-03-09/xen/arch/x86/x86_64/mm.c @@ -84,8 +84,9 @@ void *alloc_xen_pagetable(void) if ( !early_boot ) { struct page_info *pg = alloc_domheap_page(NULL, 0); - BUG_ON(pg == NULL); - return page_to_virt(pg); + + BUG_ON(!dom0 && !pg); + return pg ? page_to_virt(pg) : NULL; } mfn = alloc_boot_pages(1, 1); @@ -100,6 +101,9 @@ l3_pgentry_t *virt_to_xen_l3e(unsigned l if ( !(l4e_get_flags(*pl4e) & _PAGE_PRESENT) ) { l3_pgentry_t *pl3e = alloc_xen_pagetable(); + + if ( !pl3e ) + return NULL; clear_page(pl3e); l4e_write(pl4e, l4e_from_paddr(__pa(pl3e), __PAGE_HYPERVISOR)); } @@ -112,9 +116,15 @@ l2_pgentry_t *virt_to_xen_l2e(unsigned l l3_pgentry_t *pl3e; pl3e = virt_to_xen_l3e(v); + if ( !pl3e ) + return NULL; + if ( !(l3e_get_flags(*pl3e) & _PAGE_PRESENT) ) { l2_pgentry_t *pl2e = alloc_xen_pagetable(); + + if ( !pl2e ) + return NULL; clear_page(pl2e); l3e_write(pl3e, l3e_from_paddr(__pa(pl2e), __PAGE_HYPERVISOR)); } Attachment:
x86-alloc_xen_pagetable-no-BUG.patch _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |