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] Store an opaque handle (tools uuid) in the domain struct

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Store an opaque handle (tools uuid) in the domain structure
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 14 Oct 2005 18:30:11 +0000
Delivery-date: Fri, 14 Oct 2005 18:27:42 +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-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID bd3268de41453531bd340463eb7546120a9348c9
# Parent  70aa62954e91ccbfbd80be4aba45a945a7d1b428
Store an opaque handle (tools uuid) in the domain structure
within Xen. Refactor GETVCPUCONTEXT into an op of the same
name plus a new op GETVCPUINFO. Move the cpumap and cpu info
arrays from GETDOMAININFO and move into new GETVCPUINFO.

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

diff -r 70aa62954e91 -r bd3268de4145 tools/libxc/xc_core.c
--- a/tools/libxc/xc_core.c     Fri Oct 14 00:42:34 2005
+++ b/tools/libxc/xc_core.c     Fri Oct 14 14:40:48 2005
@@ -33,7 +33,7 @@
     unsigned long nr_pages;
     unsigned long *page_array;
     xc_dominfo_t info;
-    int i, j, vcpu_map_size, dump_fd;
+    int i, j, dump_fd;
     char *dump_mem, *dump_mem_start = NULL;
     struct xc_core_header header;
     vcpu_guest_context_t     ctxt[MAX_VIRT_CPUS];
@@ -54,18 +54,9 @@
         goto error_out;
     }
  
-    vcpu_map_size =  sizeof(info.vcpu_to_cpu) / sizeof(info.vcpu_to_cpu[0]);
-
-    for (i = 0, j = 0; i < vcpu_map_size; i++) {
-        if (info.vcpu_to_cpu[i] == -1) {
-            continue;
-        }
-        if (xc_domain_get_vcpu_context(xc_handle, domid, i, &ctxt[j])) {
-            PERROR("Could not get all vcpu contexts for domain");
-            goto error_out;
-        }
-        j++;
-    }
+    for (i = 0, j = 0; i < 32; i++)
+        if (xc_domain_get_vcpu_context(xc_handle, domid, i, &ctxt[j]) == 0)
+            j++;
  
     nr_pages = info.nr_pages;
 
diff -r 70aa62954e91 -r bd3268de4145 tools/libxc/xc_domain.c
--- a/tools/libxc/xc_domain.c   Fri Oct 14 00:42:34 2005
+++ b/tools/libxc/xc_domain.c   Fri Oct 14 14:40:48 2005
@@ -11,6 +11,7 @@
 
 int xc_domain_create(int xc_handle,
                      uint32_t ssidref,
+                     xen_domain_handle_t handle,
                      uint32_t *pdomid)
 {
     int err;
@@ -19,6 +20,7 @@
     op.cmd = DOM0_CREATEDOMAIN;
     op.u.createdomain.domain = (domid_t)*pdomid;
     op.u.createdomain.ssidref = ssidref;
+    memcpy(op.u.createdomain.handle, handle, sizeof(xen_domain_handle_t));
     if ( (err = do_dom0_op(xc_handle, &op)) != 0 )
         return err;
 
@@ -59,7 +61,7 @@
 int xc_domain_pincpu(int xc_handle,
                      uint32_t domid, 
                      int vcpu,
-                     cpumap_t *cpumap)
+                     cpumap_t cpumap)
 {
     dom0_op_t op;
     op.cmd = DOM0_PINCPUDOMAIN;
@@ -112,10 +114,9 @@
         info->shared_info_frame = op.u.getdomaininfo.shared_info_frame;
         info->cpu_time = op.u.getdomaininfo.cpu_time;
         info->vcpus = op.u.getdomaininfo.n_vcpu;
-        memcpy(&info->vcpu_to_cpu, &op.u.getdomaininfo.vcpu_to_cpu, 
-               sizeof(info->vcpu_to_cpu));
-        memcpy(&info->cpumap, &op.u.getdomaininfo.cpumap, 
-               sizeof(info->cpumap));
+
+        memcpy(info->handle, op.u.getdomaininfo.handle,
+               sizeof(xen_domain_handle_t));
 
         next_domid = (uint16_t)op.u.getdomaininfo.domain + 1;
         info++;
@@ -166,19 +167,14 @@
     op.u.getvcpucontext.vcpu   = (uint16_t)vcpu;
     op.u.getvcpucontext.ctxt   = ctxt;
 
-    if ( (ctxt != NULL) &&
-         ((rc = mlock(ctxt, sizeof(*ctxt))) != 0) )
+    if ( (rc = mlock(ctxt, sizeof(*ctxt))) != 0 )
         return rc;
 
     rc = do_dom0_op(xc_handle, &op);
 
-    if ( ctxt != NULL )
-        safe_munlock(ctxt, sizeof(*ctxt));
-
-    if ( rc > 0 )
-        return -ESRCH;
-    else
-        return rc;
+    safe_munlock(ctxt, sizeof(*ctxt));
+
+    return rc;
 }
 
 
