WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] x86: simplify domain memory cleanup

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] x86: simplify domain memory cleanup
From: "Jan Beulich" <jbeulich@xxxxxxxxxx>
Date: Thu, 12 Jun 2008 15:23:08 +0100
Delivery-date: Thu, 12 Jun 2008 07:23:17 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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>

Index: 2008-06-12/xen/arch/x86/domain.c
===================================================================
--- 2008-06-12.orig/xen/arch/x86/domain.c       2008-06-12 08:57:24.000000000 
+0200
+++ 2008-06-12/xen/arch/x86/domain.c    2008-06-12 09:02:00.000000000 +0200
@@ -1876,47 +1876,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;
-        /* 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;
+        d->arch.relmem = RELMEM_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;
-        /* 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;
+        d->arch.relmem = RELMEM_l2;
         /* fallthrough */
-    case RELMEM_dom_l2:
+
+    case RELMEM_l2:
         ret = relinquish_memory(d, &d->page_list, PGT_l2_page_table);
         if ( ret )
             return ret;
@@ -1929,6 +1918,7 @@ int domain_relinquish_resources(struct d
         if ( ret )
             return ret;
 #endif
+        WARN_ON(d->xenheap_pages);
         break;
 
     default:
Index: 2008-06-12/xen/arch/x86/mm.c
===================================================================
--- 2008-06-12.orig/xen/arch/x86/mm.c   2008-06-12 08:57:24.000000000 +0200
+++ 2008-06-12/xen/arch/x86/mm.c        2008-06-12 09:04:50.000000000 +0200
@@ -1321,7 +1321,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
 
@@ -1349,7 +1349,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
 
Index: 2008-06-12/xen/include/asm-x86/domain.h
===================================================================
--- 2008-06-12.orig/xen/include/asm-x86/domain.h        2008-06-12 
08:57:24.000000000 +0200
+++ 2008-06-12/xen/include/asm-x86/domain.h     2008-06-12 09:00:32.000000000 
+0200
@@ -242,12 +242,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-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] x86: simplify domain memory cleanup, Jan Beulich <=