[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 25/42] aio / timers: On timer modification, qemu_noti
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 25/42] aio / timers: On timer modification, qemu_notify or aio_notify |
Date: |
Thu, 22 Aug 2013 22:11:21 +0200 |
From: Alex Bligh <address@hidden>
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 <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
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 cb7321c..3fa9fa7 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 ffdc28a..746ba8b 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);
}
}
--
1.8.3.1
- [Qemu-devel] [PULL 15/42] aio / timers: Make qemu_run_timers and qemu_run_all_timers return progress, (continued)
- [Qemu-devel] [PULL 15/42] aio / timers: Make qemu_run_timers and qemu_run_all_timers return progress, Stefan Hajnoczi, 2013/08/22
- [Qemu-devel] [PULL 16/42] aio / timers: Split QEMUClock into QEMUClock and QEMUTimerList, Stefan Hajnoczi, 2013/08/22
- [Qemu-devel] [PULL 17/42] aio / timers: Untangle include files, Stefan Hajnoczi, 2013/08/22
- [Qemu-devel] [PULL 18/42] aio / timers: Add QEMUTimerListGroup and helper functions, Stefan Hajnoczi, 2013/08/22
- [Qemu-devel] [PULL 19/42] aio / timers: Add QEMUTimerListGroup to AioContext, Stefan Hajnoczi, 2013/08/22
- [Qemu-devel] [PULL 20/42] aio / timers: Add a notify callback to QEMUTimerList, Stefan Hajnoczi, 2013/08/22
- [Qemu-devel] [PULL 21/42] aio / timers: aio_ctx_prepare sets timeout from AioContext timers, Stefan Hajnoczi, 2013/08/22
- [Qemu-devel] [PULL 22/42] aio / timers: Add aio_timer_init & aio_timer_new wrappers, Stefan Hajnoczi, 2013/08/22
- [Qemu-devel] [PULL 23/42] aio / timers: Convert aio_poll to use AioContext timers' deadline, Stefan Hajnoczi, 2013/08/22
- [Qemu-devel] [PULL 24/42] aio / timers: Convert mainloop to use timeout, Stefan Hajnoczi, 2013/08/22
- [Qemu-devel] [PULL 25/42] aio / timers: On timer modification, qemu_notify or aio_notify,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 27/42] aio / timers: Use all timerlists in icount warp calculations, Stefan Hajnoczi, 2013/08/22
- [Qemu-devel] [PULL 26/42] aio / timers: Introduce new API timer_new and friends, Stefan Hajnoczi, 2013/08/22
- [Qemu-devel] [PULL 28/42] aio / timers: Add documentation and new format calls, Stefan Hajnoczi, 2013/08/22
- [Qemu-devel] [PULL 36/42] aio / timers: Add test harness for AioContext timers, Stefan Hajnoczi, 2013/08/22
- [Qemu-devel] [PULL 34/42] aio / timers: Convert rtc_clock to be a QEMUClockType, Stefan Hajnoczi, 2013/08/22
- [Qemu-devel] [PULL 37/42] aio / timers: Add scripts/switch-timer-api, Stefan Hajnoczi, 2013/08/22
- [Qemu-devel] [PULL 35/42] aio / timers: convert block_job_sleep_ns and co_sleep_ns to new API, Stefan Hajnoczi, 2013/08/22
- [Qemu-devel] [PULL 42/42] win32-aio: drop win32_aio_flush_cb(), Stefan Hajnoczi, 2013/08/22
- [Qemu-devel] [PULL 41/42] aio-win32: replace incorrect AioHandler->opaque usage with ->e, Stefan Hajnoczi, 2013/08/22
- [Qemu-devel] [PULL 32/42] aio / timers: Rearrange timer.h & make legacy functions call non-legacy, Stefan Hajnoczi, 2013/08/22