From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38674) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2Tr6-0007u0-DY for qemu-devel@nongnu.org; Thu, 25 Jul 2013 18:17:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V2Tr3-0006V6-32 for qemu-devel@nongnu.org; Thu, 25 Jul 2013 18:17:52 -0400 Received: from mail.avalus.com ([2001:41c8:10:1dd::10]:59987) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2Tr2-0006Ug-T6 for qemu-devel@nongnu.org; Thu, 25 Jul 2013 18:17:49 -0400 From: Alex Bligh Date: Thu, 25 Jul 2013 23:16:46 +0100 Message-Id: <1374790608-7518-11-git-send-email-alex@alex.org.uk> In-Reply-To: <1374790608-7518-1-git-send-email-alex@alex.org.uk> References: <20130725093713.GG21033@stefanha-thinkpad.redhat.com> <1374790608-7518-1-git-send-email-alex@alex.org.uk> Subject: [Qemu-devel] [RFC] [PATCHv3 10/12] 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_clock_enable or qemu_mod_timer_ns, ensure qemu_notify or aio_notify is called to end the appropriate poll(). Signed-off-by: Alex Bligh --- qemu-timer.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/qemu-timer.c b/qemu-timer.c index 6efd1b4..a0cbeaa 100644 --- a/qemu-timer.c +++ b/qemu-timer.c @@ -264,11 +264,21 @@ void qemu_clock_set_ctx(QEMUClock *clock, AioContext * ctx) clock->ctx = ctx; } +static void qemu_clock_notify(QEMUClock *clock) +{ + if (clock->ctx) { + aio_notify(clock->ctx); + } else { + qemu_notify_event(); + } +} + 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); } } @@ -436,9 +446,7 @@ void qemu_mod_timer_ns(QEMUTimer *ts, int64_t expire_time) } /* Interrupt execution to force deadline recalculation. */ qemu_clock_warp(ts->clock); - if (use_icount) { - qemu_notify_event(); - } + qemu_clock_notify(ts->clock); } } -- 1.7.9.5