qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Clement Deschamps <clement.deschamps@greensocs.com>,
	qemu-devel@nongnu.org
Cc: artem.k.pisarenko@gmail.com, Pavel.Dovgaluk@ispras.ru
Subject: Re: [Qemu-devel] [PATCH] icount: fix deadlock when all cpus are sleeping
Date: Mon, 22 Oct 2018 12:40:29 +0200	[thread overview]
Message-ID: <b0fbe897-8d98-30e1-b46a-f7485ee9d4a3@redhat.com> (raw)
In-Reply-To: <20181021142103.19014-1-clement.deschamps@greensocs.com>

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

      reply	other threads:[~2018-10-22 10:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b0fbe897-8d98-30e1-b46a-f7485ee9d4a3@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=Pavel.Dovgaluk@ispras.ru \
    --cc=artem.k.pisarenko@gmail.com \
    --cc=clement.deschamps@greensocs.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).