diff options
author | Tim Deegan <Tim.Deegan@xensource.com> | 2007-09-24 13:44:29 +0100 |
---|---|---|
committer | Tim Deegan <Tim.Deegan@xensource.com> | 2007-09-24 13:44:29 +0100 |
commit | d0d699be14e590babfd08554fbf6797a3cb53bc6 (patch) | |
tree | a9c8e1f364e8d72060e51eaa1c21960a1bf69402 /xen/arch/x86/hvm/vpt.c | |
parent | 7923ccdaf3e1452317a11b2754f10b74549ded80 (diff) | |
download | xen-d0d699be14e590babfd08554fbf6797a3cb53bc6.tar.gz xen-d0d699be14e590babfd08554fbf6797a3cb53bc6.tar.bz2 xen-d0d699be14e590babfd08554fbf6797a3cb53bc6.zip |
[HVM] Don't count "missed ticks" on one-shot timers.
It's not clear what it would mean, and it leads to division by zero.
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
Diffstat (limited to 'xen/arch/x86/hvm/vpt.c')
-rw-r--r-- | xen/arch/x86/hvm/vpt.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c index 8213005de2..13124f1750 100644 --- a/xen/arch/x86/hvm/vpt.c +++ b/xen/arch/x86/hvm/vpt.c @@ -46,6 +46,9 @@ static void missed_ticks(struct periodic_time *pt) { s_time_t missed_ticks; + if ( unlikely(pt->one_shot) ) + return; + missed_ticks = NOW() - pt->scheduled; if ( missed_ticks <= 0 ) return; @@ -111,12 +114,18 @@ static void pt_timer_fn(void *data) pt_lock(pt); pt->pending_intr_nr++; - pt->scheduled += pt->period; - missed_ticks(pt); - - if ( !pt->one_shot ) + if ( unlikely(pt->one_shot) ) + { + pt->enabled = 0; + list_del(&pt->list); + } + else + { + pt->scheduled += pt->period; + missed_ticks(pt); set_timer(&pt->timer, pt->scheduled); + } vcpu_kick(pt->vcpu); |