Patchwork [13/21] do not use timedwait on qemu_halt_cond

login
register
mail settings
Submitter Paolo Bonzini
Date Feb. 21, 2011, 8:43 a.m.
Message ID <1298277820-8817-14-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/83793/
State New
Headers show

Comments

Paolo Bonzini - Feb. 21, 2011, 8:43 a.m.
The following conditions can cause cpu_has_work(env) to become true:

* env->queued_work_first: run_on_cpu is already kicking the VCPU

* env->stop = 1: pause_all_vcpus is already kicking the VCPU

* env->stopped = 0: resume_all_vcpus is already kicking the VCPU

* vm_running = 1: vm_start is calling resume_all_vcpus

* env->halted = 0: see previous patch

* qemu_cpu_has_work(env): when it becomes true, board code should set
env->halted = 0 too.  cpu_interrupt kicks the VCPU, too.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 cpus.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Patch

diff --git a/cpus.c b/cpus.c
index 670a42d..868857d 100644
--- a/cpus.c
+++ b/cpus.c
@@ -771,7 +771,7 @@  static void qemu_tcg_wait_io_event(void)
     CPUState *env;
 
     while (all_cpu_threads_idle()) {
-        qemu_cond_timedwait(tcg_halt_cond, &qemu_global_mutex, 1000);
+        qemu_cond_wait(tcg_halt_cond, &qemu_global_mutex);
     }
 
     qemu_mutex_unlock(&qemu_global_mutex);
@@ -794,7 +794,7 @@  static void qemu_tcg_wait_io_event(void)
 static void qemu_kvm_wait_io_event(CPUState *env)
 {
     while (cpu_thread_is_idle(env)) {
-        qemu_cond_timedwait(env->halt_cond, &qemu_global_mutex, 1000);
+        qemu_cond_wait(env->halt_cond, &qemu_global_mutex);
     }
 
     qemu_kvm_eat_signals(env);