Commit 6ad0a1ed authored by Paolo Bonzini's avatar Paolo Bonzini Committed by Anthony Liguori
Browse files

Correct alarm deadline computation

When the QEMU_CLOCK_HOST clock was added, computation of its
deadline was added to qemu_next_deadline, which is correct but

I noticed this by reading the very convoluted rules whereby
qemu_next_deadline_dyntick is computed, which miss QEMU_CLOCK_HOST
when use_icount is true.  This patch inlines qemu_next_deadline
into qemu_next_deadline_dyntick, and then corrects the logic to skip
only QEMU_CLOCK_VIRTUAL when use_icount is true.
Signed-off-by: default avatarPaolo Bonzini <>
Cc: Jan Kiszka <>
Signed-off-by: default avatarAnthony Liguori <>
parent 9c13246a
......@@ -724,11 +724,18 @@ static uint64_t qemu_next_deadline_dyntick(void)
int64_t delta;
int64_t rtdelta;
if (use_icount)
if (!use_icount && active_timers[QEMU_CLOCK_VIRTUAL]) {
delta = active_timers[QEMU_CLOCK_VIRTUAL]->expire_time -
} else {
delta = INT32_MAX;
delta = qemu_next_deadline();
if (active_timers[QEMU_CLOCK_HOST]) {
int64_t hdelta = active_timers[QEMU_CLOCK_HOST]->expire_time -
if (hdelta < delta)
delta = hdelta;
if (active_timers[QEMU_CLOCK_REALTIME]) {
rtdelta = (active_timers[QEMU_CLOCK_REALTIME]->expire_time * 1000000 -
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment