Skip to contentSkip to conversation

getvcpuinfo additional information

PATCH In review Ben Thomas 2 participants 4 messages Nov 7, 2006 – Nov 8, 2006 Arm/actions semi architecture

lore
Share & tools
lore

Ben Thomas

author
#0 lore raw

PATCH 1/1 getvcpuinfo additional information

On a number of instances, it has proved quite useful to be able to easily examine more of the VCPU state. Specifically, the information contained in the runstate structure. This patch extends the returned information to contain the entire runstate structure. A simple usage example is a dom0 user-mode program that can dump all of the times for each VCPU (eg, running, blocked, runnable).

Signature · 5 lines
------------------------------------------------------------------------
Ben Thomas                                         Virtual Iron Software
[email protected]                            Tower 1, Floor 2
978-849-1214                                       900 Chelmsford Street
                                                   Lowell, MA 01851

# Return more information about the VCPU in the getvcpuinfo call. This is

# pretty useful for debug and investigation.
#
# Signed-off-by: Ben Thomas ([email protected])
tools/libxc/xc_private.c +1 -1
Index: xen-unstable.hg/tools/libxc/xc_private.c
===================================================================
@@ -258,7 +258,7 @@
         PERROR("Could not get info on domain");
         return -1;
     }
-    return domctl.u.getvcpuinfo.cpu_time;
+    return domctl.u.getvcpuinfo.runstate.time[RUNSTATE_running];
 }
 
 
tools/python/xen/lowlevel/xc/xc.c +1 -1
Index: xen-unstable.hg/tools/python/xen/lowlevel/xc/xc.c
===================================================================
@@ -312,7 +312,7 @@
                               "online",   info.online,
                               "blocked",  info.blocked,
                               "running",  info.running,
-                              "cpu_time", info.cpu_time,
+                              "cpu_time", info.runstate.time[RUNSTATE_running],
                               "cpu",      info.cpu);
 
     cpulist = PyList_New(0);
tools/xenstat/libxenstat/src/xenstat.c +1 -1
Index: xen-unstable.hg/tools/xenstat/libxenstat/src/xenstat.c
===================================================================
@@ -550,7 +550,7 @@
 			}
 			else {
 				node->domains[i].vcpus[vcpu].online = info.online;
-				node->domains[i].vcpus[vcpu].ns = info.cpu_time;
+				node->domains[i].vcpus[vcpu].ns = info.runstate.time[RUNSTATE_running];
 			}
 		}
 	}
xen/common/domctl.c +1 -1
Index: xen-unstable.hg/xen/common/domctl.c
===================================================================
@@ -515,7 +515,7 @@
         op->u.getvcpuinfo.online   = !test_bit(_VCPUF_down, &v->vcpu_flags);
         op->u.getvcpuinfo.blocked  = test_bit(_VCPUF_blocked, &v->vcpu_flags);
         op->u.getvcpuinfo.running  = test_bit(_VCPUF_running, &v->vcpu_flags);
-        op->u.getvcpuinfo.cpu_time = runstate.time[RUNSTATE_running];
+        memcpy(&op->u.getvcpuinfo.runstate, &runstate, sizeof(runstate));
         op->u.getvcpuinfo.cpu      = v->processor;
         ret = 0;
 
xen/include/public/domctl.h +2 -1
Index: xen-unstable.hg/xen/include/public/domctl.h
===================================================================
@@ -15,6 +15,7 @@
 #endif
 
 #include "xen.h"
+#include "vcpu.h"
 
 #define XEN_DOMCTL_INTERFACE_VERSION 0x00000004
 
@@ -239,8 +240,8 @@
     uint8_t  online;                  /* currently online (not hotplugged)? */
     uint8_t  blocked;                 /* blocked waiting for an event? */
     uint8_t  running;                 /* currently scheduled on its CPU? */
-    uint64_t cpu_time;                /* total cpu time consumed (ns) */
     uint32_t cpu;                     /* current mapping   */
+    vcpu_runstate_info_t runstate;    /* VCPU runstate info (see vcpu.h) */
 };
 typedef struct xen_domctl_getvcpuinfo xen_domctl_getvcpuinfo_t;
 DEFINE_XEN_GUEST_HANDLE(xen_domctl_getvcpuinfo_t);

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 6 lines · Ben Thomas

