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-changelog

[Xen-changelog] [xen-unstable] hvm: Fix save/restore to handle missing p

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] hvm: Fix save/restore to handle missing pages.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 26 Feb 2007 03:50:08 -0800
Delivery-date: Mon, 26 Feb 2007 04:41:53 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1172247420 0
# Node ID e21834bc78f2163e4d009e1891457565731adc72
# Parent  91427cadfa48407ef3fe9f1568f6cc73888fcc37
hvm: Fix save/restore to handle missing pages.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 tools/libxc/xc_hvm_restore.c |   16 ++++++++--------
 tools/libxc/xc_hvm_save.c    |   43 +++++++++++++++++++++----------------------
 2 files changed, 29 insertions(+), 30 deletions(-)

diff -r 91427cadfa48 -r e21834bc78f2 tools/libxc/xc_hvm_restore.c
--- a/tools/libxc/xc_hvm_restore.c      Fri Feb 23 16:16:36 2007 +0000
+++ b/tools/libxc/xc_hvm_restore.c      Fri Feb 23 16:17:00 2007 +0000
@@ -104,22 +104,19 @@ int xc_hvm_restore(int xc_handle, int io
     v_end = memsize << 20;
     nr_pages = (unsigned long) memsize << (20 - PAGE_SHIFT);
 
-    DPRINTF("xc_hvm_restore:dom=%d, nr_pages=0x%lx, store_evtchn=%d, 
*store_mfn=%ld, pae=%u, apic=%u.\n", 
+    DPRINTF("xc_hvm_restore:dom=%d, nr_pages=0x%lx, store_evtchn=%d, "
+            "*store_mfn=%ld, pae=%u, apic=%u.\n", 
             dom, nr_pages, store_evtchn, *store_mfn, pae, apic);
 
-    
     if(!get_platform_info(xc_handle, dom,
                           &max_mfn, &hvirt_start, &pt_levels)) {
         ERROR("Unable to get platform info.");
         return 1;
     }
 
-    DPRINTF("xc_hvm_restore start: nr_pages = %lx, max_pfn = %lx, max_mfn = 
%lx, hvirt_start=%lx, pt_levels=%d\n",
-            nr_pages,
-            max_pfn,
-            max_mfn,
-            hvirt_start,
-            pt_levels);
+    DPRINTF("xc_hvm_restore start: nr_pages = %lx, max_pfn = %lx, "
+            "max_mfn = %lx, hvirt_start=%lx, pt_levels=%d\n",
+            nr_pages, max_pfn, max_mfn, hvirt_start, pt_levels);
 
     if (mlock(&ctxt, sizeof(ctxt))) {
         /* needed for build dom0 op, but might as well do early */
@@ -220,6 +217,9 @@ int xc_hvm_restore(int xc_handle, int io
             void *page;
 
             pfn = region_pfn_type[i];
+            if ( pfn & XEN_DOMCTL_PFINFO_LTAB_MASK )
+                continue;
+
             if ( pfn > max_pfn )
             {
                 ERROR("pfn out of range");
diff -r 91427cadfa48 -r e21834bc78f2 tools/libxc/xc_hvm_save.c
--- a/tools/libxc/xc_hvm_save.c Fri Feb 23 16:16:36 2007 +0000
+++ b/tools/libxc/xc_hvm_save.c Fri Feb 23 16:17:00 2007 +0000
@@ -265,7 +265,7 @@ int xc_hvm_save(int xc_handle, int io_fd
 {
     xc_dominfo_t info;
 
-    int rc = 1, i, last_iter, iter = 0;
+    int rc = 1, i, j, last_iter, iter = 0;
     int live  = (flags & XCFLAGS_LIVE);
     int debug = (flags & XCFLAGS_DEBUG);
     int sent_last_iter, skip_this_iter;
@@ -289,7 +289,7 @@ int xc_hvm_save(int xc_handle, int io_fd
     /* base of the region in which domain memory is mapped */
     unsigned char *region_base = NULL;
 
-    uint32_t nr_pfns, rec_size, nr_vcpus;
+    uint32_t rec_size, nr_vcpus;
 
     /* power of 2 order of max_pfn */
     int order_nr;
@@ -360,7 +360,8 @@ int xc_hvm_save(int xc_handle, int io_fd
         goto out;
     }
 
-    DPRINTF("saved hvm domain info:max_memkb=0x%lx, max_mfn=0x%lx, 
nr_pages=0x%lx\n", info.max_memkb, max_mfn, info.nr_pages); 
+    DPRINTF("saved hvm domain info:max_memkb=0x%lx, max_mfn=0x%lx, "
+            "nr_pages=0x%lx\n", info.max_memkb, max_mfn, info.nr_pages); 
 
     if (live) {
         ERROR("hvm domain doesn't support live migration now.\n");
@@ -373,10 +374,6 @@ int xc_hvm_save(int xc_handle, int io_fd
             goto out;
         }
 
-        /* excludes vga acc mem */
-        /* XXX will need to check whether acceleration is enabled here! */
-        nr_pfns = info.nr_pages - 0x800;
-
         last_iter = 0;
         DPRINTF("hvm domain live migration debug start: logdirty enable.\n");
     } else {
@@ -390,20 +387,15 @@ int xc_hvm_save(int xc_handle, int io_fd
             ERROR("HVM Domain appears not to have suspended");
             goto out;
         }
-
-        nr_pfns = info.nr_pages; 
-    }
-
-    DPRINTF("after 1st handle hvm domain nr_pfns=0x%x, nr_pages=0x%lx, 
max_memkb=0x%lx, live=%d.\n",
-            nr_pfns,
-            info.nr_pages,
-            info.max_memkb,
-            live);
+    }
+
+    DPRINTF("after 1st handle hvm domain nr_pages=0x%lx, "
+            "max_memkb=0x%lx, live=%d.\n",
+            info.nr_pages, info.max_memkb, live);
 
     /* Calculate the highest PFN of "normal" memory:
-     * HVM memory is sequential except for the VGA and MMIO holes, and
-     * we have nr_pfns of it (which now excludes the cirrus video RAM) */
-    max_pfn = nr_pfns; 
+     * HVM memory is sequential except for the VGA and MMIO holes. */
+    max_pfn = info.nr_pages;
     /* Skip the VGA hole from 0xa0000 to 0xc0000 */
     max_pfn += 0x20;   
     /* Skip the MMIO hole: 256MB just below 4GB */
@@ -556,9 +548,16 @@ int xc_hvm_save(int xc_handle, int io_fd
                 goto out;
             }
 
-            if (ratewrite(io_fd, region_base, PAGE_SIZE * batch) != PAGE_SIZE 
* batch) {
-                ERROR("ERROR when writting to state file (4)");
-                goto out;
+            for ( j = 0; j < batch; j++ )
+            {
+                if ( pfn_batch[j] & XEN_DOMCTL_PFINFO_LTAB_MASK )
+                    continue;
+                if ( ratewrite(io_fd, region_base + j*PAGE_SIZE,
+                               PAGE_SIZE) != PAGE_SIZE )
+                {
+                    ERROR("ERROR when writing to state file (4)");
+                    goto out;
+                }
             }
 
             sent_this_iter += batch;

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] hvm: Fix save/restore to handle missing pages., Xen patchbot-unstable <=