From ae0df5fca365941ebe629e0aa54fce45c56e94b8 Mon Sep 17 00:00:00 2001 From: Marcelo Tosatti Date: Wed, 9 Apr 2008 18:58:04 -0300 Subject: [PATCH] kvm: qemu: make sure all vcpus are paused before saving state Make sure that all threads are paused in userspace before saving machine state. Signed-off-by: Marcelo Tosatti Signed-off-by: Avi Kivity --- qemu/qemu-kvm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/qemu/qemu-kvm.c b/qemu/qemu-kvm.c index 8b5d2dc2..5ad810e4 100644 --- a/qemu/qemu-kvm.c +++ b/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) -- 2.11.4.GIT