On a number of instances, it has proved quite useful to be able to easily examine more of the VCPU state. Specifically, the information contained in the runstate structure. This patch extends the returned information to contain the entire runstate structure. A simple usage example is a dom0 user-mode program that can dump all of the times for each VCPU (eg, running, blocked, runnable).

[snip]

Quoted 13 lines

Index: xen-unstable.hg/xen/include/public/domctl.h
===================================================================

xen/include/public/domctl.h 2006-11-06 17:12:08.000000000 -0500 renamed from xen/include/public/domctl.h 2006-11-06 17:12:03.000000000 -0500 +1 -0
@@ -15,6 +15,7 @@
 #endif
 
 #include "xen.h"
+#include "vcpu.h"
 
 #define XEN_DOMCTL_INTERFACE_VERSION 0x00000004
 

xen/include/public/domctl.h 2006-11-06 17:12:08.000000000 -0500 line 247

Quoted 9 lines
xen/include/public/domctl.h 2006-11-06 17:12:08.000000000 -0500 renamed from xen/include/public/domctl.h 2006-11-06 17:12:03.000000000 -0500 +1 -1
@@ -239,8 +240,8 @@
     uint8_t  online;                  /* currently online (not hotplugged)? */
     uint8_t  blocked;                 /* blocked waiting for an event? */
     uint8_t  running;                 /* currently scheduled on its CPU? */
-    uint64_t cpu_time;                /* total cpu time consumed (ns) */
     uint32_t cpu;                     /* current mapping   */
+    vcpu_runstate_info_t runstate;    /* VCPU runstate info (see vcpu.h) */
 };
 typedef struct xen_domctl_getvcpuinfo xen_domctl_getvcpuinfo_t;
 DEFINE_XEN_GUEST_HANDLE(xen_domctl_getvcpuinfo_t);

While I like the improved information reporting this change gives us, this is breaking the HV <-> Dom0 management API...yet again. At very least the XEN_DOMCTL_INTERFACE_VERSION version should be incremented, but personally I'd like to see API & ABI stability maintained by leaving the existing hypercall alone & adding a new hypercall which deals with extra data.

Regards,
Dan.

Signature · 4 lines
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 
author
#2 lore raw

Hi Dan,

I figured I'd get some comments on this one, so I decided to send it off and see what came back...

A while back, I did ask about how to approach this and got the following response (the author can id themselves if they wish):

"We do not guarantee API or ABI stability on the control-tool interfaces,
so after 3.0.3 has forked we can certainly take patches that extend the VCPU information available to the tools in the cleanest way we can find."

But, times and circumstances change. I find the extra information useful. I'm willing to do a moderate amount of work to contribute the change back in whatever form is deemed most appropriate. So, let's see where this settles out and I'll recast the patch and resubmit (if necessary).

Thanks,
-b

Quoted 44 lines · Daniel P. Berrange
Quoted 6 lines · Ben Thomas

On a number of instances, it has proved quite useful to be able to easily examine more of the VCPU state. Specifically, the information contained in the runstate structure. This patch extends the returned information to contain the entire runstate structure. A simple usage example is a dom0 user-mode program that can dump all of the times for each VCPU (eg, running, blocked, runnable).

[snip]

Quoted 13 lines

Index: xen-unstable.hg/xen/include/public/domctl.h
===================================================================

xen/include/public/domctl.h 2006-11-06 17:12:08.000000000 -0500 renamed from xen/include/public/domctl.h 2006-11-06 17:12:03.000000000 -0500 +1 -0
@@ -15,6 +15,7 @@
 #endif
 
 #include "xen.h"
+#include "vcpu.h"
 
 #define XEN_DOMCTL_INTERFACE_VERSION 0x00000004
 

xen/include/public/domctl.h 2006-11-06 17:12:08.000000000 -0500 line 247

Quoted 9 lines
xen/include/public/domctl.h 2006-11-06 17:12:08.000000000 -0500 renamed from xen/include/public/domctl.h 2006-11-06 17:12:03.000000000 -0500 +1 -1
@@ -239,8 +240,8 @@
    uint8_t  online;                  /* currently online (not hotplugged)? */
    uint8_t  blocked;                 /* blocked waiting for an event? */
    uint8_t  running;                 /* currently scheduled on its CPU? */
