Received: from eggs.gnu.org ([2001:4830:134:3::10]:52252) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2mu9-0003GC-Uk for qemu-devel@nongnu.org; Fri, 26 Jul 2013 14:38:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V2mu7-0004Cy-IE for qemu-devel@nongnu.org; Fri, 26 Jul 2013 14:38:17 -0400 Received: from mail.avalus.com ([2001:41c8:10:1dd::10]:53997) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2mu7-0004Cp-8u for qemu-devel@nongnu.org; Fri, 26 Jul 2013 14:38:15 -0400 From: Alex Bligh Date: Fri, 26 Jul 2013 19:37:40 +0100 Message-Id: <1374863862-32517-12-git-send-email-alex@alex.org.uk> In-Reply-To: <1374863862-32517-1-git-send-email-alex@alex.org.uk> References: <34B083D4DB6D2988A571E420@nimrod.local> <1374863862-32517-1-git-send-email-alex@alex.org.uk> Subject: [Qemu-devel] [RFC] [PATCHv4 11/13] 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 , Stefan Hajnoczi , Paolo Bonzini , rth@twiddle.net On qemu_mod_timer_ns, ensure qemu_notify or aio_notify is called to end the appropriate poll(). On qemu_clock_enable, ensure qemu_notify or aio_notify is called for all QEMUTimerLists attached to the QEMUClock. Signed-off-by: Alex Bligh --- qemu-timer.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/qemu-timer.c b/qemu-timer.c index 9d992d6..ade1449 100644 --- a/qemu-timer.c +++ b/qemu-timer.c @@ -295,11 +295,29 @@ void qemu_free_timerlist(QEMUTimerList *tl) g_free(tl); } +static void qemu_timerlist_notify(QEMUTimerList *tl) +{ + if (tl->ctx) { + aio_notify(tl->ctx); + } else { + qemu_notify_event(); + } +} + +static void qemu_clock_notify(QEMUClock *clock) +{ + QEMUTimerList *tl; + QLIST_FOREACH(tl, &clock->timerlists, list) { + qemu_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); } } @@ -514,9 +532,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) { - qemu_notify_event(); - } + qemu_timerlist_notify(ts->tl); } } -- 1.7.9.5