aboutsummaryrefslogtreecommitdiff
path: root/qemu-timer.h
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2011-04-13 10:03:44 +0200
committerEdgar E. Iglesias <edgar.iglesias@gmail.com>2011-04-15 09:27:56 +0200
commitab33fcda9f96b9195dfb3fcf5bd9bb5383caeaea (patch)
tree97a1a32a03b69a15fb4f23f7a5eb5e880d036980 /qemu-timer.h
parent3b2319a30b5ae528787bf3769b1a28a863b53252 (diff)
enable vm_clock to "warp" in the iothread+icount case
The previous patch however is not enough, because if the virtual CPU goes to sleep waiting for a future timer interrupt to wake it up, qemu deadlocks. The timer interrupt never comes because time is driven by icount, but the vCPU doesn't run any insns. You could say that VCPUs should never go to sleep in icount mode if there is a pending vm_clock timer; rather time should just warp to the next vm_clock event with no sleep ever taking place. Even better, you can sleep for some time related to the time left until the next event, to avoid that the warps are too visible externally; for example, you could be sending network packets continously instead of every 100ms. This is what this patch implements. qemu_clock_warp is called: 1) whenever a vm_clock timer is adjusted, to ensure the warp_timer is synchronized; 2) at strategic points in the CPU thread, to make sure the insn counter is synchronized before the CPU starts running. In any case, the warp_timer is disabled while the CPU is running, because the insn counter will then be making progress on its own. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Tested-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Diffstat (limited to 'qemu-timer.h')
-rw-r--r--qemu-timer.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/qemu-timer.h b/qemu-timer.h
index 75d567578b..c01bcaba66 100644
--- a/qemu-timer.h
+++ b/qemu-timer.h
@@ -39,6 +39,7 @@ extern QEMUClock *host_clock;
int64_t qemu_get_clock_ns(QEMUClock *clock);
void qemu_clock_enable(QEMUClock *clock, int enabled);
+void qemu_clock_warp(QEMUClock *clock);
QEMUTimer *qemu_new_timer(QEMUClock *clock, int scale,
QEMUTimerCB *cb, void *opaque);