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

[Xen-devel] Align periodic vpts to reduce timer interrupts and save power


  • To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: "Wei, Gang" <gang.wei@xxxxxxxxx>
  • Date: Mon, 9 Feb 2009 14:26:47 +0800
  • Accept-language: en-US
  • Acceptlanguage: en-US
  • Cc: "Tian, Kevin" <kevin.tian@xxxxxxxxx>, Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
  • Delivery-date: Sun, 08 Feb 2009 22:27:34 -0800
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>
  • Thread-index: AcmKf2JPODBADOesSEqr2By6cHMitw==
  • Thread-topic: Align periodic vpts to reduce timer interrupts and save power

Hi,

After c/s 18694 changed vHPET to vpt, for single HVM RHEL 5u1 guest idle case, 
our box will consume ~0.8W more power than before. The reason is two periodical 
vpts' expires are hard to be aligned in the 50us soft timer SLOP. So we are 
considering a vpt specific enhancement which could try to just align periodical 
timers within vpt.

A generic enhancement is to add a new interface like align_timer:
(create_periodic_time)
if ( period )
    pt->scheduled = align_timer(NOW() + delta)
...
set_timer(&pt->timer, pt->scheduled);

Then align_timer tries to find another timer closest to expected expiration, 
and return to caller. This new interface only serves periodical timer, and just 
called once at creation. Internal implementation could be more complex in the 
future, e.g. align to timer with same period.

The key point for above changes, is to create more chances for timer alignment 
even when timer slop is small. Large slop can align timers passively, but with 
heavier impact to single shot timer.

Below is a simple align_timer() which aligns to the end of every ms (we can add 
some boot option to control it):
s_time_t align_timer(s_time_t time)
{
    return time | (MILLISECS(1) - 1);
}

Is there any objections, comments or concerns for such a enhancement?

BTW, current vpt code try to handle vLAPIC specially to give vLAPIC ticks a 
offset from other timer ticks like below:
    pt->scheduled = NOW() + delta;
    /*
     * Offset LAPIC ticks from other timer ticks. Otherwise guests which use
     * LAPIC ticks for process accounting can see long sequences of process
     * ticks incorrectly accounted to interrupt processing.
     */
    if ( pt->source == PTSRC_lapic )
        pt->scheduled += delta >> 1;

But I don't think this way can really reach the offset purpose, because the 
additional (delta >> 1) can't prevent other timers created in other time to 
expires right before lapic ticks.

Will it really bring issues if vlapic ticks and vhpet ticks were aligned?

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


 


Rackspace

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