diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2007-12-06 11:56:51 +0000 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2007-12-06 11:56:51 +0000 |
commit | 485efe9630a8ad9a0e52b5f7addf955289bc9949 (patch) | |
tree | 715bc88531972c0ea4f1c8f2178001acecaade7c | |
parent | c8a9164ee55b0fb67dcd1241345c914b1ffb3789 (diff) | |
download | xen-485efe9630a8ad9a0e52b5f7addf955289bc9949.tar.gz xen-485efe9630a8ad9a0e52b5f7addf955289bc9949.tar.bz2 xen-485efe9630a8ad9a0e52b5f7addf955289bc9949.zip |
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>
-rw-r--r-- | xen/arch/x86/hvm/hvm.c | 4 | ||||
-rw-r--r-- | xen/arch/x86/hvm/vpt.c | 13 | ||||
-rw-r--r-- | xen/include/asm-x86/hvm/vpt.h | 1 | ||||
-rw-r--r-- | xen/include/public/hvm/params.h | 12 |
4 files changed, 21 insertions, 9 deletions
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index ec7344b06b..c42ff62aa5 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -1874,9 +1874,7 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE(void) arg) break; case HVM_PARAM_TIMER_MODE: rc = -EINVAL; - if ( (a.value != HVMPTM_delay_for_missed_ticks) && - (a.value != HVMPTM_no_delay_for_missed_ticks) && - (a.value != HVMPTM_no_missed_tick_accounting) ) + if ( a.value > HVMPTM_one_missed_tick_pending ) goto param_fail; break; } diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c index 9f691cae0c..0a780298b8 100644 --- a/xen/arch/x86/hvm/vpt.c +++ b/xen/arch/x86/hvm/vpt.c @@ -57,7 +57,10 @@ static void pt_process_missed_ticks(struct periodic_time *pt) return; missed_ticks = missed_ticks / (s_time_t) pt->period + 1; - pt->pending_intr_nr += missed_ticks; + if ( mode_is(pt->vcpu->domain, no_missed_ticks_pending) ) + pt->do_not_freeze = !pt->pending_intr_nr; + else + pt->pending_intr_nr += missed_ticks; pt->scheduled += missed_ticks * pt->period; } @@ -92,7 +95,8 @@ void pt_save_timer(struct vcpu *v) spin_lock(&v->arch.hvm_vcpu.tm_lock); list_for_each_entry ( pt, head, list ) - stop_timer(&pt->timer); + if ( !pt->do_not_freeze ) + stop_timer(&pt->timer); pt_freeze_time(v); @@ -217,6 +221,8 @@ void pt_intr_post(struct vcpu *v, struct hvm_intack intack) return; } + pt->do_not_freeze = 0; + if ( pt->one_shot ) { pt->enabled = 0; @@ -224,7 +230,7 @@ void pt_intr_post(struct vcpu *v, struct hvm_intack intack) } else { - if ( mode_is(v->domain, no_missed_tick_accounting) ) + if ( mode_is(v->domain, one_missed_tick_pending) ) { pt->last_plt_gtime = hvm_get_guest_time(v); pt->pending_intr_nr = 0; /* 'collapse' all missed ticks */ @@ -290,6 +296,7 @@ void create_periodic_time( pt->enabled = 1; pt->pending_intr_nr = 0; + pt->do_not_freeze = 0; /* Periodic timer must be at least 0.9ms. */ if ( (period < 900000) && !one_shot ) diff --git a/xen/include/asm-x86/hvm/vpt.h b/xen/include/asm-x86/hvm/vpt.h index 4471fd990d..9f69024340 100644 --- a/xen/include/asm-x86/hvm/vpt.h +++ b/xen/include/asm-x86/hvm/vpt.h @@ -74,6 +74,7 @@ struct periodic_time { struct list_head list; char enabled; char one_shot; /* one shot time */ + char do_not_freeze; u8 irq; struct vcpu *vcpu; /* vcpu timer interrupt delivers to */ u32 pending_intr_nr; /* the couner for pending timer interrupts */ diff --git a/xen/include/public/hvm/params.h b/xen/include/public/hvm/params.h index 9fa80d39e7..486499816d 100644 --- a/xen/include/public/hvm/params.h +++ b/xen/include/public/hvm/params.h @@ -67,13 +67,19 @@ * As above, missed interrupts are delivered, but guest time always tracks * wallclock (i.e., real) time while doing so. * no_missed_ticks_pending: - * No more than one missed interrupt is held pending, and guest time always - * tracks wallclock (i.e., real) time. + * No missed interrupts are held pending. Instead, to ensure ticks are + * delivered at some non-zero rate, if we detect missed ticks then the + * internal tick alarm is not disabled if the VCPU is preempted during the + * next tick period. + * one_missed_tick_pending: + * Missed interrupts are collapsed together and delivered as one 'late tick'. + * Guest time always tracks wallclock (i.e., real) time. */ #define HVM_PARAM_TIMER_MODE 10 #define HVMPTM_delay_for_missed_ticks 0 #define HVMPTM_no_delay_for_missed_ticks 1 -#define HVMPTM_no_missed_tick_accounting 2 +#define HVMPTM_no_missed_ticks_pending 2 +#define HVMPTM_one_missed_tick_pending 3 #define HVM_NR_PARAMS 11 |