[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC] [PATCHv7 16/22] aio / timers: On timer modification,
From: |
Alex Bligh |
Subject: |
[Qemu-devel] [RFC] [PATCHv7 16/22] aio / timers: On timer modification, qemu_notify or aio_notify |
Date: |
Wed, 7 Aug 2013 00:49:10 +0100 |
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>
---
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 a866812..ddcd05a 100644
--- a/include/qemu/timer.h
+++ b/include/qemu/timer.h
@@ -140,6 +140,15 @@ bool qemu_clock_use_for_deadline(QEMUClock *clock);
QEMUTimerList *qemu_clock_get_default_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
*
diff --git a/qemu-timer.c b/qemu-timer.c
index 59abffc..bb45834 100644
--- a/qemu-timer.c
+++ b/qemu-timer.c
@@ -313,11 +313,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);
}
}
@@ -541,9 +550,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.7.9.5
- [Qemu-devel] [RFC] [PATCHv7 06/22] aio / timers: Make qemu_run_timers and qemu_run_all_timers return progress, (continued)
- [Qemu-devel] [RFC] [PATCHv7 06/22] aio / timers: Make qemu_run_timers and qemu_run_all_timers return progress, Alex Bligh, 2013/08/06
- [Qemu-devel] [RFC] [PATCHv7 09/22] aio / timers: Add QEMUTimerListGroup and helper functions, Alex Bligh, 2013/08/06
- [Qemu-devel] [RFC] [PATCHv7 10/22] aio / timers: Add QEMUTimerListGroup to AioContext, Alex Bligh, 2013/08/06
- [Qemu-devel] [RFC] [PATCHv7 08/22] aio / timers: Untangle include files, Alex Bligh, 2013/08/06
- [Qemu-devel] [RFC] [PATCHv7 12/22] aio / timers: aio_ctx_prepare sets timeout from AioContext timers, Alex Bligh, 2013/08/06
- [Qemu-devel] [RFC] [PATCHv7 11/22] aio / timers: Add a notify callback to QEMUTimerList, Alex Bligh, 2013/08/06
- [Qemu-devel] [RFC] [PATCHv7 07/22] aio / timers: Split QEMUClock into QEMUClock and QEMUTimerList, Alex Bligh, 2013/08/06
- [Qemu-devel] [RFC] [PATCHv7 13/22] aio / timers: Add aio_timer_new wrapper, Alex Bligh, 2013/08/06
- [Qemu-devel] [RFC] [PATCHv7 14/22] aio / timers: Convert aio_poll to use AioContext timers' deadline, Alex Bligh, 2013/08/06
- [Qemu-devel] [RFC] [PATCHv7 16/22] aio / timers: On timer modification, qemu_notify or aio_notify,
Alex Bligh <=
- [Qemu-devel] [RFC] [PATCHv7 15/22] aio / timers: Convert mainloop to use timeout, Alex Bligh, 2013/08/06
- [Qemu-devel] [RFC] [PATCHv7 17/22] aio / timers: Introduce new API qemu_timer_new and friends, Alex Bligh, 2013/08/06
- [Qemu-devel] [RFC] [PATCHv7 18/22] aio / timers: Use all timerlists in icount warp calculations, Alex Bligh, 2013/08/06
- [Qemu-devel] [RFC] [PATCHv7 19/22] aio / timers: Add documentation and new format calls, Alex Bligh, 2013/08/06
- [Qemu-devel] [RFC] [PATCHv7 22/22] aio / timers: Remove legacy qemu_clock_deadline & qemu_timerlist_deadline, Alex Bligh, 2013/08/06
- [Qemu-devel] [RFC] [PATCHv7 21/22] aio / timers: Add test harness for AioContext timers, Alex Bligh, 2013/08/06
- [Qemu-devel] [RFC] [PATCHv7 20/22] aio / timers: Remove alarm timers, Alex Bligh, 2013/08/06
- Re: [Qemu-devel] [RFC] [PATCHv7 00/22] aio / timers: Add AioContext timers and use ppoll, Alex Bligh, 2013/08/08