From 33bef0b9948b85000221d32c758d9d4a9276aaaf Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Fri, 3 Mar 2017 11:37:57 +0100 Subject: [PATCH] qemu-timer: fix off-by-one MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the first timer is exactly at the current value of the clock, the deadline is met and the timer should fire. This fixes itself on the next iteration of the loop without icount; with icount, however, execution of instructions will stop exactly at the deadline and won't proceed. Reviewed-by: Alex Bennée Reviewed-by: Edgar E. Iglesias Signed-off-by: Paolo Bonzini --- util/qemu-timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/qemu-timer.c b/util/qemu-timer.c index 6cf70b96f6..2f201512df 100644 --- a/util/qemu-timer.c +++ b/util/qemu-timer.c @@ -199,7 +199,7 @@ bool timerlist_expired(QEMUTimerList *timer_list) expire_time = timer_list->active_timers->expire_time; qemu_mutex_unlock(&timer_list->active_timers_lock); - return expire_time < qemu_clock_get_ns(timer_list->clock->type); + return expire_time <= qemu_clock_get_ns(timer_list->clock->type); } bool qemu_clock_expired(QEMUClockType type) -- GitLab