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] Save/restore: save shared-info pfn

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [HVM] Save/restore: save shared-info pfn and re-map it on restore
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 31 Jan 2007 07:05:40 -0800
Delivery-date: Wed, 31 Jan 2007 07:09:07 -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 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [HVM] Save/restore: save shared-info pfn and re-map it on restore, Xen patchbot-unstable <=