All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Avi Kivity <avi@qumranet.com>
Cc: kvm-devel <kvm-devel@lists.sourceforge.net>
Subject: QEMU/KVM: make sure all vcpus are paused before saving state
Date: Wed, 9 Apr 2008 18:58:04 -0300	[thread overview]
Message-ID: <20080409215804.GA7736@dmt> (raw)


Make sure that all threads are paused in userspace before saving machine
state.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>


--- 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

             reply	other threads:[~2008-04-09 21:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-09 21:58 Marcelo Tosatti [this message]
2008-04-11 12:40 ` QEMU/KVM: make sure all vcpus are paused before saving state Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080409215804.GA7736@dmt \
    --to=mtosatti@redhat.com \
    --cc=avi@qumranet.com \
    --cc=kvm-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.