Skip to contentSkip to conversation

QEMU/KVM: make sure all vcpus are paused before saving state

PATCH Applied Marcelo Tosatti 2 participants 2 messages Apr 9, 2008 – Apr 11, 2008 KVM

lore
Share & tools
lore
#0 lore raw

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

qemu/qemu-kvm.c +6 -2
@@ -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

Applied
#1 lore raw
Quoted 4 lines · Marcelo Tosatti

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

Applied, thanks.

Signature · 8 lines
Any sufficiently difficult bug is indistinguishable from a feature.


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