From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45597) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V62lI-0006pN-88 for qemu-devel@nongnu.org; Sun, 04 Aug 2013 14:10:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V62lF-00064X-VZ for qemu-devel@nongnu.org; Sun, 04 Aug 2013 14:10:36 -0400 Received: from mail.avalus.com ([2001:41c8:10:1dd::10]:39026) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V62lF-00061x-OX for qemu-devel@nongnu.org; Sun, 04 Aug 2013 14:10:33 -0400 From: Alex Bligh Date: Sun, 4 Aug 2013 19:10:02 +0100 Message-Id: <1375639805-1943-14-git-send-email-alex@alex.org.uk> In-Reply-To: <1375639805-1943-1-git-send-email-alex@alex.org.uk> References: <714109BBB1F743A30290732C@nimrod.local> <1375639805-1943-1-git-send-email-alex@alex.org.uk> Subject: [Qemu-devel] [RFC] [PATCHv5 13/16] aio / timers: On timer modification, qemu_notify or aio_notify List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Anthony Liguori , Alex Bligh , liu ping fan , Stefan Hajnoczi , Paolo Bonzini , MORITA Kazutaka , rth@twiddle.net On qemu_mod_timer_ns, ensure qemu_notify or aio_notify is called to end the appropriate poll(), irrespective of use_icount value. On qemu_clock_enable, ensure qemu_notify or aio_notify is called for all QEMUTimerLists attached to the QEMUClock. Signed-off-by: Alex Bligh --- include/qemu/timer.h | 1 + qemu-timer.c | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/include/qemu/timer.h b/include/qemu/timer.h index 970042d..0a02a17 100644 --- a/include/qemu/timer.h +++ b/include/qemu/timer.h @@ -62,6 +62,7 @@ int64_t qemu_clock_deadline(QEMUClock *clock); int64_t qemu_clock_deadline_ns(QEMUClock *clock); bool qemu_clock_use_for_deadline(QEMUClock *clock); QEMUTimerList *qemu_clock_get_default_timerlist(QEMUClock *clock); +void qemu_clock_notify(QEMUClock *clock); QEMUTimerList *timerlist_new(QEMUClockType type); void timerlist_free(QEMUTimerList *tl); diff --git a/qemu-timer.c b/qemu-timer.c index 4562c70..789bb77 100644 --- a/qemu-timer.c +++ b/qemu-timer.c @@ -304,11 +304,20 @@ bool qemu_clock_use_for_deadline(QEMUClock *clock) return !(use_icount && (clock->type = QEMU_CLOCK_VIRTUAL)); } +void qemu_clock_notify(QEMUClock *clock) +{ + QEMUTimerList *tl; + QLIST_FOREACH(tl, &clock->timerlists, list) { + timerlist_notify(tl); + } +} + void qemu_clock_enable(QEMUClock *clock, bool enabled) { bool old = clock->enabled; clock->enabled = enabled; if (enabled && !old) { + qemu_clock_notify(clock); qemu_rearm_alarm_timer(alarm_timer); } } @@ -529,9 +538,7 @@ void qemu_mod_timer_ns(QEMUTimer *ts, int64_t expire_time) } /* Interrupt execution to force deadline recalculation. */ qemu_clock_warp(ts->tl->clock); - if (use_icount) { - timerlist_notify(ts->tl); - } + timerlist_notify(ts->tl); } } -- 1.7.9.5