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

[Xen-changelog] xen.h, image.py, XendDomainInfo.py, xc.c, xc_linux_build.c, xc.h:



ChangeSet 1.1662.1.11, 2005/06/06 20:22:19+01:00, cl349@xxxxxxxxxxxxxxxxxxxx

        xen.h, image.py, XendDomainInfo.py, xc.c, xc_linux_build.c, xc.h:
          Create store page for domains and plumb through to python.
        XendDomainInfo.py:
          Cleanup comments.
        Signed-off-by: Mike Wray <mike.wray@xxxxxx>
        Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>



 tools/libxc/xc.h                        |    4 +-
 tools/libxc/xc_linux_build.c            |   59 ++++++++++++++++++++------------
 tools/python/xen/lowlevel/xc/xc.c       |   25 +++++++------
 tools/python/xen/xend/XendDomainInfo.py |    6 ++-
 tools/python/xen/xend/image.py          |   31 ++++++++--------
 xen/include/public/xen.h                |   25 +++++++------
 6 files changed, 90 insertions(+), 60 deletions(-)


diff -Nru a/tools/libxc/xc.h b/tools/libxc/xc.h
--- a/tools/libxc/xc.h  2005-06-09 13:08:00 -04:00
+++ b/tools/libxc/xc.h  2005-06-09 13:08:00 -04:00
@@ -252,7 +252,9 @@
                    const char *cmdline,
                    unsigned int control_evtchn,
                    unsigned long flags,
-                   unsigned int vcpus);
+                   unsigned int vcpus,
+                   unsigned int store_evtchn,
+                   unsigned long *store_mfn);
 
 int
 xc_plan9_build (int xc_handle,
diff -Nru a/tools/libxc/xc_linux_build.c b/tools/libxc/xc_linux_build.c
--- a/tools/libxc/xc_linux_build.c      2005-06-09 13:08:01 -04:00
+++ b/tools/libxc/xc_linux_build.c      2005-06-09 13:08:01 -04:00
@@ -40,17 +40,18 @@
     struct domain_setup_info *dsi);
 
 static int setup_guest(int xc_handle,
-                         u32 dom,
-                         char *image, unsigned long image_size,
-                         gzFile initrd_gfd, unsigned long initrd_len,
-                         unsigned long nr_pages,
-                         unsigned long *pvsi, unsigned long *pvke,
-                         vcpu_guest_context_t *ctxt,
-                         const char *cmdline,
-                         unsigned long shared_info_frame,
-                         unsigned int control_evtchn,
-                         unsigned long flags,
-                         unsigned int vcpus)
+                       u32 dom,
+                       char *image, unsigned long image_size,
+                       gzFile initrd_gfd, unsigned long initrd_len,
+                       unsigned long nr_pages,
+                       unsigned long *pvsi, unsigned long *pvke,
+                       unsigned long *pvss, vcpu_guest_context_t *ctxt,
+                       const char *cmdline,
+                       unsigned long shared_info_frame,
+                       unsigned int control_evtchn,
+                       unsigned long flags,
+                       unsigned int vcpus,
+                      unsigned int store_evtchn, unsigned long *store_mfn)
 {
     l1_pgentry_t *vl1tab=NULL, *vl1e=NULL;
     l2_pgentry_t *vl2tab=NULL, *vl2e=NULL;
@@ -74,6 +75,8 @@
     unsigned long vphysmap_end;
     unsigned long vstartinfo_start;
     unsigned long vstartinfo_end;
+    unsigned long vstoreinfo_start;
+    unsigned long vstoreinfo_end;
     unsigned long vstack_start;
     unsigned long vstack_end;
     unsigned long vpt_start;
@@ -109,7 +112,10 @@
         vpt_end          = vpt_start + (nr_pt_pages * PAGE_SIZE);
         vstartinfo_start = vpt_end;
         vstartinfo_end   = vstartinfo_start + PAGE_SIZE;
-        vstack_start     = vstartinfo_end;
+        /* Place store shared page after startinfo. */
+        vstoreinfo_start = vstartinfo_end;
+        vstoreinfo_end   = vstartinfo_end + PAGE_SIZE;
+        vstack_start     = vstoreinfo_end;
         vstack_end       = vstack_start + PAGE_SIZE;
         v_end            = (vstack_end + (1<<22)-1) & ~((1<<22)-1);
         if ( (v_end - vstack_end) < (512 << 10) )
@@ -125,6 +131,7 @@
            " Phys-Mach map: %08lx->%08lx\n"
            " Page tables:   %08lx->%08lx\n"
            " Start info:    %08lx->%08lx\n"
+           " Store page:    %08lx->%08lx\n"
            " Boot stack:    %08lx->%08lx\n"
            " TOTAL:         %08lx->%08lx\n",
            dsi.v_kernstart, dsi.v_kernend, 
@@ -132,6 +139,7 @@
            vphysmap_start, vphysmap_end,
            vpt_start, vpt_end,
            vstartinfo_start, vstartinfo_end,
+           vstoreinfo_start, vstoreinfo_end,
            vstack_start, vstack_end,
            dsi.v_start, v_end);
     printf(" ENTRY ADDRESS: %08lx\n", dsi.v_kernentry);
