Received: from eggs.gnu.org ([2001:4830:134:3::10]:36733) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnp9i-0003XY-RR for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cnp9h-0006fm-FN for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:38 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:36136) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cnp9h-0006es-84 for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:37 -0400 Received: by mail-wm0-x243.google.com with SMTP id v190so583324wme.3 for ; Tue, 14 Mar 2017 09:18:37 -0700 (PDT) Received: from 640k.lan (94-39-132-181.adsl-ull.clienti.tiscali.it. [94.39.132.181]) by smtp.gmail.com with ESMTPSA id k195sm408197wmd.7.2017.03.14.09.18.35 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Mar 2017 09:18:35 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Tue, 14 Mar 2017 17:18:14 +0100 Message-Id: <1489508300-48184-13-git-send-email-pbonzini@redhat.com> In-Reply-To: <1489508300-48184-1-git-send-email-pbonzini@redhat.com> References: <1489508300-48184-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PULL 12/18] qemu-timer: fix off-by-one List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 6cf70b9..2f20151 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) -- 1.8.3.1