ia64/xen-unstable

changeset 16312:838e77a41a3c

hvm: Timer fixes:
1. Do not record more than one pending interrupt in
no-missed-tick-accounting mode. We do not stack up missed interrupts
in this timer mode.
2. Always record all missed ticks when we are in a
missed-tick-accounting mode. Do not have a ceiling for this as it
simply causes guests to lose track of wall time.
3. General bits of cleanup and simplification.
From: Dave Winchell <dwinchell@virtualiron.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author Keir Fraser <keir@xensource.com>
date Fri Nov 02 16:34:54 2007 +0000 (2007-11-02)
parents e11b24680480
children 650cadd1b283
files xen/arch/x86/hvm/vpt.c
line diff
     1.1 --- a/xen/arch/x86/hvm/vpt.c	Fri Nov 02 16:06:06 2007 +0000
     1.2 +++ b/xen/arch/x86/hvm/vpt.c	Fri Nov 02 16:34:54 2007 +0000
     1.3 @@ -49,6 +49,9 @@ static void pt_process_missed_ticks(stru
     1.4  {
     1.5      s_time_t missed_ticks;
     1.6  
     1.7 +    if ( mode_is(pt->vcpu->domain, no_missed_tick_accounting) )
     1.8 +        return;
     1.9 +
    1.10      if ( pt->one_shot )
    1.11          return;
    1.12  
    1.13 @@ -57,16 +60,7 @@ static void pt_process_missed_ticks(stru
    1.14          return;
    1.15  
    1.16      missed_ticks = missed_ticks / (s_time_t) pt->period + 1;
    1.17 -    if ( missed_ticks > 1000 )
    1.18 -    {
    1.19 -        /* TODO: Adjust guest time together */
    1.20 -        pt->pending_intr_nr++;
    1.21 -    }
    1.22 -    else
    1.23 -    {
    1.24 -        pt->pending_intr_nr += missed_ticks;
    1.25 -    }
    1.26 -
    1.27 +    pt->pending_intr_nr += missed_ticks;
    1.28      pt->scheduled += missed_ticks * pt->period;
    1.29  }
    1.30  
    1.31 @@ -117,15 +111,7 @@ void pt_restore_timer(struct vcpu *v)
    1.32  
    1.33      list_for_each_entry ( pt, head, list )
    1.34      {
    1.35 -        if ( !mode_is(v->domain, no_missed_tick_accounting) )
    1.36 -        {
    1.37 -            pt_process_missed_ticks(pt);
    1.38 -        }
    1.39 -        else if ( (NOW() - pt->scheduled) >= 0 )
    1.40 -        {
    1.41 -            pt->pending_intr_nr++;
    1.42 -            pt->scheduled = NOW() + pt->period;
    1.43 -        }
    1.44 +        pt_process_missed_ticks(pt);
    1.45          set_timer(&pt->timer, pt->scheduled);
    1.46      }
    1.47  
    1.48 @@ -140,13 +126,15 @@ static void pt_timer_fn(void *data)
    1.49  
    1.50      pt_lock(pt);
    1.51  
    1.52 -    pt->pending_intr_nr++;
    1.53 +    if ( mode_is(pt->vcpu->domain, no_missed_tick_accounting) )
    1.54 +        pt->pending_intr_nr = 1;
    1.55 +    else
    1.56 +        pt->pending_intr_nr++;
    1.57  
    1.58      if ( !pt->one_shot )
    1.59      {
    1.60          pt->scheduled += pt->period;
    1.61 -        if ( !mode_is(pt->vcpu->domain, no_missed_tick_accounting) )
    1.62 -            pt_process_missed_ticks(pt);
    1.63 +        pt_process_missed_ticks(pt);
    1.64          set_timer(&pt->timer, pt->scheduled);
    1.65      }
    1.66