From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:57899) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFi3S-0003FO-Ga for qemu-devel@nongnu.org; Wed, 13 Mar 2013 05:33:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UFi3N-0005z2-MV for qemu-devel@nongnu.org; Wed, 13 Mar 2013 05:33:02 -0400 Received: from smtp23.cstnet.cn ([2001:cc0:2fff:7::23]:36982 helo=cstnet.cn) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFi3N-0005xU-0e for qemu-devel@nongnu.org; Wed, 13 Mar 2013 05:32:57 -0400 Message-ID: <514047B9.6010400@ict.ac.cn> Date: Wed, 13 Mar 2013 17:32:41 +0800 From: =?UTF-8?B?6Kej5aOB5Lyf?= MIME-Version: 1.0 References: <513EF6A0.4000601@ict.ac.cn> <20130313084540.GB14391@stefanha-thinkpad.muc.redhat.com> In-Reply-To: <20130313084540.GB14391@stefanha-thinkpad.muc.redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] =?utf-8?q?About_the_Thread_model_in_Qemu=E3=80=90_Is?= =?utf-8?q?_it_one_thread_per_vcpu=3F=E3=80=91?= List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: qemu-devel@nongnu.org I read the article again, and I get the answer to my question in that paragraph. Thank you very much. As you've said, TCG's not thread-safe. Is it only the shared data structure(e.g TB) that prevent TCG to be thread-safe? I'm seeking a method to parallize TCG in order to parallize Qemu. And,how do the multi-thread in kvm mode Qemu synchronize to each other? For some threads maybe excute faster or slower than others, how do they synchronize the clock with each other? Using a huge lock or a global clock? I'll be appreciate if you can give me some hints for further exploration. For now, I need a emulator to emulate more cores efficiently.I want to analyze whether Qemu can be faster when it emulate more cores, while parallelism maybe a good choice. puck 于 2013/3/13 16:45, Stefan Hajnoczi 写道: > On Tue, Mar 12, 2013 at 05:34:24PM +0800, 解壁伟 wrote: >> Hi there: >> >> I've read this an article discribe the thread model in Qemu. >> http://blog.vmsplice.net/2011/03/qemu-internals-overall-architecture-and.html >> Is there really one thread per vcpu in qemu? >> >> When I run the qemu using "-smp 16", I can see only two threads using >> "ps -xH". > "Note that TCG is not thread-safe so even under the iothread model it > multiplexes vcpus across a single QEMU thread. Only KVM can take > advantage of per-vcpu threads." > > If you do not have -enable-kvm then you're probably using TCG. > > Stefan >