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] Clean up save/restore state record handli

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Clean up save/restore state record handling. No need for Python to
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 04 Apr 2007 13:30:25 -0700
Delivery-date: Wed, 04 Apr 2007 13:30:45 -0700
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 1175700896 -3600
# Node ID 0f8a327ebd4d86e0178d00b173b9c4e21591b625
# Parent  3f6ad86d37bd361069148c5a23a5006ce5d13ee0
Clean up save/restore state record handling. No need for Python to
read out the 'p2m size' field. Also that field is not needed at all
for HVM guests.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 tools/libxc/ia64/xc_ia64_linux_restore.c |    9 ++++++---
 tools/libxc/xc_hvm_save.c                |    7 -------
 tools/libxc/xc_linux_restore.c           |    8 +++++---
 tools/libxc/xenguest.h                   |    3 ---
 tools/python/xen/xend/XendCheckpoint.py  |   16 ++++------------
 tools/xcutils/xc_restore.c               |   24 ++++++++++++------------
 6 files changed, 27 insertions(+), 40 deletions(-)

diff -r 3f6ad86d37bd -r 0f8a327ebd4d tools/libxc/ia64/xc_ia64_linux_restore.c
--- a/tools/libxc/ia64/xc_ia64_linux_restore.c  Wed Apr 04 16:18:28 2007 +0100
+++ b/tools/libxc/ia64/xc_ia64_linux_restore.c  Wed Apr 04 16:34:56 2007 +0100
@@ -59,7 +59,7 @@ read_page(int xc_handle, int io_fd, uint
 }
 
 int
