ia64/xen-unstable

changeset 16356:8ff5bb70136d

x86, hvm: Clean up periodic timer code a little. This leads naturally
to a no-missed-tick-accounting mode which is a combination of ticks
delivered 'off beat' immediately upon re-scheduling when ticks are
missed, then reverting to delivering ticks 'on beat' as usual.
Signed-off-by: Keir Fraser <keir@xensource.com>
author Keir Fraser <keir@xensource.com>
date Thu Nov 08 10:33:18 2007 +0000 (2007-11-08)
parents 6d7ea0cf6e5b
children cb6675149af8
files xen/arch/x86/hvm/vpt.c
line diff
     1.1 --- a/xen/arch/x86/hvm/vpt.c	Thu Nov 08 10:23:22 2007 +0000
     1.2 +++ b/xen/arch/x86/hvm/vpt.c	Thu Nov 08 10:33:18 2007 +0000
     1.3 @@ -56,17 +56,9 @@ static void pt_process_missed_ticks(stru
     1.4      if ( missed_ticks <= 0 )
     1.5          return;
     1.6  
     1.7 -    if ( mode_is(pt->vcpu->domain, no_missed_tick_accounting) )
     1.8 -    {
     1.9 -        pt->pending_intr_nr = 1;
    1.10 -        pt->scheduled = now + pt->period;
    1.11 -    }
    1.12 -    else
    1.13 -    {
    1.14 -        missed_ticks = missed_ticks / (s_time_t) pt->period + 1;
    1.15 -        pt->pending_intr_nr += missed_ticks;
    1.16 -        pt->scheduled += missed_ticks * pt->period;
    1.17 -    }
    1.18 +    missed_ticks = missed_ticks / (s_time_t) pt->period + 1;
    1.19 +    pt->pending_intr_nr += missed_ticks;
    1.20 +    pt->scheduled += missed_ticks * pt->period;
    1.21  }
    1.22  
    1.23  static void pt_freeze_time(struct vcpu *v)
    1.24 @@ -131,10 +123,7 @@ static void pt_timer_fn(void *data)
    1.25  
    1.26      pt_lock(pt);
    1.27  
    1.28 -    if ( mode_is(pt->vcpu->domain, no_missed_tick_accounting) )
    1.29 -        pt->pending_intr_nr = 1;
    1.30 -    else
    1.31 -        pt->pending_intr_nr++;
    1.32 +    pt->pending_intr_nr++;
    1.33  
    1.34      if ( !pt->one_shot )
    1.35      {
    1.36 @@ -235,11 +224,16 @@ void pt_intr_post(struct vcpu *v, struct
    1.37      }
    1.38      else
    1.39      {
    1.40 -        pt->pending_intr_nr--;
    1.41          if ( mode_is(v->domain, no_missed_tick_accounting) )
    1.42 +        {
    1.43              pt->last_plt_gtime = hvm_get_guest_time(v);
    1.44 +            pt->pending_intr_nr = 0; /* 'collapse' all missed ticks */
    1.45 +        }
    1.46          else
    1.47 +        {
    1.48              pt->last_plt_gtime += pt->period_cycles;
    1.49 +            pt->pending_intr_nr--;
    1.50 +        }
    1.51      }
    1.52  
    1.53      if ( mode_is(v->domain, delay_for_missed_ticks) &&