aboutsummaryrefslogtreecommitdiff
path: root/qemu-common.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-common.h
parent3b2319a30b5ae528787bf3769b1a28a863b53252 (diff)
downloadqemu-ab33fcda9f96b9195dfb3fcf5bd9bb5383caeaea.zip
qemu-ab33fcda9f96b9195dfb3fcf5bd9bb5383caeaea.tar.gz
qemu-ab33fcda9f96b9195dfb3fcf5bd9bb5383caeaea.tar.bz2
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-common.h')
-rw-r--r--qemu-common.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/qemu-common.h b/qemu-common.h
index 82e27c1..4f6037b 100644
--- a/qemu-common.h
+++ b/qemu-common.h
@@ -298,6 +298,7 @@ void qemu_notify_event(void);
void qemu_cpu_kick(void *env);
void qemu_cpu_kick_self(void);
int qemu_cpu_is_self(void *env);
+bool all_cpu_threads_idle(void);
/* work queue */
struct qemu_work_item {