From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH 1/5] Support for vm_stop from the migration thread Date: Tue, 30 Aug 2011 10:40:41 +0200 Message-ID: <4E5CA209.7080506@redhat.com> References: <2e43e3a409b7fa5f4781e30f3d7b7e56aa5d1fb0.1314398066.git.udeshpan@redhat.com> <20110829165624.GA3003@amt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Umesh Deshpande , kvm@vger.kernel.org, qemu-devel@nongnu.org To: Marcelo Tosatti Return-path: Received: from mail-yi0-f46.google.com ([209.85.218.46]:57266 "EHLO mail-yi0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751971Ab1H3Iks (ORCPT ); Tue, 30 Aug 2011 04:40:48 -0400 Received: by yie30 with SMTP id 30so4196768yie.19 for ; Tue, 30 Aug 2011 01:40:47 -0700 (PDT) In-Reply-To: <20110829165624.GA3003@amt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: 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