ia64/xen-unstable

changeset 10118:3c2e7925bb93

[SHADOW] Crash the guest rather than BUGing the whole system when out of memory.
Signed-off-by: Yunhong Jiang <yunhong.jiang@intel.com>
author kaf24@firebug.cl.cam.ac.uk
date Fri May 19 17:50:32 2006 +0100 (2006-05-19)
parents d0d9f50517f7
children 08353fdf4031
files xen/arch/x86/shadow.c xen/arch/x86/shadow32.c xen/arch/x86/shadow_public.c
line diff
     1.1 --- a/xen/arch/x86/shadow.c	Fri May 19 17:31:34 2006 +0100
     1.2 +++ b/xen/arch/x86/shadow.c	Fri May 19 17:50:32 2006 +0100
     1.3 @@ -430,7 +430,8 @@ no_shadow_page:
     1.4             perfc_value(shadow_l2_pages),
     1.5             perfc_value(hl2_table_pages),
     1.6             perfc_value(snapshot_pages));
     1.7 -    BUG(); /* XXX FIXME: try a shadow flush to free up some memory. */
     1.8 +    /* XXX FIXME: try a shadow flush to free up some memory. */
     1.9 +    domain_crash_synchronous();
    1.10  
    1.11      return 0;
    1.12  }
    1.13 @@ -3064,7 +3065,8 @@ static inline unsigned long init_bl2(
    1.14      if ( unlikely(!(smfn = alloc_shadow_page(d, gpfn, gmfn, PGT_l4_shadow))) )
    1.15      {
    1.16          printk("Couldn't alloc an L4 shadow for pfn=%lx mfn=%lx\n", gpfn, gmfn);
    1.17 -        BUG(); /* XXX Deal gracefully with failure. */
    1.18 +        /* XXX Deal gracefully with failure. */
    1.19 +        domain_crash_synchronous();
    1.20      }
    1.21  
    1.22      spl4e = (l4_pgentry_t *)map_domain_page(smfn);
     2.1 --- a/xen/arch/x86/shadow32.c	Fri May 19 17:31:34 2006 +0100
     2.2 +++ b/xen/arch/x86/shadow32.c	Fri May 19 17:50:32 2006 +0100
     2.3 @@ -246,7 +246,8 @@ alloc_shadow_page(struct domain *d,
     2.4                 perfc_value(shadow_l2_pages),
     2.5                 perfc_value(hl2_table_pages),
     2.6                 perfc_value(snapshot_pages));
     2.7 -        BUG(); /* XXX FIXME: try a shadow flush to free up some memory. */
     2.8 +        /* XXX FIXME: try a shadow flush to free up some memory. */
     2.9 +        domain_crash_synchronous();
    2.10      }
    2.11  
    2.12      smfn = page_to_mfn(page);
    2.13 @@ -983,6 +984,11 @@ alloc_p2m_table(struct domain *d)
    2.14      else
    2.15      {
    2.16          page = alloc_domheap_page(NULL);
    2.17 +        if (!page)
    2.18 +        {
    2.19 +            printk("Alloc p2m table fail\n");
    2.20 +            domain_crash(d);
    2.21 +        }
    2.22  
    2.23          l1tab = map_domain_page(page_to_mfn(page));
    2.24          memset(l1tab, 0, PAGE_SIZE);
     3.1 --- a/xen/arch/x86/shadow_public.c	Fri May 19 17:31:34 2006 +0100
     3.2 +++ b/xen/arch/x86/shadow_public.c	Fri May 19 17:50:32 2006 +0100
     3.3 @@ -324,6 +324,11 @@ static void alloc_monitor_pagetable(stru
     3.4  
     3.5      mmfn_info = alloc_domheap_page(NULL);
     3.6      ASSERT( mmfn_info );
     3.7 +    if (!mmfn_info)
     3.8 +    {
     3.9 +        printk("Fail to allocate monitor pagetable\n");
    3.10 +        domain_crash(v->domain);
    3.11 +    }
    3.12  
    3.13      mmfn = page_to_mfn(mmfn_info);
    3.14      mpl4e = (l4_pgentry_t *) map_domain_page_global(mmfn);