-    uint64_t cpu_time;                /* total cpu time consumed (ns) */
    uint32_t cpu;                     /* current mapping   */
+    vcpu_runstate_info_t runstate;    /* VCPU runstate info (see vcpu.h) */
 };
 typedef struct xen_domctl_getvcpuinfo xen_domctl_getvcpuinfo_t;
 DEFINE_XEN_GUEST_HANDLE(xen_domctl_getvcpuinfo_t);

While I like the improved information reporting this change gives us, this is
breaking the HV <-> Dom0 management API...yet again. At very least the XEN_DOMCTL_INTERFACE_VERSION version should be incremented, but personally I'd like to see API & ABI stability maintained by leaving the existing
hypercall alone & adding a new hypercall which deals with extra data.

Regards,
Dan.

Signature · 5 lines
------------------------------------------------------------------------
Ben Thomas                                         Virtual Iron Software
[email protected]                            Tower 1, Floor 2
978-849-1214                                       900 Chelmsford Street
                                                   Lowell, MA 01851
#3 lore raw
Quoted 9 lines · Ben Thomas

I figured I'd get some comments on this one, so I decided to send it off and see what came back...

A while back, I did ask about how to approach this and got the following response (the author can id themselves if they wish):

"We do not guarantee API or ABI stability on the control-tool interfaces,
so after 3.0.3 has forked we can certainly take patches that extend the VCPU information available to the tools in the cleanest way we can find."

That's ok - I understand why XenSource want to reserve the right to change ABI at any time. If its neccessary to do it again here we have ability to add versioning checks in libvirt to deal with it - but if there is a way to maintain compatability without over-complicating the code I think its worth a try.

Quoted 6 lines

But, times and circumstances change. I find the extra information useful. I'm willing to do a moderate amount of work to contribute the change back in whatever form is deemed most appropriate. So, let's see where this settles out and I'll recast the patch and resubmit (if necessary).

Quoted 49 lines
Quoted 48 lines · Daniel P. Berrange
Quoted 6 lines · Ben Thomas

On a number of instances, it has proved quite useful to be able to easily examine more of the VCPU state. Specifically, the information contained in the runstate structure. This patch extends the returned information to contain the entire runstate structure. A simple usage example is a dom0 user-mode program that can dump all of the times for each VCPU (eg, running, blocked, runnable).

[snip]

Quoted 24 lines

Index: xen-unstable.hg/xen/include/public/domctl.h
===================================================================
--- xen-unstable.hg.orig/xen/include/public/domctl.h 2006-11-06
17:12:03.000000000 -0500
+++ xen-unstable.hg/xen/include/public/domctl.h 2006-11-06 17:12:08.000000000 -0500

xen/include/public/domctl.h +2 -1
@@ -15,6 +15,7 @@
 #endif
 
 #include "xen.h"
+#include "vcpu.h"
 
 #define XEN_DOMCTL_INTERFACE_VERSION 0x00000004
 
@@ -239,8 +240,8 @@
   uint8_t  online;                  /* currently online (not 
   hotplugged)? */
   uint8_t  blocked;                 /* blocked waiting for an event? */
   uint8_t  running;                 /* currently scheduled on its CPU? 
   */
-    uint64_t cpu_time;                /* total cpu time consumed (ns) */
   uint32_t cpu;                     /* current mapping   */
+    vcpu_runstate_info_t runstate;    /* VCPU runstate info (see vcpu.h) 
 */
Quoted 3 lines

};
typedef struct xen_domctl_getvcpuinfo xen_domctl_getvcpuinfo_t; DEFINE_XEN_GUEST_HANDLE(xen_domctl_getvcpuinfo_t);

While I like the improved information reporting this change gives us, this is
breaking the HV <-> Dom0 management API...yet again. At very least the XEN_DOMCTL_INTERFACE_VERSION version should be incremented, but personally I'd like to see API & ABI stability maintained by leaving the existing hypercall alone & adding a new hypercall which deals with extra data.

Regards,
Dan.

Signature · 4 lines
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=|