ia64/xen-unstable

changeset 16545:0f9b5ab59579

hvm: Split no_missed_tick_accounting into two modes:
* no_missed_ticks_pending ('SYNC')
* one_missed_tick_pending ('MIXED')

This is based on a patch by Dave Winchell <dwinchell@virtualiron.com>

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Dec 06 11:56:51 2007 +0000 (2007-12-06)
parents d7a0a73e5dca
children 3df07c94c9aa
files xen/arch/x86/hvm/hvm.c xen/arch/x86/hvm/vpt.c xen/include/asm-x86/hvm/vpt.h xen/include/public/hvm/params.h
line diff
     1.1 --- a/xen/arch/x86/hvm/hvm.c	Thu Dec 06 11:29:18 2007 +0000
     1.2 +++ b/xen/arch/x86/hvm/hvm.c	Thu Dec 06 11:56:51 2007 +0000
     1.3 @@ -1874,9 +1874,7 @@ long do_hvm_op(unsigned long op, XEN_GUE
     1.4                  break;
     1.5              case HVM_PARAM_TIMER_MODE:
     1.6                  rc = -EINVAL;
     1.7 -                if ( (a.value != HVMPTM_delay_for_missed_ticks) &&
     1.8 -                     (a.value != HVMPTM_no_delay_for_missed_ticks) &&
     1.9 -                     (a.value != HVMPTM_no_missed_tick_accounting) )
    1.10 +                if ( a.value > HVMPTM_one_missed_tick_pending )
    1.11                      goto param_fail;
    1.12                  break;
    1.13              }
     2.1 --- a/xen/arch/x86/hvm/vpt.c	Thu Dec 06 11:29:18 2007 +0000
     2.2 +++ b/xen/arch/x86/hvm/vpt.c	Thu Dec 06 11:56:51 2007 +0000
     2.3 @@ -57,7 +57,10 @@ static void pt_process_missed_ticks(stru
     2.4          return;
     2.5  
     2.6      missed_ticks = missed_ticks / (s_time_t) pt->period + 1;
     2.7 -    pt->pending_intr_nr += missed_ticks;
     2.8 +    if ( mode_is(pt->vcpu->domain, no_missed_ticks_pending) )
     2.9 +        pt->do_not_freeze = !pt->pending_intr_nr;
    2.10 +    else
    2.11 +        pt->pending_intr_nr += missed_ticks;
    2.12      pt->scheduled += missed_ticks * pt->period;
    2.13  }
    2.14  
    2.15 @@ -92,7 +95,8 @@ void pt_save_timer(struct vcpu *v)
    2.16      spin_lock(&v->arch.hvm_vcpu.tm_lock);
    2.17  
    2.18      list_for_each_entry ( pt, head, list )
    2.19 -        stop_timer(&pt->timer);
    2.20 +        if ( !pt->do_not_freeze )
    2.21 +            stop_timer(&pt->timer);
    2.22  
    2.23      pt_freeze_time(v);
    2.24  
    2.25 @@ -217,6 +221,8 @@ void pt_intr_post(struct vcpu *v, struct
    2.26          return;
    2.27      }
    2.28  
    2.29 +    pt->do_not_freeze = 0;
    2.30 +
    2.31      if ( pt->one_shot )
    2.32      {
    2.33          pt->enabled = 0;
    2.34 @@ -224,7 +230,7 @@ void pt_intr_post(struct vcpu *v, struct
    2.35      }
    2.36      else
    2.37      {
    2.38 -        if ( mode_is(v->domain, no_missed_tick_accounting) )
    2.39 +        if ( mode_is(v->domain, one_missed_tick_pending) )
    2.40          {
    2.41              pt->last_plt_gtime = hvm_get_guest_time(v);
    2.42              pt->pending_intr_nr = 0; /* 'collapse' all missed ticks */
    2.43 @@ -290,6 +296,7 @@ void create_periodic_time(
    2.44  
    2.45      pt->enabled = 1;
    2.46      pt->pending_intr_nr = 0;
    2.47 +    pt->do_not_freeze = 0;
    2.48  
    2.49      /* Periodic timer must be at least 0.9ms. */
    2.50      if ( (period < 900000) && !one_shot )
     3.1 --- a/xen/include/asm-x86/hvm/vpt.h	Thu Dec 06 11:29:18 2007 +0000
     3.2 +++ b/xen/include/asm-x86/hvm/vpt.h	Thu Dec 06 11:56:51 2007 +0000
     3.3 @@ -74,6 +74,7 @@ struct periodic_time {
     3.4      struct list_head list;
     3.5      char enabled;
     3.6      char one_shot;              /* one shot time */
     3.7 +    char do_not_freeze;
     3.8      u8 irq;
     3.9      struct vcpu *vcpu;          /* vcpu timer interrupt delivers to */
    3.10      u32 pending_intr_nr;        /* the couner for pending timer interrupts */
     4.1 --- a/xen/include/public/hvm/params.h	Thu Dec 06 11:29:18 2007 +0000
     4.2 +++ b/xen/include/public/hvm/params.h	Thu Dec 06 11:56:51 2007 +0000
     4.3 @@ -67,13 +67,19 @@
     4.4   *   As above, missed interrupts are delivered, but guest time always tracks
     4.5   *   wallclock (i.e., real) time while doing so.
     4.6   *  no_missed_ticks_pending:
     4.7 - *   No more than one missed interrupt is held pending, and guest time always
     4.8 - *   tracks wallclock (i.e., real) time.
     4.9 + *   No missed interrupts are held pending. Instead, to ensure ticks are
    4.10 + *   delivered at some non-zero rate, if we detect missed ticks then the
    4.11 + *   internal tick alarm is not disabled if the VCPU is preempted during the
    4.12 + *   next tick period.
    4.13 + *  one_missed_tick_pending:
    4.14 + *   Missed interrupts are collapsed together and delivered as one 'late tick'.
    4.15 + *   Guest time always tracks wallclock (i.e., real) time.
    4.16   */
    4.17  #define HVM_PARAM_TIMER_MODE   10
    4.18  #define HVMPTM_delay_for_missed_ticks    0
    4.19  #define HVMPTM_no_delay_for_missed_ticks 1
    4.20 -#define HVMPTM_no_missed_tick_accounting 2
    4.21 +#define HVMPTM_no_missed_ticks_pending   2
    4.22 +#define HVMPTM_one_missed_tick_pending   3
    4.23  
    4.24  #define HVM_NR_PARAMS          11
    4.25