Patchwork [2/2] do not issue ioctl from within the io thread

login
register
mail settings
Submitter Glauber Costa
Date Aug. 25, 2009, 10:13 p.m.
Message ID <1251238416-5088-3-git-send-email-glommer@redhat.com>
Download mbox | patch
Permalink /patch/32101/
State Superseded
Headers show

Comments

Glauber Costa - Aug. 25, 2009, 10:13 p.m.
According to Documentation/kvm/api.txt, (and well, to common sense),
we should not be calling vcpu ioctls from within the iothread.
Since vcpu initialization issues a vcpu ioctl, move it a little bit
further in time to prevent it.

Signed-off-by: Glauber Costa <glommer@redhat.com>
---
 vl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Patch

diff --git a/vl.c b/vl.c
index aa5047e..89051b8 100644
--- a/vl.c
+++ b/vl.c
@@ -3675,6 +3675,7 @@  static void *kvm_cpu_thread_fn(void *arg)
 
     block_io_signals();
     qemu_thread_self(env->thread);
+    kvm_init_vcpu(env);
 
     /* signal CPU creation */
     qemu_mutex_lock(&qemu_global_mutex);
@@ -3870,7 +3871,6 @@  static void tcg_init_vcpu(void *_env)
 
 static void kvm_start_vcpu(CPUState *env)
 {
-    kvm_init_vcpu(env);
     env->thread = qemu_mallocz(sizeof(QemuThread));
     env->halt_cond = qemu_mallocz(sizeof(QemuCond));
     qemu_cond_init(env->halt_cond);