* [Qemu-devel] [PATCH] icount: fix deadlock when all cpus are sleeping
@ 2018-10-21 14:21 Clement Deschamps
2018-10-22 10:40 ` Paolo Bonzini
0 siblings, 1 reply; 2+ messages in thread
From: Clement Deschamps @ 2018-10-21 14:21 UTC (permalink / raw)
To: qemu-devel; +Cc: Clement Deschamps, pbonzini, artem.k.pisarenko, Pavel.Dovgaluk
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 <clement.deschamps@greensocs.com>
---
cpus.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/cpus.c b/cpus.c
index bb2a511483..798d43623a 100644
--- 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();
}
--
2.19.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] icount: fix deadlock when all cpus are sleeping
2018-10-21 14:21 [Qemu-devel] [PATCH] icount: fix deadlock when all cpus are sleeping Clement Deschamps
@ 2018-10-22 10:40 ` Paolo Bonzini
0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2018-10-22 10:40 UTC (permalink / raw)
To: Clement Deschamps, qemu-devel; +Cc: artem.k.pisarenko, Pavel.Dovgaluk
On 21/10/2018 16:21, Clement Deschamps wrote:
> 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 <clement.deschamps@greensocs.com>
> ---
> cpus.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/cpus.c b/cpus.c
> index bb2a511483..798d43623a 100644
> --- 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();
> }
>
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-10-22 10:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-21 14:21 [Qemu-devel] [PATCH] icount: fix deadlock when all cpus are sleeping Clement Deschamps
2018-10-22 10:40 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).