From patchwork Thu Aug 15 20:34:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bligh X-Patchwork-Id: 267457 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 309AE2C0174 for ; Fri, 16 Aug 2013 07:50:30 +1000 (EST) Received: from localhost ([::1]:55369 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VA4LN-0001KQ-M1 for incoming@patchwork.ozlabs.org; Thu, 15 Aug 2013 16:40:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50483) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VA4GB-0002jK-Dt for qemu-devel@nongnu.org; Thu, 15 Aug 2013 16:35:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VA4G4-0001IZ-OI for qemu-devel@nongnu.org; Thu, 15 Aug 2013 16:35:07 -0400 Received: from mail.avalus.com ([2001:41c8:10:1dd::10]:53797) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VA4G4-0001Fs-F4 for qemu-devel@nongnu.org; Thu, 15 Aug 2013 16:35:00 -0400 Received: by mail.avalus.com (Postfix) with ESMTPSA id E1AD5C561BD; Thu, 15 Aug 2013 21:34:59 +0100 (BST) From: Alex Bligh To: qemu-devel@nongnu.org Date: Thu, 15 Aug 2013 21:34:25 +0100 Message-Id: <1376598879-18976-18-git-send-email-alex@alex.org.uk> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1376598879-18976-1-git-send-email-alex@alex.org.uk> References: <1376598879-18976-1-git-send-email-alex@alex.org.uk> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:41c8:10:1dd::10 Cc: Kevin Wolf , Anthony Liguori , Alex Bligh , Jan Kiszka , liu ping fan , Stefan Hajnoczi , Paolo Bonzini , MORITA Kazutaka , rth@twiddle.net Subject: [Qemu-devel] [PATCHv11 17/31] aio / timers: On timer modification, qemu_notify or aio_notify X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 | 9 +++++++++ qemu-timer.c | 13 ++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/include/qemu/timer.h b/include/qemu/timer.h index 843dfe1..619b7a2 100644 --- a/include/qemu/timer.h +++ b/include/qemu/timer.h @@ -136,6 +136,15 @@ bool qemu_clock_use_for_deadline(QEMUClock *clock); QEMUTimerList *qemu_clock_get_main_loop_timerlist(QEMUClock *clock); /** + * qemu_clock_nofify: + * @clock: the clock to operate on + * + * Call the notifier callback connected with the default timer + * list linked to the clock, or qemu_notify() if none. + */ +void qemu_clock_notify(QEMUClock *clock); + +/** * timerlist_new: * @type: the clock type to associate with the timerlist * @cb: the callback to call on notification diff --git a/qemu-timer.c b/qemu-timer.c index c1de3d3..ec25bcc 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 *timer_list; + QLIST_FOREACH(timer_list, &clock->timerlists, list) { + timerlist_notify(timer_list); + } +} + 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); } } @@ -522,9 +531,7 @@ void qemu_mod_timer_ns(QEMUTimer *ts, int64_t expire_time) } /* Interrupt execution to force deadline recalculation. */ qemu_clock_warp(ts->timer_list->clock); - if (use_icount) { - timerlist_notify(ts->timer_list); - } + timerlist_notify(ts->timer_list); } }