From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54016) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNh2j-00063D-L7 for qemu-devel@nongnu.org; Mon, 25 Jan 2016 08:18:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aNh2g-0005TR-Fg for qemu-devel@nongnu.org; Mon, 25 Jan 2016 08:18:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57922) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNh2g-0005TF-AW for qemu-devel@nongnu.org; Mon, 25 Jan 2016 08:18:50 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id AB3928E69C for ; Mon, 25 Jan 2016 13:18:49 +0000 (UTC) References: <1453716498-27238-1-git-send-email-dgilbert@redhat.com> From: Paolo Bonzini Message-ID: <56A620B2.7010300@redhat.com> Date: Mon, 25 Jan 2016 14:18:42 +0100 MIME-Version: 1.0 In-Reply-To: <1453716498-27238-1-git-send-email-dgilbert@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] use broadcast on qemu_pause_cond List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Dr. David Alan Gilbert (git)" , qemu-devel@nongnu.org Cc: jdenemar@redhat.com On 25/01/2016 11:08, Dr. David Alan Gilbert (git) wrote: > From: "Dr. David Alan Gilbert" > > 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 > Reported-by: Jiri Denemark > --- > 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