diff -r 70aa62954e91 -r bd3268de4145 tools/libxc/xc_private.c
--- a/tools/libxc/xc_private.c  Fri Oct 14 00:42:34 2005
+++ b/tools/libxc/xc_private.c  Fri Oct 14 14:40:48 2005
@@ -256,16 +256,15 @@
 {
     dom0_op_t op;
 
-    op.cmd = DOM0_GETVCPUCONTEXT;
-    op.u.getvcpucontext.domain = (domid_t)domid;
-    op.u.getvcpucontext.vcpu   = (uint16_t)vcpu;
-    op.u.getvcpucontext.ctxt   = NULL;
+    op.cmd = DOM0_GETVCPUINFO;
+    op.u.getvcpuinfo.domain = (domid_t)domid;
+    op.u.getvcpuinfo.vcpu   = (uint16_t)vcpu;
     if ( (do_dom0_op(xc_handle, &op) < 0) )
     {
         PERROR("Could not get info on domain");
         return -1;
     }
-    return op.u.getvcpucontext.cpu_time;
+    return op.u.getvcpuinfo.cpu_time;
 }
 
 
diff -r 70aa62954e91 -r bd3268de4145 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h     Fri Oct 14 00:42:34 2005
+++ b/tools/libxc/xenctrl.h     Fri Oct 14 14:40:48 2005
@@ -123,23 +123,23 @@
  */
 
 typedef struct {
-    uint32_t           domid;
-    uint32_t           ssidref;
+    uint32_t      domid;
+    uint32_t      ssidref;
     unsigned int  dying:1, crashed:1, shutdown:1, 
                   paused:1, blocked:1, running:1;
     unsigned int  shutdown_reason; /* only meaningful if shutdown==1 */
     unsigned long nr_pages;
     unsigned long shared_info_frame;
-    uint64_t           cpu_time;
+    uint64_t      cpu_time;
     unsigned long max_memkb;
     unsigned int  vcpus;
-    int32_t           vcpu_to_cpu[MAX_VIRT_CPUS];
-    cpumap_t      cpumap[MAX_VIRT_CPUS];
+    xen_domain_handle_t handle;
 } xc_dominfo_t;
 
 typedef dom0_getdomaininfo_t xc_domaininfo_t;
 int xc_domain_create(int xc_handle, 
                      uint32_t ssidref,
+                     xen_domain_handle_t handle,
                      uint32_t *pdomid);
 
 
