From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:55634) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QyJsH-0001Lu-7S for qemu-devel@nongnu.org; Tue, 30 Aug 2011 04:40:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QyJsG-0005Jh-An for qemu-devel@nongnu.org; Tue, 30 Aug 2011 04:40:49 -0400 Received: from mail-yi0-f45.google.com ([209.85.218.45]:63359) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QyJsG-0005Jc-76 for qemu-devel@nongnu.org; Tue, 30 Aug 2011 04:40:48 -0400 Received: by yih10 with SMTP id 10so4742450yih.4 for ; Tue, 30 Aug 2011 01:40:47 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <4E5CA209.7080506@redhat.com> Date: Tue, 30 Aug 2011 10:40:41 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <2e43e3a409b7fa5f4781e30f3d7b7e56aa5d1fb0.1314398066.git.udeshpan@redhat.com> <20110829165624.GA3003@amt.cnet> In-Reply-To: <20110829165624.GA3003@amt.cnet> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/5] Support for vm_stop from the migration thread List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Marcelo Tosatti Cc: Umesh Deshpande , qemu-devel@nongnu.org, kvm@vger.kernel.org On 08/29/2011 06:56 PM, Marcelo Tosatti wrote: >> > diff --git a/cpus.c b/cpus.c >> > index de70e02..f35f683 100644 >> > --- a/cpus.c >> > +++ b/cpus.c >> > @@ -122,8 +122,8 @@ static void do_vm_stop(int reason) >> > { >> > if (vm_running) { >> > cpu_disable_ticks(); >> > - vm_running = 0; >> > pause_all_vcpus(); >> > + vm_running = 0; >> > vm_state_notify(0, reason); >> > qemu_aio_flush(); >> > bdrv_flush_all(); > Why this change? Without it, you could have two threads calling into do_vm_stop and the second would not wait for all CPUs to be paused. Still not perfect as you'd get double notifications, you would need a condition variable or QemuEvent (from the RCU series) for that. Paolo