kvm_init_vcpu requires global lock held

Since it accesses data protected by the lock.

Signed-off-by: Avi Kivity <avi@redhat.com>
This commit is contained in:
Marcelo Tosatti 2010-03-23 13:37:13 -03:00
parent 204204308b
commit 6164e6d6e8
1 changed files with 1 additions and 1 deletions

2
cpus.c
View File

@ -401,6 +401,7 @@ static void *kvm_cpu_thread_fn(void *arg)
{
CPUState *env = arg;
qemu_mutex_lock(&qemu_global_mutex);
qemu_thread_self(env->thread);
if (kvm_enabled())
kvm_init_vcpu(env);
@ -408,7 +409,6 @@ static void *kvm_cpu_thread_fn(void *arg)
kvm_block_io_signals(env);
/* signal CPU creation */
qemu_mutex_lock(&qemu_global_mutex);
env->created = 1;
qemu_cond_signal(&qemu_cpu_cond);