[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>
This commit is contained in:
Tim Deegan committed 2007-09-24 13:44:29 +01:00
1 parent 7923ccdaf3
commit d0d699be14
1 file changed
+13 -4
+13 -4
View File
@@ -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);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.