@@ -194,7 +194,8 @@
 int xc_domain_pincpu(int xc_handle,
                      uint32_t domid,
                      int vcpu,
-                     cpumap_t *cpumap);
+                     cpumap_t cpumap);
+
 /**
  * This function will return information about one or more domains. It is
  * designed to iterate over the list of domains. If a single domain is
diff -r 70aa62954e91 -r bd3268de4145 tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Fri Oct 14 00:42:34 2005
+++ b/tools/python/xen/lowlevel/xc/xc.c Fri Oct 14 14:40:48 2005
@@ -77,17 +77,41 @@
 {
     XcObject *xc = (XcObject *)self;
 
-    uint32_t          dom = 0;
-    int          ret;
-    uint32_t          ssidref = 0x0;
-
-    static char *kwd_list[] = { "dom", "ssidref", NULL };
-
-    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|ii", kwd_list,
-                                      &dom, &ssidref))
-        return NULL;
-
-    if ( (ret = xc_domain_create(xc->xc_handle, ssidref, &dom)) < 0 )
+    uint32_t dom = 0;
+    int      ret, i;
+    uint32_t ssidref = 0;
+    PyObject *pyhandle = NULL;
+    xen_domain_handle_t handle = { 
+        0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef,
+        0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef };
+
+    static char *kwd_list[] = { "dom", "ssidref", "handle", NULL };
+
+    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|iiO", kwd_list,
+                                      &dom, &ssidref, &pyhandle))
+        return NULL;
+
+    if ( pyhandle != NULL )
+    {
+        if ( !PyList_Check(pyhandle) || 
+             (PyList_Size(pyhandle) != sizeof(xen_domain_handle_t)) )
+        {
+        out_exception:
+            errno = EINVAL;
+            PyErr_SetFromErrno(xc_error);
+            return NULL;
+        }
+
+        for ( i = 0; i < sizeof(xen_domain_handle_t); i++ )
+        {
+            PyObject *p = PyList_GetItem(pyhandle, i);
+            if ( !PyInt_Check(p) )
+                goto out_exception;
+            handle[i] = (uint8_t)PyInt_AsLong(p);
+        }
+    }
+
+    if ( (ret = xc_domain_create(xc->xc_handle, ssidref, handle, &dom)) < 0 )
         return PyErr_SetFromErrno(xc_error);
 
     return PyInt_FromLong(dom);
@@ -181,7 +205,7 @@
 
     uint32_t dom;
     int vcpu = 0;
-    cpumap_t cpumap = 0xFFFFFFFF;
+    cpumap_t cpumap = ~0ULL;
 
     static char *kwd_list[] = { "dom", "vcpu", "cpumap", NULL };
 
@@ -189,7 +213,7 @@
                                       &dom, &vcpu, &cpumap) )
         return NULL;
 
-    if ( xc_domain_pincpu(xc->xc_handle, dom, vcpu, &cpumap) != 0 )
+    if ( xc_domain_pincpu(xc->xc_handle, dom, vcpu, cpumap) != 0 )
         return PyErr_SetFromErrno(xc_error);
     
     Py_INCREF(zero);
@@ -223,7 +247,7 @@
                                      PyObject *kwds)
 {
     XcObject *xc = (XcObject *)self;
-    PyObject *list, *vcpu_list, *cpumap_list, *info_dict;
+    PyObject *list, *info_dict;
 
     uint32_t first_dom = 0;
     int max_doms = 1024, nr_doms, i, j;
@@ -249,15 +273,9 @@
     list = PyList_New(nr_doms);
     for ( i = 0 ; i < nr_doms; i++ )
     {
-        vcpu_list = PyList_New(MAX_VIRT_CPUS);
-        cpumap_list = PyList_New(MAX_VIRT_CPUS);
-        for ( j = 0; j < MAX_VIRT_CPUS; j++ ) {
-            PyList_SetItem( vcpu_list, j, 
-                            Py_BuildValue("i", info[i].vcpu_to_cpu[j]));
-            PyList_SetItem( cpumap_list, j, 
-                            Py_BuildValue("i", info[i].cpumap[j]));
-        }
-                 
+        PyObject *pyhandle = PyList_New(sizeof(xen_domain_handle_t));
+        for ( j = 0; j < sizeof(xen_domain_handle_t); j++ )
+            PyList_SetItem(pyhandle, j, PyInt_FromLong(info[i].handle[j]));
         info_dict = Py_BuildValue("{s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i"
                                   ",s:l,s:L,s:l,s:i,s:i}",
                                   "dom",       info[i].domid,
@@ -273,10 +291,8 @@
                                   "maxmem_kb", info[i].max_memkb,
                                   "ssidref",   info[i].ssidref,
                                   "shutdown_reason", info[i].shutdown_reason);
-        PyDict_SetItemString( info_dict, "vcpu_to_cpu", vcpu_list );
-        PyDict_SetItemString( info_dict, "cpumap", cpumap_list );
-        PyList_SetItem( list, i, info_dict);
- 
+        PyDict_SetItemString(info_dict, "handle", pyhandle);
+        PyList_SetItem(list, i, info_dict);
     }
 
     free(info);
diff -r 70aa62954e91 -r bd3268de4145 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Fri Oct 14 00:42:34 2005
+++ b/tools/python/xen/xend/XendDomainInfo.py   Fri Oct 14 14:40:48 2005
@@ -1377,8 +1377,7 @@
         # target = 0 means use all processors
         if target > 0:
             # count the number of online vcpus (cpu values in v2c map >= 0)
-            vcpu_to_cpu = dom_get(dom)['vcpu_to_cpu']
-            vcpus_online = len(filter(lambda x: x >= 0, vcpu_to_cpu))
+            vcpus_online = dom_get(dom)['vcpus']
             log.debug("found %d vcpus online", vcpus_online)
 
             # disable any extra vcpus that are online over the requested target
diff -r 70aa62954e91 -r bd3268de4145 tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py       Fri Oct 14 00:42:34 2005
+++ b/tools/python/xen/xm/main.py       Fri Oct 14 14:40:48 2005
@@ -270,9 +270,9 @@
         vcpuinfo['dom']    = int(sxp.child_value(info, 'domid', '-1'))
         vcpuinfo['vcpu']   = int(count)
         vcpuinfo['cpu']    = int(cpu)
-        vcpuinfo['cpumap'] = int(cpumap[count])&mask
+        #vcpuinfo['cpumap'] = int(cpumap[count])&mask
         count = count + 1
-        dominfo['vcpulist'].append(vcpuinfo)
+        #dominfo['vcpulist'].append(vcpuinfo)
     return dominfo
         
 def xm_brief_list(domsinfo):
diff -r 70aa62954e91 -r bd3268de4145 
tools/xenstat/libxenstat/src/xen-interface.c
--- a/tools/xenstat/libxenstat/src/xen-interface.c      Fri Oct 14 00:42:34 2005
+++ b/tools/xenstat/libxenstat/src/xen-interface.c      Fri Oct 14 14:40:48 2005
@@ -178,16 +178,15 @@
                             unsigned int vcpu)
 {
        dom0_op_t op;
-       op.u.getvcpucontext.domain = domain;
-       op.u.getvcpucontext.vcpu = vcpu;
-       op.u.getvcpucontext.ctxt = NULL;
-
-       if (xi_make_dom0_op(handle, &op, DOM0_GETVCPUCONTEXT) < 0) {
-               perror("DOM0_GETVCPUCONTEXT Hypercall failed");
-               return -1;
-       }
-
-       return op.u.getvcpucontext.cpu_time;
+       op.u.getvcpuinfo.domain = domain;
+       op.u.getvcpuinfo.vcpu   = vcpu;
+
+       if (xi_make_dom0_op(handle, &op, DOM0_GETVCPUINFO) < 0) {
+               perror("DOM0_GETVCPUINFO Hypercall failed");
+               return -1;
+       }
+
+       return op.u.getvcpuinfo.cpu_time;
 }
 
 /* gets xen version information from hypervisor */
