ia64/xen-unstable

changeset 18429:021189f8cd78

Fix for VCPU periodic timer.

Idle vcpu periodic timer is useless. It increased the lapic timer
interrupt number, which decreased the cpu idle residency. This patch
disables idle vcpu periodic timer via keeping v->periodic_period = 0.

The vcpu periodic timer may be expired 50us before expected time
because there is a 50us TIMER_SLOP used for soft timer (xen/common/timer.c,
timer_softirq_action()). This will cause vcpu_periodic_timer_work() be
continuously called tens of times in a single call of
timer_softirq_action() until (now > periodic_next_event). It brings
unnecessary overhead. This patch adds a similar time slop in vcpu
periodic timer to eliminate this overhead.

Signed-off-by: Wei Gang <gang.wei@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Sep 03 11:02:57 2008 +0100 (2008-09-03)
parents 3e72ab517e44
children a4cf79209a28
files xen/arch/x86/domain.c xen/common/schedule.c
line diff
     1.1 --- a/xen/arch/x86/domain.c	Wed Sep 03 10:38:33 2008 +0100
     1.2 +++ b/xen/arch/x86/domain.c	Wed Sep 03 11:02:57 2008 +0100
     1.3 @@ -302,7 +302,8 @@ int vcpu_initialise(struct vcpu *v)
     1.4      else
     1.5      {
     1.6          /* PV guests by default have a 100Hz ticker. */
     1.7 -        v->periodic_period = MILLISECS(10);
     1.8 +        if ( !is_idle_domain(d) )
     1.9 +            v->periodic_period = MILLISECS(10);
    1.10  
    1.11          /* PV guests get an emulated PIT too for video BIOSes to use. */
    1.12          if ( !is_idle_domain(d) && (v->vcpu_id == 0) )
     2.1 --- a/xen/common/schedule.c	Wed Sep 03 10:38:33 2008 +0100
     2.2 +++ b/xen/common/schedule.c	Wed Sep 03 11:02:57 2008 +0100
     2.3 @@ -628,7 +628,9 @@ static void vcpu_periodic_timer_work(str
     2.4          return;
     2.5  
     2.6      periodic_next_event = v->periodic_last_event + v->periodic_period;
     2.7 -    if ( now > periodic_next_event )
     2.8 +
     2.9 +    /* The timer subsystem may call us up to TIME_SLOP ahead of deadline. */
    2.10 +    if ( (now + TIME_SLOP) > periodic_next_event )
    2.11      {
    2.12          send_timer_event(v);
    2.13          v->periodic_last_event = now;