提交 28846ad3 编写于 作者: S Stefano Stabellini 提交者: Michael Roth

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: NStefano Stabellini <stefano.stabellini@eu.citrix.com>
Reviewed-by: NStefan Weil <sw@weilnetz.de>
Tested-by: NAndreas Färber <andreas.faerber@web.de>
Signed-off-by: NBlue Swirl <blauwirbel@gmail.com>
(cherry picked from commit 8227421e)
Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
上级 cccb5446
...@@ -112,14 +112,10 @@ static int64_t qemu_next_alarm_deadline(void) ...@@ -112,14 +112,10 @@ static int64_t qemu_next_alarm_deadline(void)
static void qemu_rearm_alarm_timer(struct qemu_alarm_timer *t) static void qemu_rearm_alarm_timer(struct qemu_alarm_timer *t)
{ {
int64_t nearest_delta_ns; int64_t nearest_delta_ns = qemu_next_alarm_deadline();
if (!rt_clock->active_timers && if (nearest_delta_ns < INT64_MAX) {
!vm_clock->active_timers && t->rearm(t, nearest_delta_ns);
!host_clock->active_timers) {
return;
} }
nearest_delta_ns = qemu_next_alarm_deadline();
t->rearm(t, nearest_delta_ns);
} }
/* TODO: MIN_TIMER_REARM_NS should be optimized */ /* TODO: MIN_TIMER_REARM_NS should be optimized */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册