[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Fix 'belt + braces' check in xc_linux_save and improve error handling



# HG changeset patch
# User smh22@xxxxxxxxxxxxxxxxxxxx
# Node ID bdab22f56efe72943e2bfe57113dacf6cef558f8
# Parent  112a769787d26d8658197d0eb860603383719631
Fix 'belt + braces' check in xc_linux_save and improve error handling 
for live migrate (this includes making shadow enable idempotent). 

Signed-off-by: Steven Hand <steven@xxxxxxxxxxxxx>

diff -r 112a769787d2 -r bdab22f56efe tools/libxc/xc_linux_save.c
--- a/tools/libxc/xc_linux_save.c       Mon Nov 21 15:10:19 2005
+++ b/tools/libxc/xc_linux_save.c       Mon Nov 21 15:40:16 2005
@@ -798,6 +798,7 @@
     pfn_batch = calloc(MAX_BATCH_SIZE, sizeof(unsigned long));
 
     if ((pfn_type == NULL) || (pfn_batch == NULL)) {
+        ERR("failed to alloc memory for pfn_type and/or pfn_batch arays."); 
         errno = ENOMEM;
         goto out;
     }
@@ -817,7 +818,7 @@
         for (i = 0; i < max_pfn; i++) {
 
             mfn = live_p2m[i];
-            if((live_m2p[mfn] != i) && (mfn != 0xffffffffUL)) { 
+            if((mfn != 0xffffffffUL) && (live_m2p[mfn] != i)) { 
                 DPRINTF("i=0x%x mfn=%lx live_m2p=%lx\n", i, 
                         mfn, live_m2p[mfn]);
                 err++;
@@ -912,7 +913,7 @@
                        unless its sent sooner anyhow */
 
                     set_bit(n, to_fix);
-                    if(iter > 1)
+                    if( (iter > 1) && IS_REAL_PFN(n) )
                         DPRINTF("netbuf race: iter %d, pfn %x. mfn %lx\n",
                                 iter, n, pfn_type[batch]);
                     continue;
@@ -1157,6 +1158,13 @@
 
  out:
 
+    if (live) {
+        if(xc_shadow_control(xc_handle, dom, DOM0_SHADOW_CONTROL_OP_OFF, 
+                             NULL, 0, NULL ) < 0) { 
+            DPRINTF("Warning - couldn't disable shadow mode");
+        }
+    }
+    
     if (live_shinfo)
         munmap(live_shinfo, PAGE_SIZE);
     
diff -r 112a769787d2 -r bdab22f56efe tools/libxc/xg_save_restore.h
--- a/tools/libxc/xg_save_restore.h     Mon Nov 21 15:10:19 2005
+++ b/tools/libxc/xg_save_restore.h     Mon Nov 21 15:40:16 2005
@@ -125,6 +125,12 @@
 /* Number of entries in the pfn_to_mfn_frame_list_list */
 #define P2M_FLL_ENTRIES (((max_pfn)+(ulpp*ulpp)-1)/(ulpp*ulpp))
 
+/* Current guests allow 8MB 'slack' in their P2M */
+#define NR_SLACK_ENTRIES   ((8 * 1024 * 1024) / PAGE_SIZE)
+
+/* Is the given PFN within the 'slack' region at the top of the P2M? */
+#define IS_REAL_PFN(_pfn)  ((max_pfn - (_pfn)) > NR_SLACK_ENTRIES) 
+
 /* Returns TRUE if the PFN is currently mapped */
 #define is_mapped(pfn_type) (!((pfn_type) & 0x80000000UL))
 
diff -r 112a769787d2 -r bdab22f56efe xen/arch/x86/shadow32.c
--- a/xen/arch/x86/shadow32.c   Mon Nov 21 15:10:19 2005
+++ b/xen/arch/x86/shadow32.c   Mon Nov 21 15:40:16 2005
@@ -920,9 +920,9 @@
     struct vcpu *v;
     int new_modes = (mode & ~d->arch.shadow_mode);
 
-    // Gotta be adding something to call this function.
-    ASSERT(new_modes);
-
+    if(!new_modes) /* Nothing to do - return success */
+        return 0; 
+        
     // can't take anything away by calling this function.
     ASSERT(!(d->arch.shadow_mode & ~mode));
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.