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-devel

Re: [Xen-devel] CPU Utilization

To: Anthony Liguori <aliguori@xxxxxxxxxx>
Subject: Re: [Xen-devel] CPU Utilization
From: Rik van Riel <riel@xxxxxxxxxx>
Date: Tue, 13 Dec 2005 08:41:27 -0500 (EST)
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx, "Dave Thompson \(davetho\)" <davetho@xxxxxxxxx>, Rob Gardner <rob.gardner@xxxxxx>
Delivery-date: Tue, 13 Dec 2005 13:43:06 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <439E0144.6020107@xxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <5440A5A36B8CED4B9F54524343CB6B68FD133F@xxxxxxxxxxxxxxxxxxxxxxxxxx> <439E0144.6020107@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Mon, 12 Dec 2005, Anthony Liguori wrote:

> top isn't smart enough to realize that for a portion of the running 
> time, a domain has been pre-empted out and is not running.
> 
> top will then charge whatever was running at pre-emption time for the 
> time that other domain running.

Actually, the kernel does this charging of time to the wrong
entity.  I am working on a patch to account the preempted time
as "cpu steal" time (like s390 Linux does).

Here is the (really simple) hypervisor bit of the patch. The
kernel bits need some more work ;)


Index: xen-3.0/xen/common/domain.c
===================================================================
--- xen-3.0.orig/xen/common/domain.c
+++ xen-3.0/xen/common/domain.c
@@ -431,8 +431,25 @@ long do_vcpu_op(int cmd, int vcpuid, voi
     case VCPUOP_is_up:
         rc = !test_bit(_VCPUF_down, &v->vcpu_flags);
         break;
+
+    case VCPUOP_cpu_time:
+       {
+           dom0_getvcpuinfo_t vi;
+           vi.online = !test_bit(_VCPUF_down, &v->vcpu_flags);
+           vi.blocked = test_bit(_VCPUF_blocked, &v->vcpu_flags);
+           vi.running  = test_bit(_VCPUF_running, &v->vcpu_flags);
+           vi.cpu_time = v->cpu_time;
+           vi.cpu = v->processor;
+           vi.cpumap = v->cpumap;
+           rc = 0;
+
+           if ( copy_to_user(arg, &vi, sizeof(dom0_getvcpuinfo_t)) )
+               rc = -EFAULT;
+           break;
+       }
     }
 
+
     return rc;
 }
 
Index: xen-3.0/xen/include/public/vcpu.h
===================================================================
--- xen-3.0.orig/xen/include/public/vcpu.h
+++ xen-3.0/xen/include/public/vcpu.h
@@ -51,6 +51,14 @@
 /* Returns 1 if the given VCPU is up. */
 #define VCPUOP_is_up                3
 
+/*
+ * Get information on how much CPU time this VCPU has used, etc...
+ *
+ * @extra_arg == pointer to an empty dom0_getvcpuinfo_t, the "OUT" variables
+ *               of which filled in with scheduler info.
+ */
+#define VCPUOP_cpu_time             4
+
 #endif /* __XEN_PUBLIC_VCPU_H__ */
 
 /*

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

<Prev in Thread] Current Thread [Next in Thread>