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

[Xen-changelog] [xen-3.0-testing] [TOOLS] Fix pagetable-pinning loop in xc_linux_restore.



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID cb1e561583ac112b7b62bbd4d5232bc590053de3
# Parent  c2a8f93d0dc89af2cc4dda7116c3955c3a0f197d
[TOOLS] Fix pagetable-pinning loop in xc_linux_restore.
Previously it would not pin last PFN in physmap even if it was
a pagetable page.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
xen-unstable changeset:   10475:94e354294cca7ce0c4f1b7ae2ec5eb62ddac71ac
xen-unstable date:        Thu Jun 22 14:12:01 2006 +0100
---
 tools/libxc/xc_linux_restore.c |   66 ++++++++++++++++++++++-------------------
 1 files changed, 36 insertions(+), 30 deletions(-)

diff -r c2a8f93d0dc8 -r cb1e561583ac tools/libxc/xc_linux_restore.c
--- a/tools/libxc/xc_linux_restore.c    Tue Jun 20 18:29:46 2006 +0100
+++ b/tools/libxc/xc_linux_restore.c    Thu Jun 22 14:20:01 2006 +0100
@@ -545,42 +545,48 @@ int xc_linux_restore(int xc_handle, int 
     nr_pins = 0; 
     for (i = 0; i < max_pfn; i++) {
 
-        if (i == (max_pfn-1) || nr_pins == MAX_PIN_BATCH) {
+        if ( (pfn_type[i] & LPINTAB) == 0 )
+            continue;
+
+        switch(pfn_type[i]) { 
+
+        case (L1TAB|LPINTAB): 
+            pin[nr_pins].cmd = MMUEXT_PIN_L1_TABLE;
+            break; 
+            
+        case (L2TAB|LPINTAB): 
+            pin[nr_pins].cmd = MMUEXT_PIN_L2_TABLE;
+            break; 
+            
+        case (L3TAB|LPINTAB): 
+            pin[nr_pins].cmd = MMUEXT_PIN_L3_TABLE;
+            break; 
+
+        case (L4TAB|LPINTAB):
+            pin[nr_pins].cmd = MMUEXT_PIN_L4_TABLE;
+            break; 
+            
+        default: 
+            continue; 
+        }
+
+        pin[nr_pins].arg1.mfn = p2m[i];
+        nr_pins++; 
+
+        /* Batch full? Then flush. */
+        if (nr_pins == MAX_PIN_BATCH) {
             if (xc_mmuext_op(xc_handle, pin, nr_pins, dom) < 0) { 
                 ERR("Failed to pin batch of %d page tables", nr_pins); 
                 goto out;
             } 
             nr_pins = 0;
         }
-
-        if ( (pfn_type[i] & LPINTAB) == 0 )
-            continue;
-
-        switch(pfn_type[i]) { 
-
-        case (L1TAB|LPINTAB): 
-            pin[nr_pins].cmd = MMUEXT_PIN_L1_TABLE;
-            break; 
-            
-        case (L2TAB|LPINTAB): 
-            pin[nr_pins].cmd = MMUEXT_PIN_L2_TABLE;
-            break; 
-            
-        case (L3TAB|LPINTAB): 
-            pin[nr_pins].cmd = MMUEXT_PIN_L3_TABLE;
-            break; 
-
-        case (L4TAB|LPINTAB):
-            pin[nr_pins].cmd = MMUEXT_PIN_L4_TABLE;
-            break; 
-            
-        default: 
-            continue; 
-        }
-
-        pin[nr_pins].arg1.mfn = p2m[i];
-        nr_pins++; 
-
+    }
+
+    /* Flush final partial batch. */
+    if ((nr_pins != 0) && (xc_mmuext_op(xc_handle, pin, nr_pins, dom) < 0)) { 
+        ERR("Failed to pin batch of %d page tables", nr_pins); 
+        goto out;
     }
 
     DPRINTF("\b\b\b\b100%%\n");

_______________________________________________
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®.