diff options
author | Keir Fraser <keir@xensource.com> | 2007-11-02 16:34:54 +0000 |
---|---|---|
committer | Keir Fraser <keir@xensource.com> | 2007-11-02 16:34:54 +0000 |
commit | 24d6517af937196895eec30db6ab8da2bb199542 (patch) | |
tree | 3fb814764c9159cd0da5049a7903dc6a4c3337b6 /xen/arch/x86/hvm/vpt.c | |
parent | 765a702e134153383b7392ce4452a26a987c21ee (diff) | |
download | xen-24d6517af937196895eec30db6ab8da2bb199542.tar.gz xen-24d6517af937196895eec30db6ab8da2bb199542.tar.bz2 xen-24d6517af937196895eec30db6ab8da2bb199542.zip |
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>
Diffstat (limited to 'xen/arch/x86/hvm/vpt.c')
-rw-r--r-- | xen/arch/x86/hvm/vpt.c | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c index 75f64b26b9..49614997df 100644 --- a/xen/arch/x86/hvm/vpt.c +++ b/xen/arch/x86/hvm/vpt.c @@ -49,6 +49,9 @@ static void pt_process_missed_ticks(struct periodic_time *pt) { s_time_t missed_ticks; + if ( mode_is(pt->vcpu->domain, no_missed_tick_accounting) ) + return; + if ( pt->one_shot ) return; @@ -57,16 +60,7 @@ static void pt_process_missed_ticks(struct periodic_time *pt) return; missed_ticks = missed_ticks / (s_time_t) pt->period + 1; - if ( missed_ticks > 1000 ) - { - /* TODO: Adjust guest time together */ - pt->pending_intr_nr++; - } - else - { - pt->pending_intr_nr += missed_ticks; - } - + pt->pending_intr_nr += missed_ticks; pt->scheduled += missed_ticks * pt->period; } @@ -117,15 +111,7 @@ void pt_restore_timer(struct vcpu *v) list_for_each_entry ( pt, head, list ) { - if ( !mode_is(v->domain, no_missed_tick_accounting) ) - { - pt_process_missed_ticks(pt); - } - else if ( (NOW() - pt->scheduled) >= 0 ) - { - pt->pending_intr_nr++; - pt->scheduled = NOW() + pt->period; - } + pt_process_missed_ticks(pt); set_timer(&pt->timer, pt->scheduled); } @@ -140,13 +126,15 @@ static void pt_timer_fn(void *data) pt_lock(pt); - pt->pending_intr_nr++; + if ( mode_is(pt->vcpu->domain, no_missed_tick_accounting) ) + pt->pending_intr_nr = 1; + else + pt->pending_intr_nr++; if ( !pt->one_shot ) { pt->scheduled += pt->period; - if ( !mode_is(pt->vcpu->domain, no_missed_tick_accounting) ) - pt_process_missed_ticks(pt); + pt_process_missed_ticks(pt); set_timer(&pt->timer, pt->scheduled); } |