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] Split out context fetching into separate DOM0 op

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Split out context fetching into separate DOM0 op
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Wed, 11 May 2005 15:05:07 +0000
Delivery-date: Wed, 11 May 2005 21:04:14 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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 Development List <xen-devel@xxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
ChangeSet 1.1441, 2005/05/11 16:05:07+01:00, cl349@xxxxxxxxxxxxxxxxxxxx

        Split out context fetching into separate DOM0 op
        make GETDOMAININFO a little more sensible with respect to MP
        make coredump dump all cpu contexts
        Signed-off-by: Kip Macy <kmacy@xxxxxxxxxx>
        Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>



 tools/libxc/xc.h               |   14 +++---
 tools/libxc/xc_core.c          |   24 +++++++---
 tools/libxc/xc_domain.c        |   38 ++++++----------
 tools/libxc/xc_linux_build.c   |    9 +++
 tools/libxc/xc_linux_restore.c |    2 
 tools/libxc/xc_linux_save.c    |   26 +++++++----
 tools/libxc/xc_plan9_build.c   |   10 +++-
 tools/libxc/xc_private.c       |   15 ++----
 tools/libxc/xc_ptrace.c        |   11 +---
 tools/libxc/xc_vmx_build.c     |    9 +++
 xen/common/dom0_ops.c          |   94 +++++++++++++++++++++++++++++++++--------
 xen/include/public/dom0_ops.h  |   14 +++++-
 12 files changed, 177 insertions(+), 89 deletions(-)