-xc_linux_restore(int xc_handle, int io_fd, uint32_t dom, unsigned long p2msize,
+xc_linux_restore(int xc_handle, int io_fd, uint32_t dom,
                  unsigned int store_evtchn, unsigned long *store_mfn,
                  unsigned int console_evtchn, unsigned long *console_mfn)
 {
@@ -81,11 +81,14 @@ xc_linux_restore(int xc_handle, int io_f
     /* A temporary mapping of the guest's start_info page. */
     start_info_t *start_info;
 
-    p2m_size = p2msize;
-
     /* For info only */
     nr_pfns = 0;
 
+    if ( !read_exact(io_fd, &p2m_size, sizeof(unsigned long)) )
+    {
+        ERROR("read: p2m_size");
+        goto out;
+    }
     DPRINTF("xc_linux_restore start: p2m_size = %lx\n", p2m_size);
 
     if (!read_exact(io_fd, &ver, sizeof(unsigned long))) {
diff -r 3f6ad86d37bd -r 0f8a327ebd4d tools/libxc/xc_hvm_save.c
--- a/tools/libxc/xc_hvm_save.c Wed Apr 04 16:18:28 2007 +0100
+++ b/tools/libxc/xc_hvm_save.c Wed Apr 04 16:34:56 2007 +0100
@@ -434,13 +434,6 @@ int xc_hvm_save(int xc_handle, int io_fd
         goto out;
     }
 
-    /* Start writing out the saved-domain record. */
-    if ( !write_exact(io_fd, &max_pfn, sizeof(unsigned long)) )
-    {
-        ERROR("write: max_pfn");
-        goto out;
-    }
-
     for ( ; ; )
     {
         unsigned int prev_pc, sent_this_iter, N, batch;
diff -r 3f6ad86d37bd -r 0f8a327ebd4d tools/libxc/xc_linux_restore.c
--- a/tools/libxc/xc_linux_restore.c    Wed Apr 04 16:18:28 2007 +0100
+++ b/tools/libxc/xc_linux_restore.c    Wed Apr 04 16:34:56 2007 +0100
@@ -142,7 +142,6 @@ static int uncanonicalize_pagetable(int 
 
 
 int xc_linux_restore(int xc_handle, int io_fd, uint32_t dom,
-                     unsigned long p2msize,
                      unsigned int store_evtchn, unsigned long *store_mfn,
                      unsigned int console_evtchn, unsigned long *console_mfn)
 {
@@ -194,11 +193,14 @@ int xc_linux_restore(int xc_handle, int 
     unsigned int max_vcpu_id = 0;
     int new_ctxt_format = 0;
 
-    p2m_size    = p2msize;
-
     /* For info only */
     nr_pfns = 0;
 
+    if ( !read_exact(io_fd, &p2m_size, sizeof(unsigned long)) )
+    {
+        ERROR("read: p2m_size");
+        goto out;
+    }
     DPRINTF("xc_linux_restore start: p2m_size = %lx\n", p2m_size);
 
     /*
diff -r 3f6ad86d37bd -r 0f8a327ebd4d tools/libxc/xenguest.h
--- a/tools/libxc/xenguest.h    Wed Apr 04 16:18:28 2007 +0100
+++ b/tools/libxc/xenguest.h    Wed Apr 04 16:34:56 2007 +0100
@@ -43,14 +43,11 @@ int xc_hvm_save(int xc_handle, int io_fd
  * @parm xc_handle a handle to an open hypervisor interface
  * @parm fd the file descriptor to restore a domain from
  * @parm dom the id of the domain
- * @parm p2m_size number of pages the guest has (i.e. number entries in P2M)
- * @parm max_nr_pfns domains maximum real memory allocation, in pages
  * @parm store_evtchn the store event channel for this domain to use
  * @parm store_mfn returned with the mfn of the store page
  * @return 0 on success, -1 on failure
  */
 int xc_linux_restore(int xc_handle, int io_fd, uint32_t dom,
-                     unsigned long p2m_size,
                      unsigned int store_evtchn, unsigned long *store_mfn,
                      unsigned int console_evtchn, unsigned long *console_mfn);
 
diff -r 3f6ad86d37bd -r 0f8a327ebd4d tools/python/xen/xend/XendCheckpoint.py
--- a/tools/python/xen/xend/XendCheckpoint.py   Wed Apr 04 16:18:28 2007 +0100
+++ b/tools/python/xen/xend/XendCheckpoint.py   Wed Apr 04 16:34:56 2007 +0100
@@ -201,19 +201,11 @@ def restore(xd, fd, dominfo = None, paus
         pae  = 0
 
     try:
-        l = read_exact(fd, sizeof_unsigned_long,
-                       "not a valid guest state file: pfn count read")
-        p2m_size = unpack("L", l)[0]    # native sizeof long
-
-        if p2m_size > 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, "
-                  "p2m_size=0x%x.", dominfo.info['shadow_memory'],
+        log.debug("restore:shadow=0x%x, _static_max=0x%x, _static_min=0x%x, ",
+                  dominfo.info['shadow_memory'],
                   dominfo.info['memory_static_max'],
-                  dominfo.info['memory_static_min'], p2m_size)
+                  dominfo.info['memory_static_min'])
 
         balloon.free(xc.pages_to_kib(nr_pfns) + shadow * 1024)
 
@@ -223,7 +215,7 @@ def restore(xd, fd, dominfo = None, paus
         xc.domain_setmaxmem(dominfo.getDomid(), dominfo.getMemoryMaximum())
 
         cmd = map(str, [xen.util.auxbin.pathTo(XC_RESTORE),
-                        fd, dominfo.getDomid(), p2m_size,
+                        fd, dominfo.getDomid(),
                         store_port, console_port, int(is_hvm), pae, apic])
         log.debug("[xc_restore]: %s", string.join(cmd))
 
diff -r 3f6ad86d37bd -r 0f8a327ebd4d tools/xcutils/xc_restore.c
--- a/tools/xcutils/xc_restore.c        Wed Apr 04 16:18:28 2007 +0100
+++ b/tools/xcutils/xc_restore.c        Wed Apr 04 16:34:56 2007 +0100
@@ -21,10 +21,10 @@ main(int argc, char **argv)
     unsigned int xc_fd, io_fd, domid, store_evtchn, console_evtchn;
     unsigned int hvm, pae, apic;
     int ret;
-    unsigned long p2m_size, store_mfn, console_mfn;
+    unsigned long store_mfn, console_mfn;
 
-    if ( argc != 9 )
-        errx(1, "usage: %s iofd domid p2m_size store_evtchn "
+    if ( argc != 8 )
+        errx(1, "usage: %s iofd domid store_evtchn "
              "console_evtchn hvm pae apic", argv[0]);
 
     xc_fd = xc_interface_open();
@@ -33,18 +33,18 @@ main(int argc, char **argv)
 
     io_fd = atoi(argv[1]);
     domid = atoi(argv[2]);
-    p2m_size = atoi(argv[3]);
-    store_evtchn = atoi(argv[4]);
-    console_evtchn = atoi(argv[5]);
-    hvm  = atoi(argv[6]);
-    pae  = atoi(argv[7]);
-    apic = atoi(argv[8]);
+    store_evtchn = atoi(argv[3]);
+    console_evtchn = atoi(argv[4]);
+    hvm  = atoi(argv[5]);
+    pae  = atoi(argv[6]);
+    apic = atoi(argv[7]);
 
     if ( hvm )
-        ret = xc_hvm_restore(xc_fd, io_fd, domid, store_evtchn,
-                             &store_mfn, pae, apic);
+        ret = xc_hvm_restore(xc_fd, io_fd, domid,
+                             store_evtchn, &store_mfn,
+                             pae, apic);
     else
-        ret = xc_linux_restore(xc_fd, io_fd, domid, p2m_size,
+        ret = xc_linux_restore(xc_fd, io_fd, domid,
                                store_evtchn, &store_mfn,
                                console_evtchn, &console_mfn);
 

_______________________________________________
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] Clean up save/restore state record handling. No need for Python to, Xen patchbot-unstable <=