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] Calculating real cpu usage of Xen domains correctly!

To: Ian Pratt <m+Ian.Pratt@xxxxxxxxxxxx>
Subject: Re: [Xen-devel] Calculating real cpu usage of Xen domains correctly!
From: Anthony Liguori <aliguori@xxxxxxxxxx>
Date: Wed, 23 Feb 2005 21:10:05 -0600
Cc: Jerone Young <jyoung5@xxxxxxxxxx>, xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxxx>, ian.pratt@xxxxxxxxxxxx
Delivery-date: Thu, 24 Feb 2005 03:11:19 +0000
Envelope-to: xen+James.Bulpin@xxxxxxxxxxxx
In-reply-to: <A95E2296287EAD4EB592B5DEEFCE0E9D123A5B@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
List-archive: <http://sourceforge.net/mailarchive/forum.php?forum=xen-devel>
List-help: <mailto:xen-devel-request@lists.sourceforge.net?subject=help>
List-id: List for Xen developers <xen-devel.lists.sourceforge.net>
List-post: <mailto:xen-devel@lists.sourceforge.net>
List-subscribe: <https://lists.sourceforge.net/lists/listinfo/xen-devel>, <mailto:xen-devel-request@lists.sourceforge.net?subject=subscribe>
List-unsubscribe: <https://lists.sourceforge.net/lists/listinfo/xen-devel>, <mailto:xen-devel-request@lists.sourceforge.net?subject=unsubscribe>
Organization: IBM
References: <A95E2296287EAD4EB592B5DEEFCE0E9D123A5B@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-admin@xxxxxxxxxxxxxxxxxxxxx
User-agent: Mozilla Thunderbird 1.0 (X11/20041206)
Ian Pratt wrote:

I would expect it to return the cumulative total CPU time in ns that the
domain has received.
I think what's happening is that cpu_time is being updated even if the domain is blocked. Looking in xen/common/schedule.c:__enter_scheduler(), the update to cpu_time is still being updated even if SCHED_OP(do_block, prev) is invoked. Honestly, I don't understand this code that well but I made the following change:

--- schedule.c~ 2005-02-21 22:19:31.000000000 -0600
+++ schedule.c 2005-02-23 19:44:52.000000000 -0600
@@ -389,13 +389,15 @@
{
/* This check is needed to avoid a race condition. */
if ( event_pending(prev) )
+ {
clear_bit(EDF_BLOCKED, &prev->ed_flags);
- else
+ prev->cpu_time += now - prev->lastschd;
+ } else
SCHED_OP(do_block, prev);
+ } else {
+ prev->cpu_time += now - prev->lastschd;
}

- prev->cpu_time += now - prev->lastschd;
-
/* get policy-specific decision on scheduling... */
next_slice = ops.do_schedule(now);

And cpu_time contained what it should contain. Before, if I ran a simple infinite loop in a domU (while true; do true; done), it would report dom0 and domU both using 99% of the CPU.

Now it shows domU using 99% of the CPU and dom0 using 1%. This is probably the wrong way to fix this problem but hopefully it makes the right solution obvious to someone who knows this code better.

Regards,
Anthony Liguori

Signed-off-by: Anthony Liguori

If it doesn't I'd regard it as a bug.

Seperately, we should make sure we store a total cumulative time that
each CPU has been executing domains (other than idle).

Ian




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-devel

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