]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
cpus: tcg: fix never exiting loop on unplug
authorCédric Le Goater <clg@kaod.org>
Wed, 25 Apr 2018 13:18:28 +0000 (15:18 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 8 May 2018 22:13:37 +0000 (00:13 +0200)
Commit 9b0605f9837b ("cpus: tcg: unregister thread with RCU, fix
exiting of loop on unplug") changed the exit condition of the loop in
the vCPU thread function but forgot to remove the beginning 'while (1)'
statement. The resulting code :

while (1) {
...
} while (!cpu->unplug || cpu_can_run(cpu));

is a sequence of two distinct two while() loops, the first not exiting
in case of an unplug event.

Remove the first while (1) to fix CPU unplug.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Message-Id: <20180425131828.15604-1-clg@kaod.org>
Cc: qemu-stable@nongnu.org
Fixes: 9b0605f9837b68fd56c7fc7c96a3a1a3b983687d
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
cpus.c

diff --git a/cpus.c b/cpus.c
index be3a4eb27aec203236c55987167b02e30910fb24..d1f16296de7ef526ca0d0ce403b3bc8e70d5679a 100644 (file)
--- a/cpus.c
+++ b/cpus.c
@@ -1648,7 +1648,7 @@ static void *qemu_tcg_cpu_thread_fn(void *arg)
     /* process any pending work */
     cpu->exit_request = 1;
 
-    while (1) {
+    do {
         if (cpu_can_run(cpu)) {
             int r;
             qemu_mutex_unlock_iothread();