]> git.proxmox.com Git - qemu.git/commitdiff
aio / timers: On timer modification, qemu_notify or aio_notify
authorAlex Bligh <alex@alex.org.uk>
Wed, 21 Aug 2013 15:02:55 +0000 (16:02 +0100)
committerStefan Hajnoczi <stefanha@redhat.com>
Thu, 22 Aug 2013 17:10:28 +0000 (19:10 +0200)
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 <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
include/qemu/timer.h
qemu-timer.c

index cb7321c00389edb0eebd390a8d363ed7231d8d86..3fa9fa72bf7612e1a8e227df192dbba4f0677951 100644 (file)
@@ -135,6 +135,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
index ffdc28a264504d02c6e2443c156cf2cd56d095dc..746ba8b7e1f952d8622a0de8fdff3241400ea811 100644 (file)
@@ -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);
     }
 }