diff -r 70aa62954e91 -r bd3268de4145 xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c      Fri Oct 14 00:42:34 2005
+++ b/xen/arch/x86/setup.c      Fri Oct 14 14:40:48 2005
@@ -420,6 +420,9 @@
            nr_pages << (PAGE_SHIFT - 10));
     total_pages = nr_pages;
 
+    /* Sanity check for unwanted bloat of dom0_op_t structure. */
+    BUG_ON(sizeof(((dom0_op_t *)0)->u) != sizeof(((dom0_op_t *)0)->u.pad));
+
     init_frametable();
 
     end_boot_allocator();
diff -r 70aa62954e91 -r bd3268de4145 xen/common/dom0_ops.c
--- a/xen/common/dom0_ops.c     Fri Oct 14 00:42:34 2005
+++ b/xen/common/dom0_ops.c     Fri Oct 14 14:40:48 2005
@@ -48,26 +48,20 @@
     
     info->domain = d->domain_id;
     
-    memset(&info->vcpu_to_cpu, -1, sizeof(info->vcpu_to_cpu));
-    memset(&info->cpumap, 0, sizeof(info->cpumap));
-
     /* 
      * - domain is marked as blocked only if all its vcpus are blocked
      * - domain is marked as running if any of its vcpus is running
-     * - only map vcpus that aren't down.  Note, at some point we may
-     *   wish to demux the -1 value to indicate down vs. not-ever-booted
      */
     for_each_vcpu ( d, v ) {
-        /* only map vcpus that are up */
-        if ( !(test_bit(_VCPUF_down, &v->vcpu_flags)) )
-            info->vcpu_to_cpu[v->vcpu_id] = v->processor;
-        info->cpumap[v->vcpu_id] = v->cpumap;
-        if ( !(v->vcpu_flags & VCPUF_blocked) )
-            flags &= ~DOMFLAGS_BLOCKED;
-        if ( v->vcpu_flags & VCPUF_running )
-            flags |= DOMFLAGS_RUNNING;
         cpu_time += v->cpu_time;
-        vcpu_count++;
+        if ( !test_bit(_VCPUF_down, &v->vcpu_flags) )
+        {
+            if ( !(v->vcpu_flags & VCPUF_blocked) )
+                flags &= ~DOMFLAGS_BLOCKED;
+            if ( v->vcpu_flags & VCPUF_running )
+                flags |= DOMFLAGS_RUNNING;
+            vcpu_count++;
+        }
     }
     
     info->cpu_time = cpu_time;