@@ -261,6 +269,8 @@
     start_info->nr_pt_frames = nr_pt_pages;
     start_info->mfn_list     = vphysmap_start;
     start_info->domain_controller_evtchn = control_evtchn;
+    start_info->store_page   = vstoreinfo_start;
+    start_info->store_evtchn = store_evtchn;
     if ( initrd_len != 0 )
     {
         start_info->mod_start    = vinitrd_start;
@@ -270,6 +280,9 @@
     start_info->cmd_line[MAX_CMDLINE-1] = '\0';
     munmap(start_info, PAGE_SIZE);
 
+    /* Tell our caller where we told domain store page was. */
+    *store_mfn = page_array[((vstoreinfo_start-dsi.v_start)>>PAGE_SHIFT)];
+
     /* shared_info page starts its life empty. */
     shared_info = xc_map_foreign_range(
         xc_handle, dom, PAGE_SIZE, PROT_READ|PROT_WRITE, shared_info_frame);
@@ -291,6 +304,7 @@
     free(page_array);
 
     *pvsi = vstartinfo_start;
+    *pvss = vstack_start;
     *pvke = dsi.v_kernentry;
 
     return 0;
@@ -310,7 +324,9 @@
                    const char *cmdline,
                    unsigned int control_evtchn,
                    unsigned long flags,
-                   unsigned int vcpus)
+                   unsigned int vcpus,
+                   unsigned int store_evtchn,
+                   unsigned long *store_mfn)
 {
     dom0_op_t launch_op, op;
     int initrd_fd = -1;
@@ -320,7 +336,7 @@
     unsigned long nr_pages;
     char         *image = NULL;
     unsigned long image_size, initrd_size=0;
-    unsigned long vstartinfo_start, vkern_entry;
+    unsigned long vstartinfo_start, vkern_entry, vstack_start;
 
     if ( (nr_pages = xc_get_tot_pages(xc_handle, domid)) < 0 )
     {
@@ -377,11 +393,12 @@
     }
 
     if ( setup_guest(xc_handle, domid, image, image_size, 
-                       initrd_gfd, initrd_size, nr_pages, 
-                       &vstartinfo_start, &vkern_entry,
-                       ctxt, cmdline,
-                       op.u.getdomaininfo.shared_info_frame,
-                       control_evtchn, flags, vcpus) < 0 )
+                     initrd_gfd, initrd_size, nr_pages, 
+                     &vstartinfo_start, &vkern_entry,
+                     &vstack_start, ctxt, cmdline,
+                     op.u.getdomaininfo.shared_info_frame,
+                     control_evtchn, flags, vcpus,
+                     store_evtchn, store_mfn) < 0 )
     {
         ERROR("Error constructing guest OS");
         goto error_out;
@@ -412,7 +429,7 @@
     ctxt->user_regs.ss = FLAT_KERNEL_DS;
     ctxt->user_regs.cs = FLAT_KERNEL_CS;
     ctxt->user_regs.eip = vkern_entry;
-    ctxt->user_regs.esp = vstartinfo_start + 2*PAGE_SIZE;
+    ctxt->user_regs.esp = vstack_start + PAGE_SIZE;
     ctxt->user_regs.esi = vstartinfo_start;
     ctxt->user_regs.eflags = 1 << 9; /* Interrupt Enable */
 
@@ -434,7 +451,7 @@
 
     /* Ring 1 stack is the initial stack. */
     ctxt->kernel_ss = FLAT_KERNEL_DS;
-    ctxt->kernel_sp = vstartinfo_start + 2*PAGE_SIZE;
+    ctxt->kernel_sp = vstack_start + PAGE_SIZE;
 
     /* No debugging. */
     memset(ctxt->debugreg, 0, sizeof(ctxt->debugreg));
diff -Nru a/tools/python/xen/lowlevel/xc/xc.c 
b/tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c 2005-06-09 13:08:00 -04:00
+++ b/tools/python/xen/lowlevel/xc/xc.c 2005-06-09 13:08:00 -04:00
@@ -260,25 +260,28 @@
 {
     XcObject *xc = (XcObject *)self;
 
-    u32   dom;
+    u32 dom;
     char *image, *ramdisk = NULL, *cmdline = "";
-    int   control_evtchn, flags = 0, vcpus = 1;
+    int flags = 0, vcpus = 1;
+    int control_evtchn, store_evtchn;
+    unsigned long store_mfn = 0;
 
-    static char *kwd_list[] = { "dom", "control_evtchn", 
-                                "image", "ramdisk", "cmdline", "flags", 
"vcpus",
-                                NULL };
+    static char *kwd_list[] = { "dom", "control_evtchn", "store_evtchn", 
+                                "image", "ramdisk", "cmdline", "flags",
+                               "vcpus", NULL };
 
-    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iis|ssii", kwd_list, 
-                                      &dom, &control_evtchn, 
-                                      &image, &ramdisk, &cmdline, &flags, 
&vcpus) )
+    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiis|ssii", kwd_list,
+                                      &dom, &control_evtchn, &store_evtchn,
+                                      &image, &ramdisk, &cmdline, &flags,
+                                      &vcpus) )
         return NULL;
 
     if ( xc_linux_build(xc->xc_handle, dom, image,
-                        ramdisk, cmdline, control_evtchn, flags, vcpus) != 0 )
+                        ramdisk, cmdline, control_evtchn, flags, vcpus,
+                        store_evtchn, &store_mfn) != 0 )
         return PyErr_SetFromErrno(xc_error);
     
