mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
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@novell.com>
This commit is contained in:
1 parent
28d6207bfc
commit
be68c24351
3 files changed
+21
-5
No files matched your search
+7
-2
@@ -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)) &&
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 long v)
|
||||
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 long v)
|
||||
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));
|
||||
}
|
||||
|
||||