From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: [patch 4/6] kvm_init_vcpu requires global lock held Date: Tue, 23 Mar 2010 13:37:13 -0300 Message-ID: <20100323163812.607279544@redhat.com> References: <20100323163709.033115262@redhat.com> To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:54702 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755112Ab0CWQmL (ORCPT ); Tue, 23 Mar 2010 12:42:11 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o2NGgBTA018350 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 23 Mar 2010 12:42:11 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o2NGgBZN015528 for ; Tue, 23 Mar 2010 12:42:11 -0400 Received: from amt.cnet (vpn-10-84.rdu.redhat.com [10.11.10.84]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o2NGg8D2031018 for ; Tue, 23 Mar 2010 12:42:09 -0400 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id AF84C65208A for ; Tue, 23 Mar 2010 13:40:05 -0300 (BRT) Content-Disposition: inline; filename=init-vcpu-inside-lock Sender: kvm-owner@vger.kernel.org List-ID: Since it accesses data protected by the lock. Index: qemu-uq/vl.c =================================================================== --- qemu-uq.orig/vl.c +++ qemu-uq/vl.c @@ -2447,6 +2447,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); @@ -2454,7 +2455,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);