@@ -87,6 +81,8 @@
     info->tot_pages         = d->tot_pages;
     info->max_pages         = d->max_pages;
     info->shared_info_frame = __pa(d->shared_info) >> PAGE_SHIFT;
+
+    memcpy(info->handle, d->handle, sizeof(xen_domain_handle_t));
 }
 
 long do_dom0_op(dom0_op_t *u_dom0_op)
@@ -214,6 +210,9 @@
         if ( (d = do_createdomain(dom, pro)) == NULL )
             break;
 
+        memcpy(d->handle, op->u.createdomain.handle,
+               sizeof(xen_domain_handle_t));
+
         ret = 0;
 
         op->u.createdomain.domain = d->domain_id;
@@ -288,8 +287,6 @@
         domid_t dom = op->u.pincpudomain.domain;
         struct domain *d = find_domain_by_id(dom);
         struct vcpu *v;
-        cpumap_t cpumap;
-
 
         if ( d == NULL )
         {
@@ -320,26 +317,17 @@
             break;
         }
 
-        if ( copy_from_user(&cpumap, op->u.pincpudomain.cpumap,
-                            sizeof(cpumap)) )
-        {
-            ret = -EFAULT;
-            put_domain(d);
-            break;
-        }
-
-        /* update cpumap for this vcpu */
-        v->cpumap = cpumap;
-
-        if ( cpumap == CPUMAP_RUNANYWHERE )
+        v->cpumap = op->u.pincpudomain.cpumap;
+
+        if ( v->cpumap == CPUMAP_RUNANYWHERE )
         {
             clear_bit(_VCPUF_cpu_pinned, &v->vcpu_flags);
         }
         else
         {
             /* pick a new cpu from the usable map */
-            int new_cpu = (int)find_first_set_bit(cpumap) % num_online_cpus();
-
+            int new_cpu;
+            new_cpu = (int)find_first_set_bit(v->cpumap) % num_online_cpus();
             vcpu_pause(v);
             vcpu_migrate_cpu(v, new_cpu);
             set_bit(_VCPUF_cpu_pinned, &v->vcpu_flags);
@@ -393,6 +381,8 @@
         put_domain(d);
     }
     break;
