]> git.proxmox.com Git - mirror_qemu.git/commitdiff
cpus: dummy: unregister thread with RCU, exit loop on unplug
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 30 Jan 2018 16:04:53 +0000 (11:04 -0500)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 7 Feb 2018 13:09:25 +0000 (14:09 +0100)
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
cpus.c

diff --git a/cpus.c b/cpus.c
index 1063dace8883896163970e79e1bb1f33fbe13246..190ad5aabb888bfa21fcccf203b2055a47b74343 100644 (file)
--- a/cpus.c
+++ b/cpus.c
@@ -1234,7 +1234,7 @@ static void *qemu_dummy_cpu_thread_fn(void *arg)
     cpu->created = true;
     qemu_cond_signal(&qemu_cpu_cond);
 
-    while (1) {
+    do {
         qemu_mutex_unlock_iothread();
         do {
             int sig;
@@ -1246,8 +1246,9 @@ static void *qemu_dummy_cpu_thread_fn(void *arg)
         }
         qemu_mutex_lock_iothread();
         qemu_wait_io_event(cpu);
-    }
+    } while (!cpu->unplug);
 
+    rcu_unregister_thread();
     return NULL;
 #endif
 }