From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:39401) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QvXD2-0000wA-Bo for qemu-devel@nongnu.org; Mon, 22 Aug 2011 12:18:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QvXD1-0008H0-59 for qemu-devel@nongnu.org; Mon, 22 Aug 2011 12:18:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50968) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QvXD0-0008Gu-Q0 for qemu-devel@nongnu.org; Mon, 22 Aug 2011 12:18:43 -0400 Message-ID: <4E52815F.6010607@redhat.com> Date: Mon, 22 Aug 2011 19:18:39 +0300 From: Avi Kivity MIME-Version: 1.0 References: <4E5279F3.7070103@siemens.com> In-Reply-To: <4E5279F3.7070103@siemens.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RESEND][PATCH] Replace qemu_system_cond with VCPU stop mechanism List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: Paolo Bonzini , Anthony Liguori , qemu-devel , Gleb Natapov On 08/22/2011 06:46 PM, Jan Kiszka wrote: > We can express the VCPU thread wakeup with the stop mechanism, saving > both qemu_system_ready and the qemu_system_cond. For KVM threads, we can > just enter the main loop as long as the thread is stopped. The central > TCG thread is better held back before the loop as there can be side > effects of the services called even when all CPUs are stopped. > > Creating VCPUs in stopped state will also be required for proper CPU > hotplugging support. > > > - /* and wait for machine initialization */ > - while (!qemu_system_ready) { > - qemu_cond_wait(&qemu_system_cond,&qemu_global_mutex); > + /* wait for initial kick-off after machine start */ > + while (!first_cpu->stopped) { > + qemu_cond_wait(tcg_halt_cond,&qemu_global_mutex); > } Seems inverted - do we want to wait until first_cpu is stopped, or while first_cpu is stopped? Do we want to process run_on_cpu() events after the machine is created but before a cpu is started (if starting with -S)? -- error compiling committee.c: too many arguments to function