From: Keir Fraser Date: Fri, 2 Nov 2007 16:34:54 +0000 (+0000) Subject: hvm: Timer fixes: X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14814 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=24d6517af937196895eec30db6ab8da2bb199542;p=xen.git 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 Signed-off-by: Keir Fraser --- 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); }