diff options
author | Keir Fraser <keir@xensource.com> | 2007-11-08 10:33:18 +0000 |
---|---|---|
committer | Keir Fraser <keir@xensource.com> | 2007-11-08 10:33:18 +0000 |
commit | f89c5d1f1c028b6a6006aff1a3809fafe80d0aa1 (patch) | |
tree | 2896cf3395f42fd0f4c9fc64be428044553c7327 /xen/arch/x86/hvm/vpt.c | |
parent | 940897106ab06033f97965a490b46c61b15322b9 (diff) | |
download | xen-f89c5d1f1c028b6a6006aff1a3809fafe80d0aa1.tar.gz xen-f89c5d1f1c028b6a6006aff1a3809fafe80d0aa1.tar.bz2 xen-f89c5d1f1c028b6a6006aff1a3809fafe80d0aa1.zip |
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>
Diffstat (limited to 'xen/arch/x86/hvm/vpt.c')
-rw-r--r-- | xen/arch/x86/hvm/vpt.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c index 7199fdf674..9f691cae0c 100644 --- a/xen/arch/x86/hvm/vpt.c +++ b/xen/arch/x86/hvm/vpt.c @@ -56,17 +56,9 @@ static void pt_process_missed_ticks(struct periodic_time *pt) if ( missed_ticks <= 0 ) return; - if ( mode_is(pt->vcpu->domain, no_missed_tick_accounting) ) - { - pt->pending_intr_nr = 1; - pt->scheduled = now + pt->period; - } - else - { - missed_ticks = missed_ticks / (s_time_t) pt->period + 1; - pt->pending_intr_nr += missed_ticks; - pt->scheduled += missed_ticks * pt->period; - } + missed_ticks = missed_ticks / (s_time_t) pt->period + 1; + pt->pending_intr_nr += missed_ticks; + pt->scheduled += missed_ticks * pt->period; } static void pt_freeze_time(struct vcpu *v) @@ -131,10 +123,7 @@ static void pt_timer_fn(void *data) pt_lock(pt); - if ( mode_is(pt->vcpu->domain, no_missed_tick_accounting) ) - pt->pending_intr_nr = 1; - else - pt->pending_intr_nr++; + pt->pending_intr_nr++; if ( !pt->one_shot ) { @@ -235,11 +224,16 @@ void pt_intr_post(struct vcpu *v, struct hvm_intack intack) } else { - pt->pending_intr_nr--; if ( mode_is(v->domain, no_missed_tick_accounting) ) + { pt->last_plt_gtime = hvm_get_guest_time(v); + pt->pending_intr_nr = 0; /* 'collapse' all missed ticks */ + } else + { pt->last_plt_gtime += pt->period_cycles; + pt->pending_intr_nr--; + } } if ( mode_is(v->domain, delay_for_missed_ticks) && |