-    Py_INCREF(zero);
-    return zero;
+    return Py_BuildValue("{s:i}", "store_mfn", store_mfn);
 }
 
 static PyObject *pyxc_plan9_build(PyObject *self,
diff -Nru a/tools/python/xen/xend/XendDomainInfo.py 
b/tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   2005-06-09 13:08:00 -04:00
+++ b/tools/python/xen/xend/XendDomainInfo.py   2005-06-09 13:08:00 -04:00
@@ -148,7 +148,7 @@
     def _create(cls, uuid=None):
         """Create a vm object with a uuid.
 
-        @param uuid uuid to use (generated if None)
+        @param uuid uuid to use
         @return vm
         """
         if uuid is None:
@@ -178,6 +178,7 @@
 
         @param savedinfo: saved info from the domain DB
         @param info:      domain info from xc
+        @param uuid:      uuid to use
         @type  info:      xc domain dict
         """
         vm = cls._create(uuid=uuid)
@@ -216,6 +217,7 @@
         """Create a domain and a VM object to do a restore.
 
         @param config:    domain configuration
+        @param uuid:      uuid to use
         """
         vm = cls._create(uuid=uuid)
         dom = xc.domain_create()
@@ -239,6 +241,8 @@
         self.image = None
 
         self.channel = None
+        self.store_channel = None
+        self.store_mfs = None
         self.controllers = {}
         
         self.info = None
diff -Nru a/tools/python/xen/xend/image.py b/tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    2005-06-09 13:08:00 -04:00
+++ b/tools/python/xen/xend/image.py    2005-06-09 13:08:00 -04:00

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