# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1213282065 -3600
# Node ID 5e98eb873e137a10b35bcb34ddb993be0d00567f
# Parent 4ebd8f3774263b4cd10fd9b1b7a93864acf88ab0
x86: simplify domain memory cleanup
Page table pages cannot come from the Xen heap, so there's no need to
special-case these during cleanup.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
xen/arch/x86/domain.c | 44 ++++++++++++++++---------------------------
xen/arch/x86/mm.c | 4 +--
xen/include/asm-x86/domain.h | 10 +++------
3 files changed, 23 insertions(+), 35 deletions(-)
diff -r 4ebd8f377426 -r 5e98eb873e13 xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c Thu Jun 12 15:44:21 2008 +0100
+++ b/xen/arch/x86/domain.c Thu Jun 12 15:47:45 2008 +0100
@@ -1776,47 +1776,36 @@ int domain_relinquish_resources(struct d
unmap_vcpu_info(v);
}
- d->arch.relmem = RELMEM_xen_l4;
+ d->arch.relmem = RELMEM_xen;
/* fallthrough */
/* Relinquish every page of memory. */
- case RELMEM_xen_l4:
-#if CONFIG_PAGING_LEVELS >= 4
- ret = relinquish_memory(d, &d->xenpage_list, PGT_l4_page_table);
+ case RELMEM_xen:
+ ret = relinquish_memory(d, &d->xenpage_list, ~0UL);
if ( ret )
return ret;
- d->arch.relmem = RELMEM_dom_l4;
+#if CONFIG_PAGING_LEVELS >= 4
+ d->arch.relmem = RELMEM_l4;
/* fallthrough */
- case RELMEM_dom_l4:
+
+ case RELMEM_l4:
ret = relinquish_memory(d, &d->page_list, PGT_l4_page_table);
if ( ret )
return ret;
- d->arch.relmem = RELMEM_xen_l3;
+#endif
+#if CONFIG_PAGING_LEVELS >= 3
+ d->arch.relmem = RELMEM_l3;
/* fallthrough */
-#endif
-
- case RELMEM_xen_l3:
-#if CONFIG_PAGING_LEVELS >= 3
- ret = relinquish_memory(d, &d->xenpage_list, PGT_l3_page_table);
- if ( ret )
- return ret;
- d->arch.relmem = RELMEM_dom_l3;
- /* fallthrough */
- case RELMEM_dom_l3:
+
+ case RELMEM_l3:
ret = relinquish_memory(d, &d->page_list, PGT_l3_page_table);
if ( ret )
return ret;
- d->arch.relmem = RELMEM_xen_l2;
+#endif
+ d->arch.relmem = RELMEM_l2;
/* fallthrough */
-#endif
-
- case RELMEM_xen_l2:
- ret = relinquish_memory(d, &d->xenpage_list, PGT_l2_page_table);
- if ( ret )
- return ret;
- d->arch.relmem = RELMEM_dom_l2;
- /* fallthrough */
- case RELMEM_dom_l2:
+
+ case RELMEM_l2:
ret = relinquish_memory(d, &d->page_list, PGT_l2_page_table);
if ( ret )
return ret;
@@ -1829,6 +1818,7 @@ int domain_relinquish_resources(struct d
if ( ret )
return ret;
#endif
+ WARN_ON(d->xenheap_pages);
break;
default:
diff -r 4ebd8f377426 -r 5e98eb873e13 xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Thu Jun 12 15:44:21 2008 +0100
+++ b/xen/arch/x86/mm.c Thu Jun 12 15:47:45 2008 +0100
@@ -1317,7 +1317,7 @@ static void free_l3_table(struct page_in
int i;
#ifdef DOMAIN_DESTRUCT_AVOID_RECURSION
- if ( d->arch.relmem == RELMEM_dom_l3 )
+ if ( d->arch.relmem == RELMEM_l3 )
return;
#endif
@@ -1345,7 +1345,7 @@ static void free_l4_table(struct page_in
int i;
#ifdef DOMAIN_DESTRUCT_AVOID_RECURSION
- if ( d->arch.relmem == RELMEM_dom_l4 )
+ if ( d->arch.relmem == RELMEM_l4 )
return;
#endif
diff -r 4ebd8f377426 -r 5e98eb873e13 xen/include/asm-x86/domain.h
--- a/xen/include/asm-x86/domain.h Thu Jun 12 15:44:21 2008 +0100
+++ b/xen/include/asm-x86/domain.h Thu Jun 12 15:47:45 2008 +0100
@@ -241,12 +241,10 @@ struct arch_domain
/* Continuable domain_relinquish_resources(). */
enum {
RELMEM_not_started,
- RELMEM_xen_l4,
- RELMEM_dom_l4,
- RELMEM_xen_l3,
- RELMEM_dom_l3,
- RELMEM_xen_l2,
- RELMEM_dom_l2,
+ RELMEM_xen,
+ RELMEM_l4,
+ RELMEM_l3,
+ RELMEM_l2,
RELMEM_done,
} relmem;
struct list_head relmem_list;
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|