]> Git Repo - qemu.git/commitdiff
icount: fix deadlock when all cpus are sleeping
authorClement Deschamps <[email protected]>
Sun, 21 Oct 2018 14:21:03 +0000 (16:21 +0200)
committerPaolo Bonzini <[email protected]>
Tue, 6 Nov 2018 20:35:04 +0000 (21:35 +0100)
When all cpus are sleeping (e.g in WFI), to avoid a deadlock
in the main_loop, wake it up in order to start the warp timer.

Signed-off-by: Clement Deschamps <[email protected]>
Message-Id: <20181021142103[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
cpus.c

diff --git a/cpus.c b/cpus.c
index 3978f63d8f112cafba699274e1aa34232ce97e95..a2b33ccb293e50bd977d700e32c4a8e09f61e1f3 100644 (file)
--- a/cpus.c
+++ b/cpus.c
@@ -1554,6 +1554,14 @@ static void *qemu_tcg_rr_cpu_thread_fn(void *arg)
             atomic_mb_set(&cpu->exit_request, 0);
         }
 
+        if (use_icount && all_cpu_threads_idle()) {
+            /*
+             * When all cpus are sleeping (e.g in WFI), to avoid a deadlock
+             * in the main_loop, wake it up in order to start the warp timer.
+             */
+            qemu_notify_event();
+        }
+
         qemu_tcg_rr_wait_io_event(cpu ? cpu : first_cpu);
         deal_with_unplugged_cpus();
     }
This page took 0.026857 seconds and 4 git commands to generate.