# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 3c2e7925bb932cd88151d64beb3cfe985245b6c2
# Parent d0d9f50517f75a57292b353edbb9ee9fe47dc1b0
[SHADOW] Crash the guest rather than BUGing the whole system when out of memory.
Signed-off-by: Yunhong Jiang <yunhong.jiang@xxxxxxxxx>
---
xen/arch/x86/shadow.c | 6 ++++--
xen/arch/x86/shadow32.c | 8 +++++++-
xen/arch/x86/shadow_public.c | 5 +++++
3 files changed, 16 insertions(+), 3 deletions(-)
diff -r d0d9f50517f7 -r 3c2e7925bb93 xen/arch/x86/shadow.c
--- a/xen/arch/x86/shadow.c Fri May 19 17:31:34 2006 +0100
+++ b/xen/arch/x86/shadow.c Fri May 19 17:50:32 2006 +0100
@@ -430,7 +430,8 @@ no_shadow_page:
perfc_value(shadow_l2_pages),
perfc_value(hl2_table_pages),
perfc_value(snapshot_pages));
- BUG(); /* XXX FIXME: try a shadow flush to free up some memory. */
+ /* XXX FIXME: try a shadow flush to free up some memory. */
+ domain_crash_synchronous();
return 0;
}
@@ -3064,7 +3065,8 @@ static inline unsigned long init_bl2(
if ( unlikely(!(smfn = alloc_shadow_page(d, gpfn, gmfn, PGT_l4_shadow))) )
{
printk("Couldn't alloc an L4 shadow for pfn=%lx mfn=%lx\n", gpfn,
gmfn);
- BUG(); /* XXX Deal gracefully with failure. */
+ /* XXX Deal gracefully with failure. */
+ domain_crash_synchronous();
}
spl4e = (l4_pgentry_t *)map_domain_page(smfn);
diff -r d0d9f50517f7 -r 3c2e7925bb93 xen/arch/x86/shadow32.c
--- a/xen/arch/x86/shadow32.c Fri May 19 17:31:34 2006 +0100
+++ b/xen/arch/x86/shadow32.c Fri May 19 17:50:32 2006 +0100
@@ -246,7 +246,8 @@ alloc_shadow_page(struct domain *d,
perfc_value(shadow_l2_pages),
perfc_value(hl2_table_pages),
perfc_value(snapshot_pages));
- BUG(); /* XXX FIXME: try a shadow flush to free up some memory. */
+ /* XXX FIXME: try a shadow flush to free up some memory. */
+ domain_crash_synchronous();
}
smfn = page_to_mfn(page);
@@ -983,6 +984,11 @@ alloc_p2m_table(struct domain *d)
else
{
page = alloc_domheap_page(NULL);
+ if (!page)
+ {
+ printk("Alloc p2m table fail\n");
+ domain_crash(d);
+ }
l1tab = map_domain_page(page_to_mfn(page));
memset(l1tab, 0, PAGE_SIZE);
diff -r d0d9f50517f7 -r 3c2e7925bb93 xen/arch/x86/shadow_public.c
--- a/xen/arch/x86/shadow_public.c Fri May 19 17:31:34 2006 +0100
+++ b/xen/arch/x86/shadow_public.c Fri May 19 17:50:32 2006 +0100
@@ -324,6 +324,11 @@ static void alloc_monitor_pagetable(stru
mmfn_info = alloc_domheap_page(NULL);
ASSERT( mmfn_info );
+ if (!mmfn_info)
+ {
+ printk("Fail to allocate monitor pagetable\n");
+ domain_crash(v->domain);
+ }
mmfn = page_to_mfn(mmfn_info);
mpl4e = (l4_pgentry_t *) map_domain_page_global(mmfn);
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|