From patchwork Mon Mar 21 17:28:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 600225 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3qTNN0606Cz9s4x for ; Tue, 22 Mar 2016 04:38:24 +1100 (AEDT) Received: from localhost ([::1]:59295 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ai3mZ-0000y8-02 for incoming@patchwork.ozlabs.org; Mon, 21 Mar 2016 13:38:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51718) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ai3dy-00021M-4S for qemu-devel@nongnu.org; Mon, 21 Mar 2016 13:29:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ai3du-00012i-7c for qemu-devel@nongnu.org; Mon, 21 Mar 2016 13:29:30 -0400 Received: from e36.co.us.ibm.com ([32.97.110.154]:49853) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ai3du-000128-0q for qemu-devel@nongnu.org; Mon, 21 Mar 2016 13:29:26 -0400 Received: from localhost by e36.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 21 Mar 2016 11:29:24 -0600 Received: from d03dlp01.boulder.ibm.com (9.17.202.177) by e36.co.us.ibm.com (192.168.1.136) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 21 Mar 2016 11:29:23 -0600 X-IBM-Helo: d03dlp01.boulder.ibm.com X-IBM-MailFrom: mdroth@linux.vnet.ibm.com X-IBM-RcptTo: qemu-devel@nongnu.org;qemu-stable@nongnu.org Received: from b01cxnp22034.gho.pok.ibm.com (b01cxnp22034.gho.pok.ibm.com [9.57.198.24]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id 9A6431FF0049; Mon, 21 Mar 2016 11:17:30 -0600 (MDT) Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by b01cxnp22034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u2LHTLHe19857468; Mon, 21 Mar 2016 17:29:21 GMT Received: from d01av03.pok.ibm.com (localhost [127.0.0.1]) by d01av03.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u2LHTK7n024685; Mon, 21 Mar 2016 13:29:20 -0400 Received: from localhost ([9.80.111.41]) by d01av03.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u2LHTJTD024642; Mon, 21 Mar 2016 13:29:19 -0400 From: Michael Roth To: qemu-devel@nongnu.org Date: Mon, 21 Mar 2016 12:28:21 -0500 Message-Id: <1458581313-19045-24-git-send-email-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1458581313-19045-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1458581313-19045-1-git-send-email-mdroth@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16032117-0021-0000-0000-00001AB94502 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 32.97.110.154 Cc: Michael Roth , Paolo Bonzini , qemu-stable@nongnu.org, "Dr. David Alan Gilbert" Subject: [Qemu-devel] [PATCH 23/35] cpus: use broadcast on qemu_pause_cond X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 Message-Id: <1453716498-27238-1-git-send-email-dgilbert@redhat.com> Cc: qemu-stable@nongnu.org Signed-off-by: Paolo Bonzini (cherry picked from commit 96bce6831bd19b61e965384427741d805c7234c3) Signed-off-by: Michael Roth --- cpus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpus.c b/cpus.c index 43676fa..747f14d 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; @@ -1387,7 +1387,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); } }