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

[Xen-changelog] [xen-unstable] [HVM] Save/restore: save shared-info pfn and re-map it on restore



# HG changeset patch
# User Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>
# Date 1170246215 0
# Node ID 54678a99e1020c3f761416674e43626f4a553778
# Parent  d653e4bcead040524d16b4b507db1d0481a9e6b3
[HVM] Save/restore: save shared-info pfn and re-map it on restore
In the short term this allows us to save the same domain more than once.
Longer-term some more careful shared-info management will be needed.

Signed-off-by: Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>
---
 tools/libxc/xc_hvm_restore.c |   26 +++++++++++++++++---------
 tools/libxc/xc_hvm_save.c    |    6 ++++++
 2 files changed, 23 insertions(+), 9 deletions(-)

diff -r d653e4bcead0 -r 54678a99e102 tools/libxc/xc_hvm_restore.c
--- a/tools/libxc/xc_hvm_restore.c      Wed Jan 31 10:44:21 2007 +0000
+++ b/tools/libxc/xc_hvm_restore.c      Wed Jan 31 12:23:35 2007 +0000
@@ -98,6 +98,8 @@ int xc_hvm_restore(int xc_handle, int io
     /* Types of the pfns in the current region */
     unsigned long region_pfn_type[MAX_BATCH_SIZE];
 
+    struct xen_add_to_physmap xatp;
+
     /* hvm guest mem size (Mb) */
     memsize = (unsigned long long)*store_mfn;
     v_end = memsize << 20;
@@ -133,15 +135,6 @@ int xc_hvm_restore(int xc_handle, int io
         errno = ENOMEM;
         goto out;
     }
-
-    /* Get the domain's shared-info frame. */
-    domctl.cmd = XEN_DOMCTL_getdomaininfo;
-    domctl.domain = (domid_t)dom;
-    if (xc_domctl(xc_handle, &domctl) < 0) {
-        ERROR("Could not get information on new domain");
-        goto out;
-    }
-    shared_info_frame = domctl.u.getdomaininfo.shared_info_frame;
 
     if(xc_domain_setmaxmem(xc_handle, dom, PFN_TO_KB(max_pfn)) != 0) {
         errno = ENOMEM;
@@ -346,6 +339,21 @@ int xc_hvm_restore(int xc_handle, int io
         }
     }
 
+    /* Shared-info pfn */
+    if (!read_exact(io_fd, &(shared_info_frame), sizeof(uint32_t)) ) {
+        ERROR("reading the shared-info pfn failed!\n");
+        goto out;
+    }
+    /* Map the shared-info frame where it was before */
+    xatp.domid = dom;
+    xatp.space = XENMAPSPACE_shared_info;
+    xatp.idx   = 0;
+    xatp.gpfn  = shared_info_frame;
+    if ( (rc = xc_memory_op(xc_handle, XENMEM_add_to_physmap, &xatp)) != 0 ) {
+        ERROR("setting the shared-info pfn failed!\n");
+        goto out;
+    }
+
     rc = 0;
     goto out;
 
diff -r d653e4bcead0 -r 54678a99e102 tools/libxc/xc_hvm_save.c
--- a/tools/libxc/xc_hvm_save.c Wed Jan 31 10:44:21 2007 +0000
+++ b/tools/libxc/xc_hvm_save.c Wed Jan 31 12:23:35 2007 +0000
@@ -702,6 +702,12 @@ int xc_hvm_save(int xc_handle, int io_fd
             goto out;
         }
     }
+
+    /* Shared-info pfn */
+    if (!write_exact(io_fd, &(shared_info_frame), sizeof(uint32_t)) ) {
+        ERROR("write shared-info pfn failed!\n");
+        goto out;
+    }
  
     /* Success! */
     rc = 0;

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