+
+
 
     case DOM0_GETDOMAININFOLIST:
     { 
@@ -446,66 +436,73 @@
         struct vcpu_guest_context *c;
         struct domain             *d;
         struct vcpu               *v;
-        int i;
-
-        d = find_domain_by_id(op->u.getvcpucontext.domain);
-        if ( d == NULL )
-        {
-            ret = -ESRCH;
-            break;
-        }
-
+
+        ret = -ESRCH;
+        if ( (d = find_domain_by_id(op->u.getvcpucontext.domain)) == NULL )
+            break;
+
+        ret = -EINVAL;
         if ( op->u.getvcpucontext.vcpu >= MAX_VIRT_CPUS )
-        {
-            ret = -EINVAL;
-            put_domain(d);
-            break;
-        }
-
-        /* find first valid vcpu starting from request. */
-        v = NULL;
-        for ( i = op->u.getvcpucontext.vcpu; i < MAX_VIRT_CPUS; i++ )
-        {
-            v = d->vcpu[i];
-            if ( v != NULL && !(test_bit(_VCPUF_down, &v->vcpu_flags)) )
-                break;
-        }
-        
-        if ( v == NULL )
-        {
-            ret = -ESRCH;
-            put_domain(d);
-            break;
-        }
-
-        op->u.getvcpucontext.cpu_time = v->cpu_time;
-
-        if ( op->u.getvcpucontext.ctxt != NULL )
-        {
-            if ( (c = xmalloc(struct vcpu_guest_context)) == NULL )
-            {
-                ret = -ENOMEM;
-                put_domain(d);
-                break;
-            }
-
-            if ( v != current )
-                vcpu_pause(v);
-
-            arch_getdomaininfo_ctxt(v,c);
-
-            if ( v != current )
-                vcpu_unpause(v);
-
-            if ( copy_to_user(op->u.getvcpucontext.ctxt, c, sizeof(*c)) )
-                ret = -EINVAL;
-
-            xfree(c);
-        }
+            goto getvcpucontext_out;
+
+        ret = -ESRCH;
+        v = d->vcpu[op->u.getvcpucontext.vcpu];
+        if ( (v == NULL) || test_bit(_VCPUF_down, &v->vcpu_flags) )
+            goto getvcpucontext_out;
+
+        ret = -ENOMEM;
+        if ( (c = xmalloc(struct vcpu_guest_context)) == NULL )
+            goto getvcpucontext_out;
+
+        if ( v != current )
+            vcpu_pause(v);
+
+        arch_getdomaininfo_ctxt(v,c);
+        ret = 0;
+
+        if ( v != current )
+            vcpu_unpause(v);
+
+        if ( copy_to_user(op->u.getvcpucontext.ctxt, c, sizeof(*c)) )
+            ret = -EFAULT;
+
+        xfree(c);
 
         if ( copy_to_user(u_dom0_op, op, sizeof(*op)) )     
-            ret = -EINVAL;
-
+            ret = -EFAULT;
+
+    getvcpucontext_out:
+        put_domain(d);
+    }
+    break;
+
+    case DOM0_GETVCPUINFO:
+    { 
+        struct domain *d;
+        struct vcpu   *v;
+
+        ret = -ESRCH;
+        if ( (d = find_domain_by_id(op->u.getvcpuinfo.domain)) == NULL )
+            break;
+
+        ret = -EINVAL;
+        if ( op->u.getvcpuinfo.vcpu >= MAX_VIRT_CPUS )
+            goto getvcpuinfo_out;
+
+        ret = -ESRCH;
+        v = d->vcpu[op->u.getvcpuinfo.vcpu];
+        if ( (v == NULL) || test_bit(_VCPUF_down, &v->vcpu_flags) )
+            goto getvcpuinfo_out;
+
+        op->u.getvcpuinfo.cpu_time = v->cpu_time;
+        op->u.getvcpuinfo.cpu      = v->processor;
+        op->u.getvcpuinfo.cpumap   = v->cpumap;
+        ret = 0;
+
+        if ( copy_to_user(u_dom0_op, op, sizeof(*op)) )     
+            ret = -EFAULT;
+
+    getvcpuinfo_out:
         put_domain(d);
     }
     break;
