[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 54/99] cpus: tcg: fix never exiting loop on unplug

From: Michael Roth
Subject: [Qemu-devel] [PATCH 54/99] cpus: tcg: fix never exiting loop on unplug
Date: Mon, 23 Jul 2018 15:17:03 -0500

From: Cédric Le Goater <address@hidden>

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 <address@hidden>
Message-Id: <address@hidden>
Cc: address@hidden
Fixes: 9b0605f9837b68fd56c7fc7c96a3a1a3b983687d
Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Cédric Le Goater <address@hidden>
(cherry picked from commit 54961aac190df28d311802364d19e18d5cda8bab)
Signed-off-by: Michael Roth <address@hidden>
 cpus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cpus.c b/cpus.c
index 38eba8bff3..e1d94038fd 100644
--- 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;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]