Commit 54961aac authored by Cédric Le Goater's avatar Cédric Le Goater Committed by Paolo Bonzini
Browse files

cpus: tcg: fix never exiting loop on unplug



Commit 9b0605f9 ("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: default avatarCédric Le Goater <clg@kaod.org>
Message-Id: <20180425131828.15604-1-clg@kaod.org>
Cc: qemu-stable@nongnu.org
Fixes: 9b0605f9
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: default avatarCédric Le Goater <clg@kaod.org>
parent f056158d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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();