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

[Xen-devel] [PATCH 3/4] HVM save/restore clean up: change max_pfn format

To: Ian Pratt <Ian.Pratt@xxxxxxxxxxxx>, Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>, Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH 3/4] HVM save/restore clean up: change max_pfn format
From: "Zhai, Edwin" <edwin.zhai@xxxxxxxxx>
Date: Sat, 20 Jan 2007 00:39:15 +0800
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx, edwin.zhai@xxxxxxxxx
Delivery-date: Fri, 19 Jan 2007 08:39:08 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.11
[PATCH 3/4] HVM save/restore clean up: change max_pfn format

Signed-off-by: Zhai Edwin <edwin.zhai@xxxxxxxxx>

change from unsigned long to int for 32 guest saved on 64 and restore on 32 in 
future.
seems 2^32 pages is big enough.

diff -r f6912b819d3c tools/libxc/ia64/xc_ia64_linux_save.c
--- a/tools/libxc/ia64/xc_ia64_linux_save.c     Fri Jan 19 19:29:26 2007 +0800
+++ b/tools/libxc/ia64/xc_ia64_linux_save.c     Fri Jan 19 19:39:12 2007 +0800
@@ -223,7 +223,7 @@ xc_linux_save(int xc_handle, int io_fd, 
     }
 
     /* This is expected by xm restore.  */
-    if (!write_exact(io_fd, &max_pfn, sizeof(unsigned long))) {
+    if (!write_exact(io_fd, &max_pfn, sizeof(unsigned int))) {
         ERROR("write: max_pfn");
         goto out;
     }
diff -r f6912b819d3c tools/libxc/xc_hvm_save.c
--- a/tools/libxc/xc_hvm_save.c Fri Jan 19 19:29:26 2007 +0800
+++ b/tools/libxc/xc_hvm_save.c Fri Jan 19 19:39:12 2007 +0800
@@ -468,7 +468,7 @@ int xc_hvm_save(int xc_handle, int io_fd
     }
 
     /* Start writing out the saved-domain record. */
-    if (!write_exact(io_fd, &max_pfn, sizeof(unsigned long))) {
+    if (!write_exact(io_fd, &max_pfn, sizeof(unsigned int))) {
         ERROR("write: max_pfn");
         goto out;
     }
diff -r f6912b819d3c tools/libxc/xc_linux_save.c
--- a/tools/libxc/xc_linux_save.c       Fri Jan 19 19:29:26 2007 +0800
+++ b/tools/libxc/xc_linux_save.c       Fri Jan 19 19:39:12 2007 +0800
@@ -822,7 +822,7 @@ int xc_linux_save(int xc_handle, int io_
 
     /* Start writing out the saved-domain record. */
 
-    if (!write_exact(io_fd, &max_pfn, sizeof(unsigned long))) {
+    if (!write_exact(io_fd, &max_pfn, sizeof(unsigned int))) {
         ERROR("write: max_pfn");
         goto out;
     }
diff -r f6912b819d3c tools/python/xen/xend/XendCheckpoint.py
--- a/tools/python/xen/xend/XendCheckpoint.py   Fri Jan 19 19:29:26 2007 +0800
+++ b/tools/python/xen/xend/XendCheckpoint.py   Fri Jan 19 19:40:06 2007 +0800
@@ -189,24 +189,19 @@ def restore(xd, fd, dominfo = None, paus
                  dominfo.domid, hvm, apic, pae)
 
     try:
-        if hvm:
-            l = read_exact(fd, sizeof_unsigned_int,
-                           "not a valid hvm guest state file: pfn count read")
-            nr_pfns = unpack("I", l)[0]    # native sizeof int
-        else: 
-            l = read_exact(fd, sizeof_unsigned_long,
-                           "not a valid guest state file: pfn count read")
-
-        max_pfn = unpack("L", l)[0]    # native sizeof long
+        l = read_exact(fd, sizeof_unsigned_int,
+                       "not a valid hvm guest state file: pfn count read")
+        max_pfn = unpack("I", l)[0]    # native sizeof int
+
         if max_pfn > 16*1024*1024:     # XXX 
             raise XendError(
                 "not a valid guest state file: pfn count out of range")
 
         shadow = dominfo.info['shadow_memory']
         log.debug("restore:shadow=0x%x, _static_max=0x%x, _static_min=0x%x, "
-                  "nr_pfns=0x%x.", dominfo.info['shadow_memory'],
+                  "nr_pfns=0x%x, max_pfn=0x%x.", dominfo.info['shadow_memory'],
                   dominfo.info['memory_static_max'],
-                  dominfo.info['memory_static_min'], nr_pfns)
+                  dominfo.info['memory_static_min'], nr_pfns, max_pfn)
 
 
         balloon.free(xc.pages_to_kib(nr_pfns) + shadow * 1024)

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH 3/4] HVM save/restore clean up: change max_pfn format, Zhai, Edwin <=