diff -r 70aa62954e91 -r bd3268de4145 xen/common/keyhandler.c
--- a/xen/common/keyhandler.c   Fri Oct 14 00:42:34 2005
+++ b/xen/common/keyhandler.c   Fri Oct 14 14:40:48 2005
@@ -99,7 +99,7 @@
 static void do_task_queues(unsigned char key)
 {
     struct domain *d;
-    struct vcpu *v;
+    struct vcpu   *v;
     s_time_t       now = NOW();
 
     printk("'%c' pressed -> dumping task queues (now=0x%X:%08X)\n", key,
@@ -112,6 +112,12 @@
         printk("Xen: DOM %u, flags=%lx refcnt=%d nr_pages=%d "
                "xenheap_pages=%d\n", d->domain_id, d->domain_flags,
                atomic_read(&d->refcnt), d->tot_pages, d->xenheap_pages);
+        printk("     handle=%02x%02x%02x%02x-%02x%02x%02x%02x-"
+               "%02x%02x%02x%02x-%02x%02x%02x%02x\n",
+               d->handle[ 0], d->handle[ 1], d->handle[ 2], d->handle[ 3],
+               d->handle[ 4], d->handle[ 5], d->handle[ 6], d->handle[ 7],
+               d->handle[ 8], d->handle[ 9], d->handle[10], d->handle[11],
+               d->handle[12], d->handle[13], d->handle[14], d->handle[15]);
 
         dump_pageframe_info(d);
                
diff -r 70aa62954e91 -r bd3268de4145 xen/include/public/dom0_ops.h
--- a/xen/include/public/dom0_ops.h     Fri Oct 14 00:42:34 2005
+++ b/xen/include/public/dom0_ops.h     Fri Oct 14 14:40:48 2005
@@ -45,6 +45,7 @@
 typedef struct {
     /* IN parameters */
     uint32_t ssidref;
+    xen_domain_handle_t handle;
     /* IN/OUT parameters. */
     /* Identifier for new domain (auto-allocate if zero is specified). */
     domid_t domain;
@@ -88,9 +89,8 @@
     unsigned long shared_info_frame;       /* MFN of shared_info struct */
     uint64_t cpu_time;
     uint32_t n_vcpu;
-    int32_t  vcpu_to_cpu[MAX_VIRT_CPUS];  /* current mapping   */
-    cpumap_t cpumap[MAX_VIRT_CPUS];       /* allowable mapping */
     uint32_t ssidref;
+    xen_domain_handle_t handle;
 } dom0_getdomaininfo_t;
 
 #define DOM0_SETDOMAININFO      13
@@ -180,9 +180,9 @@
 #define DOM0_PINCPUDOMAIN     20
 typedef struct {
     /* IN variables. */
-    domid_t      domain;
-    uint16_t          vcpu;
-    cpumap_t     *cpumap;
+    domid_t   domain;
+    uint16_t  vcpu;
+    cpumap_t cpumap;
 } dom0_pincpudomain_t;
 
 /* Get trace buffers machine base address */
@@ -352,11 +352,23 @@
 
 #define DOM0_GETVCPUCONTEXT      37
 typedef struct {
+    /* IN variables. */
     domid_t  domain;                  /* domain to be affected */
     uint16_t vcpu;                    /* vcpu # */
-    vcpu_guest_context_t *ctxt;       /* NB. IN/OUT variable. */
+    /* OUT variables. */
+    vcpu_guest_context_t *ctxt;
+} dom0_getvcpucontext_t;
+
+#define DOM0_GETVCPUINFO         43
+typedef struct {
+    /* IN variables. */
+    domid_t  domain;                  /* domain to be affected */
+    uint16_t vcpu;                    /* vcpu # */
+    /* OUT variables. */
     uint64_t cpu_time;                 
-} dom0_getvcpucontext_t;
+    uint32_t cpu;                     /* current mapping   */
+    cpumap_t cpumap;                  /* allowable mapping */
+} dom0_getvcpuinfo_t;
 
 #define DOM0_GETDOMAININFOLIST   38
 typedef struct {
@@ -426,10 +438,12 @@
         dom0_microcode_t         microcode;
         dom0_ioport_permission_t ioport_permission;
         dom0_getvcpucontext_t    getvcpucontext;
+        dom0_getvcpuinfo_t       getvcpuinfo;
         dom0_getdomaininfolist_t getdomaininfolist;
         dom0_platform_quirk_t    platform_quirk;
         dom0_physical_memory_map_t physical_memory_map;
         dom0_max_vcpus_t         max_vcpus;
+        uint8_t                  pad[128];
     } u;
 } dom0_op_t;
 
diff -r 70aa62954e91 -r bd3268de4145 xen/include/public/xen.h
--- a/xen/include/public/xen.h  Fri Oct 14 00:42:34 2005
+++ b/xen/include/public/xen.h  Fri Oct 14 14:40:48 2005
@@ -437,6 +437,8 @@
 
 typedef uint64_t cpumap_t;
 
+typedef uint8_t xen_domain_handle_t[16];
+
 #endif /* !__ASSEMBLY__ */
 
 #endif /* __XEN_PUBLIC_XEN_H__ */
diff -r 70aa62954e91 -r bd3268de4145 xen/include/xen/sched.h
--- a/xen/include/xen/sched.h   Fri Oct 14 00:42:34 2005
+++ b/xen/include/xen/sched.h   Fri Oct 14 14:40:48 2005
@@ -139,6 +139,9 @@
     struct arch_domain arch;
 
     void *ssid; /* sHype security subject identifier */
+
+    /* Control-plane tools handle for this domain. */
+    xen_domain_handle_t handle;
 };
 
 struct domain_setup_info

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Store an opaque handle (tools uuid) in the domain structure, Xen patchbot -unstable <=