diff options
author | Stefano Stabellini <stefano.stabellini@eu.citrix.com> | 2012-05-29 03:35:24 +0000 |
---|---|---|
committer | Michael Roth <mdroth@linux.vnet.ibm.com> | 2012-09-05 10:30:38 -0500 |
commit | 28846ad3b556458674f03323cac3144dcc3cd5e2 (patch) | |
tree | 9127c38365d5a1d015a3860733434cb97a0cb8ae | |
parent | cccb5446a6d1083b51d851ef5a4f1acff9173127 (diff) |
qemu_rearm_alarm_timer: do not call rearm if the next deadline is INT64_MAX
qemu_rearm_alarm_timer partially duplicates the code in
qemu_next_alarm_deadline to figure out if it needs to rearm the timer.
If it calls qemu_next_alarm_deadline, it always rearms the timer even if
the next deadline is INT64_MAX.
This patch simplifies the behavior of qemu_rearm_alarm_timer and removes
the duplicated code, always calling qemu_next_alarm_deadline and only
rearming the timer if the deadline is less than INT64_MAX.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Tested-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
(cherry picked from commit 8227421e0476d9caf2a9a089465bb40c23834e33)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
-rw-r--r-- | qemu-timer.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/qemu-timer.c b/qemu-timer.c index de9897788..d37a97839 100644 --- a/qemu-timer.c +++ b/qemu-timer.c @@ -112,14 +112,10 @@ static int64_t qemu_next_alarm_deadline(void) static void qemu_rearm_alarm_timer(struct qemu_alarm_timer *t) { - int64_t nearest_delta_ns; - if (!rt_clock->active_timers && - !vm_clock->active_timers && - !host_clock->active_timers) { - return; + int64_t nearest_delta_ns = qemu_next_alarm_deadline(); + if (nearest_delta_ns < INT64_MAX) { + t->rearm(t, nearest_delta_ns); } - nearest_delta_ns = qemu_next_alarm_deadline(); - t->rearm(t, nearest_delta_ns); } /* TODO: MIN_TIMER_REARM_NS should be optimized */ |