[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Calculating real cpu usage of Xen domains correctly!


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxxx
  • From: Stephan Diestelhorst <sd386@xxxxxxxxx>
  • Date: Fri, 25 Feb 2005 10:31:32 +0000
  • Delivery-date: Sat, 26 Feb 2005 17:57:40 +0000
  • List-id: List for Xen developers <xen-devel.lists.sourceforge.net>

> 1. The guest OS calls HYPERVISOR_block() (thus setting the BLOCKED flag)
> whenever it wants to yield the processor because it's waiting for an
> event.
> 2. This blocking can happen anytime -- including after the guest OS has
> been running for quite some time.
Both correct!
> 3. All the "event_pending(prev)" check in __enter_scheduler() is for is to
> say "whoops, an event arrived in the time between when the guest OS
> blocked & right now, so I should clear the BLOCKED flag." 
This is true as well!
> This is so the 
> domain can be rescheduled at the scheduler's earliest discretion (possibly
> immediately).
There is a subtle point here: When we do that check, the domain is actually 
still running! It will get (probably) descheduled in the "do_schedule" 
function of the scheduler which is invoked by ops.do_schedule a few lines 
later in this function. 

> If these are true, then the original code was correct -- "prev->cpu_time"
> should be updated during any call to the __enter_scheduler() function,
> regardless of the state of the BLOCKED flag.
Thats what I think too. Because the domain stays scheduled regardless what is 
happening till the call of do_schedule, and should get the time accounted!

> Which makes me wonder if something is seriously misbehaving to cause the
> weird CPU usage totals you're seeing -- like a yield()ed or block()ed
> domain improperly getting rescheduled immediately, or an improper
> modification of the prev->lastschd counter, or the "if (prev == next)"
> optimization [later in __enter_scheduler()] leaves out some crucial
> accounting, or...?
Indeed, those weird results should never occur. I.e. the sum of the relative 
usage of domains on one cpu (you are not having those two domains spread on 
two CPUs, are you?) should be <=100%.
So what I mean by that is:
delta(cpu_time_0 )/delta(real_time) + ... + delta(cpu_time_n) / 
delta(real_time) <= 100%
Assuming that all measurements of delta(cpu_time_i) take place at the same 
points in time t1, t2.

BTW: Which scheduler are you using?

Cheers,
  Stephan


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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.