# HG changeset patch
# User Jan Beulich <jbeulich@xxxxxxxxxx>
# Date 1299687299 0
# Node ID 1eeccafe904216589da600cd3e890021fbb3f951
# Parent b972a7f493252530c5ffdcf9b7e2c348f8a4ac32
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>
---
diff -r b972a7f49325 -r 1eeccafe9042 xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Wed Mar 09 10:49:19 2011 +0000
+++ b/xen/arch/x86/mm.c Wed Mar 09 16:14:59 2011 +0000
@@ -5141,8 +5141,11 @@
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 @@
#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)) &&
diff -r b972a7f49325 -r 1eeccafe9042 xen/arch/x86/x86_32/mm.c
--- a/xen/arch/x86/x86_32/mm.c Wed Mar 09 10:49:19 2011 +0000
+++ b/xen/arch/x86/x86_32/mm.c Wed Mar 09 16:14:59 2011 +0000
@@ -48,7 +48,8 @@
if ( !early_boot )
{
void *v = alloc_xenheap_page();
- BUG_ON(v == NULL);
+
+ BUG_ON(!dom0 && !v);
return v;
}
diff -r b972a7f49325 -r 1eeccafe9042 xen/arch/x86/x86_64/mm.c
--- a/xen/arch/x86/x86_64/mm.c Wed Mar 09 10:49:19 2011 +0000
+++ b/xen/arch/x86/x86_64/mm.c Wed Mar 09 16:14:59 2011 +0000
@@ -84,8 +84,9 @@
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 @@
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 @@
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));
}
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|