From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O73GY-0008E3-Ds for qemu-devel@nongnu.org; Wed, 28 Apr 2010 05:09:10 -0400 Received: from [140.186.70.92] (port=60046 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O73GW-0008Dv-4u for qemu-devel@nongnu.org; Wed, 28 Apr 2010 05:09:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O73GU-0006Bz-I0 for qemu-devel@nongnu.org; Wed, 28 Apr 2010 05:09:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53452) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O73GU-0006Bf-Ah for qemu-devel@nongnu.org; Wed, 28 Apr 2010 05:09:06 -0400 Message-ID: <4BD7FAF2.1000900@redhat.com> Date: Wed, 28 Apr 2010 11:08:02 +0200 From: Kevin Wolf MIME-Version: 1.0 Subject: Re: [Qemu-devel] thread synchronization in qcow2.c and qcow2-cluster.c References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Chunqiang (CQ) Tang" Cc: Stefan Hajnoczi , qemu-devel@nongnu.org, Avi Kivity Am 27.04.2010 22:39, schrieb Chunqiang (CQ) Tang: >> kvm-all.c:kvm_cpu_exec: >> qemu_mutex_unlock_iothread(); >> ret = kvm_vcpu_ioctl(env, KVM_RUN, 0); >> qemu_mutex_lock_iothread(); > > Thank you for the information. I also suspected that > qemu_mutex_lock_iothread() does the synchronization. However, my > profiling showed that qemu-kvm.c:kvm_cpu_exec() in is actually > executed, instead of kvm-all.c:kvm_cpu_exec(). Also I previously > profiled all executions of qemu_mutex_lock_iothread(), and found that > it only protects the vl.c:main_loop_wai() thread but does NOT protect > the qemu-kvm.c:kvm_cpu_exec() thread. Did I miss something or is this > a defect? I did extensive profiling but still don't know the source > code well enough to confidently draw a conclusion. That code path exists only in qemu-kvm, but yes, looks wrong to me. The block drivers are definitely not prepared to run in parallel in multiple threads. Avi, something missing there in qemu-kvm? Kevin