diff -Nru a/tools/libxc/xc.h b/tools/libxc/xc.h
--- a/tools/libxc/xc.h  2005-05-11 17:04:42 -04:00
+++ b/tools/libxc/xc.h  2005-05-11 17:04:42 -04:00
@@ -110,8 +110,10 @@
 
 typedef struct {
     u32           domid;
-    unsigned int  cpu;
+    unsigned int  flags;
+    unsigned int  processors;
     unsigned int  vcpus;
+    u16           n_vcpus;     
     unsigned int  dying:1, crashed:1, shutdown:1, 
                   paused:1, blocked:1, running:1;
     unsigned int  shutdown_reason; /* only meaningful if shutdown==1 */
@@ -199,11 +201,11 @@
  *            domain
  * @return 0 on success, -1 on failure
  */
-int xc_domain_getfullinfo(int xc_handle,
-                          u32 domid,
-                          u32 vcpu,
-                          xc_domaininfo_t *info,
-                          vcpu_guest_context_t *ctxt);
+int xc_domain_get_vcpu_context(int xc_handle,
+                             u32 domid,
+                             u32 vcpu,
+                             vcpu_guest_context_t *ctxt);
+
 int xc_domain_setcpuweight(int xc_handle,
                            u32 domid,
                            float weight);
diff -Nru a/tools/libxc/xc_core.c b/tools/libxc/xc_core.c
--- a/tools/libxc/xc_core.c     2005-05-11 17:04:42 -04:00
+++ b/tools/libxc/xc_core.c     2005-05-11 17:04:42 -04:00
@@ -7,6 +7,7 @@
 /* number of pages to write at a time */
 #define DUMP_INCREMENT 4 * 1024
 #define round_pgup(_p)    (((_p)+(PAGE_SIZE-1))&PAGE_MASK)
+
 static int
 copy_from_domain_page(int xc_handle,
                      u32 domid,
@@ -28,13 +29,14 @@
                   u32 domid,
                   const char *corename)
 {
-       vcpu_guest_context_t st_ctxt, *ctxt = &st_ctxt;
        unsigned long nr_pages;
        unsigned long *page_array;
-       xc_domaininfo_t st_info, *info = &st_info;
+       xc_dominfo_t info;
        int i, dump_fd;
        char *dump_mem, *dump_mem_start = NULL;
        struct xc_core_header header;
+       vcpu_guest_context_t     ctxt[MAX_VIRT_CPUS];
+
        
        if ((dump_fd = open(corename, O_CREAT|O_RDWR, S_IWUSR|S_IRUSR)) < 0) {
                PERROR("Could not open corefile %s: %s", corename, 
strerror(errno));
@@ -46,14 +48,22 @@
                goto error_out;
        }
        
-       if (xc_domain_getfullinfo(xc_handle, domid, 0/* XXX hardcode */, info, 
ctxt)) {
-               PERROR("Could not get full info for domain");
+       if (xc_domain_getinfo(xc_handle, domid, 1, &info)) {
+               PERROR("Could not get info for domain");
                goto error_out;
        }
+       
+       for (i = 0; i < info.n_vcpus; i++) {
+               if (xc_domain_get_vcpu_context(xc_handle, domid, i, &ctxt[i])) {
+                       PERROR("Could not get all vcpu contexts for domain");
+                       goto error_out;
+               }
+       }
+       
+       nr_pages = info.nr_pages;
 
-       nr_pages = info->tot_pages;
        header.xch_magic = 0xF00FEBED; 
-       header.xch_nr_vcpus = 1; /* no interface to query at the moment */
+       header.xch_nr_vcpus = info.n_vcpus;
        header.xch_nr_pages = nr_pages;
        header.xch_ctxt_offset = sizeof(struct xc_core_header);
        header.xch_index_offset = sizeof(struct xc_core_header) +
@@ -62,7 +72,7 @@
            sizeof(vcpu_guest_context_t) + nr_pages * sizeof(unsigned long));
 
        write(dump_fd, &header, sizeof(struct xc_core_header));
-       write(dump_fd, ctxt, sizeof(st_ctxt));
+       write(dump_fd, &ctxt, sizeof(ctxt[0]) * info.n_vcpus);
 
        if ((page_array = malloc(nr_pages * sizeof(unsigned long))) == NULL) {
            printf("Could not allocate memory\n");
diff -Nru a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c
--- a/tools/libxc/xc_domain.c   2005-05-11 17:04:42 -04:00
+++ b/tools/libxc/xc_domain.c   2005-05-11 17:04:42 -04:00
@@ -112,14 +112,12 @@
     {
         op.cmd = DOM0_GETDOMAININFO;
         op.u.getdomaininfo.domain = (domid_t)next_domid;
-        op.u.getdomaininfo.exec_domain = 0; // FIX ME?!?
-        op.u.getdomaininfo.ctxt = NULL; /* no exec context info, thanks. */
         if ( (rc = do_dom0_op(xc_handle, &op)) < 0 )
             break;
-        info->domid   = (u16)op.u.getdomaininfo.domain;
-
-        info->cpu     =
-            (op.u.getdomaininfo.flags>>DOMFLAGS_CPUSHIFT) & DOMFLAGS_CPUMASK;
+        info->domid      = (u16)op.u.getdomaininfo.domain;
+        info->processors = op.u.getdomaininfo.processors;
+       info->n_vcpus    = op.u.getdomaininfo.n_active_vcpus;
+       info->flags      = op.u.getdomaininfo.flags;
 
         info->dying    = !!(op.u.getdomaininfo.flags & DOMFLAGS_DYING);
         info->crashed  = !!(op.u.getdomaininfo.flags & DOMFLAGS_CRASHED);
@@ -142,28 +140,27 @@
         memcpy(&info->cpumap, &op.u.getdomaininfo.cpumap, 
                sizeof(info->cpumap));
 
-        next_domid = (u16)op.u.getdomaininfo.domain + 1;
-        info++;
+       next_domid = (u16)op.u.getdomaininfo.domain + 1;
+       info++;
     }
 
-    if(!nr_doms) return rc; 
+    if( !nr_doms ) return rc; 
 
     return nr_doms;
 }
 
-int xc_domain_getfullinfo(int xc_handle,
-                          u32 domid,
-                          u32 vcpu,
-                          xc_domaininfo_t *info,
-                          vcpu_guest_context_t *ctxt)
+int xc_domain_get_vcpu_context(int xc_handle,
+                              u32 domid,
+                              u32 vcpu,
+                              vcpu_guest_context_t *ctxt)
 {
     int rc, errno_saved;
     dom0_op_t op;
 
-    op.cmd = DOM0_GETDOMAININFO;
-    op.u.getdomaininfo.domain = (domid_t)domid;
-    op.u.getdomaininfo.exec_domain = (u16)vcpu;
-    op.u.getdomaininfo.ctxt = ctxt;
+    op.cmd = DOM0_GETVCPUCONTEXT;
+    op.u.getvcpucontext.domain = (domid_t)domid;
+    op.u.getvcpucontext.exec_domain = (u16)vcpu;
+    op.u.getvcpucontext.ctxt = ctxt;
 
     if ( (ctxt != NULL) &&
          ((rc = mlock(ctxt, sizeof(*ctxt))) != 0) )
@@ -178,10 +175,7 @@
         errno = errno_saved;
     }
 
-    if ( info != NULL )
-        memcpy(info, &op.u.getdomaininfo, sizeof(*info));
-
-    if ( ((u16)op.u.getdomaininfo.domain != domid) && (rc > 0) )
+    if ( rc > 0 )
         return -ESRCH;
     else
         return rc;
diff -Nru a/tools/libxc/xc_linux_build.c b/tools/libxc/xc_linux_build.c
--- a/tools/libxc/xc_linux_build.c      2005-05-11 17:04:42 -04:00
+++ b/tools/libxc/xc_linux_build.c      2005-05-11 17:04:42 -04:00
@@ -356,14 +356,19 @@
 
     op.cmd = DOM0_GETDOMAININFO;
     op.u.getdomaininfo.domain = (domid_t)domid;
-    op.u.getdomaininfo.exec_domain = 0;
-    op.u.getdomaininfo.ctxt = ctxt;
     if ( (do_dom0_op(xc_handle, &op) < 0) || 
          ((u16)op.u.getdomaininfo.domain != domid) )
     {
         PERROR("Could not get info on domain");
         goto error_out;
     }
+
+    if ( xc_domain_get_vcpu_context(xc_handle, domid, 0, ctxt) )
+    {
+        PERROR("Could not get vcpu context");
+        goto error_out;
+    }
+
     if ( !(op.u.getdomaininfo.flags & DOMFLAGS_PAUSED) ||
          (ctxt->pt_base != 0) )
     {
diff -Nru a/tools/libxc/xc_linux_restore.c b/tools/libxc/xc_linux_restore.c
--- a/tools/libxc/xc_linux_restore.c    2005-05-11 17:04:42 -04:00
+++ b/tools/libxc/xc_linux_restore.c    2005-05-11 17:04:42 -04:00
@@ -181,8 +181,6 @@
     /* Get the domain's shared-info frame. */
     op.cmd = DOM0_GETDOMAININFO;
     op.u.getdomaininfo.domain = (domid_t)dom;
-    op.u.getdomaininfo.exec_domain = 0;
-    op.u.getdomaininfo.ctxt = NULL;
     if ( do_dom0_op(xc_handle, &op) < 0 )
     {
         xcio_error(ioctxt, "Could not get information on new domain");
diff -Nru a/tools/libxc/xc_linux_save.c b/tools/libxc/xc_linux_save.c
--- a/tools/libxc/xc_linux_save.c       2005-05-11 17:04:42 -04:00
+++ b/tools/libxc/xc_linux_save.c       2005-05-11 17:04:42 -04:00
@@ -324,7 +324,7 @@
 
 
 int suspend_and_state(int xc_handle, XcIOContext *ioctxt,                    
-                      xc_domaininfo_t *info,
+                      xc_dominfo_t *info,
                       vcpu_guest_context_t *ctxt)
 {
     int i=0;
@@ -333,13 +333,18 @@
 
 retry:
 
-    if ( xc_domain_getfullinfo(xc_handle, ioctxt->domain, /* FIXME */ 0, 
-                               info, ctxt) )
+    if ( xc_domain_getinfo(xc_handle, ioctxt->domain, 1, info) )
     {
        xcio_error(ioctxt, "Could not get full domain info");
        return -1;
     }
 
+    if ( xc_domain_get_vcpu_context(xc_handle, ioctxt->domain, 0 /* XXX */, 
+                                   ctxt) )
+    {
+        xcio_error(ioctxt, "Could not get vcpu context");
+    }
+
     if ( (info->flags & 
           (DOMFLAGS_SHUTDOWN | (SHUTDOWN_suspend<<DOMFLAGS_SHUTDOWNSHIFT))) ==
          (DOMFLAGS_SHUTDOWN | (SHUTDOWN_suspend<<DOMFLAGS_SHUTDOWNSHIFT)) )
@@ -374,7 +379,7 @@
 
 int xc_linux_save(int xc_handle, XcIOContext *ioctxt)
 {
-    xc_domaininfo_t info;
+    xc_dominfo_t info;
 
     int rc = 1, i, j, k, last_iter, iter = 0;
     unsigned long mfn;
@@ -444,13 +449,18 @@

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Split out context fetching into separate DOM0 op, BitKeeper Bot <=