[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC] [PATCHv4 11/13] aio / timers: on timer modification,
From: |
Alex Bligh |
Subject: |
[Qemu-devel] [RFC] [PATCHv4 11/13] aio / timers: on timer modification, qemu_notify or aio_notify |
Date: |
Fri, 26 Jul 2013 19:37:40 +0100 |
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 <address@hidden>
---
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
- [Qemu-devel] [RFC] [PATCHv3 11/12] aio / timers: Remove alarm timers, (continued)
- [Qemu-devel] [RFC] [PATCHv3 11/12] aio / timers: Remove alarm timers, Alex Bligh, 2013/07/25
- Re: [Qemu-devel] [RFC] [PATCHv3 00/12] aio / timers: Add AioContext timers and use ppoll, Alex Bligh, 2013/07/25
- [Qemu-devel] [RFC] [PATCHv4 00/13] aio / timers: Add AioContext timers and use ppoll, Alex Bligh, 2013/07/26
- [Qemu-devel] [RFC] [PATCHv4 03/13] aio / timers: Add prctl(PR_SET_TIMERSLACK, 1, ...) to reduce timer slack, Alex Bligh, 2013/07/26
- [Qemu-devel] [RFC] [PATCHv4 01/13] aio / timers: add qemu-timer.c utility functions, Alex Bligh, 2013/07/26
- [Qemu-devel] [RFC] [PATCHv4 04/13] aio / timers: Make qemu_run_timers and qemu_run_all_timers return progress, Alex Bligh, 2013/07/26
- [Qemu-devel] [RFC] [PATCHv4 02/13] aio / timers: add ppoll support with qemu_poll_ns, Alex Bligh, 2013/07/26
- [Qemu-devel] [RFC] [PATCHv4 06/13] aio / timers: Add a QEMUTimerList to AioContext, Alex Bligh, 2013/07/26
- [Qemu-devel] [RFC] [PATCHv4 08/13] aio / timers: aio_ctx_prepare sets timeout from AioContext timers, Alex Bligh, 2013/07/26
- [Qemu-devel] [RFC] [PATCHv4 07/13] aio / timers: Add an AioContext pointer to QEMUTimerList, Alex Bligh, 2013/07/26
- [Qemu-devel] [RFC] [PATCHv4 11/13] aio / timers: on timer modification, qemu_notify or aio_notify,
Alex Bligh <=
- [Qemu-devel] [RFC] [PATCHv4 09/13] aio / timers: Convert aio_poll to use AioContext timers' deadline, Alex Bligh, 2013/07/26
- [Qemu-devel] [RFC] [PATCHv4 10/13] aio / timers: Convert mainloop to use timeout, Alex Bligh, 2013/07/26
- [Qemu-devel] [RFC] [PATCHv4 05/13] aio / timers: Split QEMUClock into QEMUClock and QEMUTimerList, Alex Bligh, 2013/07/26
- [Qemu-devel] [RFC] [PATCHv4 12/13] aio / timers: Remove alarm timers, Alex Bligh, 2013/07/26
- [Qemu-devel] [RFC] [PATCHv4 13/13] aio / timers: Add test harness for AioContext timers, Alex Bligh, 2013/07/26