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

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



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 94e354294cca7ce0c4f1b7ae2ec5eb62ddac71ac
# Parent  12aaf4a2486b1cd1bce78292491258ef170970ba
[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>
---
 tools/libxc/xc_linux_restore.c |   66 ++++++++++++++++++++++-------------------
 1 files changed, 36 insertions(+), 30 deletions(-)

diff -r 12aaf4a2486b -r 94e354294cca tools/libxc/xc_linux_restore.c
--- a/tools/libxc/xc_linux_restore.c    Wed Jun 21 17:09:14 2006 +0100
+++ b/tools/libxc/xc_linux_restore.c    Thu Jun 22 14:12:01 2006 +0100
@@ -572,42 +572,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®.