From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: QEMU/KVM: make sure all vcpus are paused before saving state Date: Wed, 9 Apr 2008 18:58:04 -0300 Message-ID: <20080409215804.GA7736@dmt> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel To: Avi Kivity Return-path: Content-Disposition: inline List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces@lists.sourceforge.net Errors-To: kvm-devel-bounces@lists.sourceforge.net List-Id: kvm.vger.kernel.org Make sure that all threads are paused in userspace before saving machine state. Signed-off-by: Marcelo Tosatti --- kvm-userspace.io/qemu/qemu-kvm.c +++ kvm-userspace.io/qemu/qemu-kvm.c @@ -244,7 +244,7 @@ static int all_threads_paused(void) int i; for (i = 0; i < smp_cpus; ++i) - if (vcpu_info[i].stopped) + if (vcpu_info[i].stop) return 0; return 1; } @@ -257,8 +257,12 @@ static void pause_all_threads(void) vcpu_info[i].stop = 1; pthread_kill(vcpu_info[i].thread, SIG_IPI); } - while (!all_threads_paused()) + while (!all_threads_paused()) { + pthread_mutex_unlock(&qemu_mutex); kvm_eat_signal(&io_signal_table, NULL, 1000); + pthread_mutex_lock(&qemu_mutex); + cpu_single_env = NULL; + } } static void resume_all_threads(void) ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone