All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>,
	qemu-devel@nongnu.org
Cc: jdenemar@redhat.com
Subject: Re: [Qemu-devel] [PATCH] use broadcast on qemu_pause_cond
Date: Mon, 25 Jan 2016 14:18:42 +0100	[thread overview]
Message-ID: <56A620B2.7010300@redhat.com> (raw)
In-Reply-To: <1453716498-27238-1-git-send-email-dgilbert@redhat.com>

On 25/01/2016 11:08, Dr. David Alan Gilbert (git) wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> 
> Jiri saw a hang on pause_all_vcpus called from postcopy_start,
> where the cpus are all apparently stopped ('stopped' flag set)
> but pause_all_vcpus is still stuck on a cond_wait on qemu_paused_cond.
> We suspect this is happening if a qmp_stop is called at about the
> same time as the postcopy code calls that pause_all_vcpus;
> although they both should have the main lock held, Paolo spotted
> the cond_wait unlocks the global lock so perhaps they both
> could end up waiting at the same time?
> 
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> Reported-by: Jiri Denemark <jdenemar@redhat.com>
> ---
>  cpus.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/cpus.c b/cpus.c
> index 3efff6b..1e97cc4 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -986,7 +986,7 @@ static void qemu_wait_io_event_common(CPUState *cpu)
>      if (cpu->stop) {
>          cpu->stop = false;
>          cpu->stopped = true;
> -        qemu_cond_signal(&qemu_pause_cond);
> +        qemu_cond_broadcast(&qemu_pause_cond);
>      }
>      flush_queued_work(cpu);
>      cpu->thread_kicked = false;
> @@ -1396,7 +1396,7 @@ void cpu_stop_current(void)
>          current_cpu->stop = false;
>          current_cpu->stopped = true;
>          cpu_exit(current_cpu);
> -        qemu_cond_signal(&qemu_pause_cond);
> +        qemu_cond_broadcast(&qemu_pause_cond);
>      }
>  }
>  
> 

Thanks, queued.

Paolo

  reply	other threads:[~2016-01-25 13:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-25 10:08 [Qemu-devel] [PATCH] use broadcast on qemu_pause_cond Dr. David Alan Gilbert (git)
2016-01-25 13:18 ` Paolo Bonzini [this message]
2016-01-26 19:41 ` Christian Borntraeger
2016-01-26 20:07   ` Dr. David Alan Gilbert

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=56A620B2.7010300@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=jdenemar@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.