From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46776) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X349S-0003kt-6v for qemu-devel@nongnu.org; Fri, 04 Jul 2014 10:07:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X349L-0002xk-TV for qemu-devel@nongnu.org; Fri, 04 Jul 2014 10:07:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:19200) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X349L-0002wZ-Lc for qemu-devel@nongnu.org; Fri, 04 Jul 2014 10:07:39 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s64E7c44002907 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 4 Jul 2014 10:07:38 -0400 Date: Fri, 4 Jul 2014 10:07:36 -0400 From: Luiz Capitulino Message-ID: <20140704100736.0c813888@redhat.com> In-Reply-To: <1404481730-3788-1-git-send-email-pbonzini@redhat.com> References: <1404481730-3788-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] watchdog: fix deadlock with -watchdog-action pause List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org On Fri, 4 Jul 2014 15:48:50 +0200 Paolo Bonzini wrote: > qemu_clock_enable says: > > /* Disabling the clock will wait for related timerlists to stop > * executing qemu_run_timers. Thus, this functions should not > * be used from the callback of a timer that is based on @clock. > * Doing so would cause a deadlock. > */ > > and it indeed does: vm_stop uses qemu_clock_enable on QEMU_CLOCK_VIRTUAL > and watchdogs are based on QEMU_CLOCK_VIRTUAL, and we get a deadlock. > > Use qemu_system_vmstop_request_prepare()/qemu_system_vmstop_request() > instead; the alternative could be a BH. > > Signed-off-by: Paolo Bonzini Tested-by: Luiz Capitulino > --- > hw/watchdog/watchdog.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/hw/watchdog/watchdog.c b/hw/watchdog/watchdog.c > index 9f607d4..aa25b6f 100644 > --- a/hw/watchdog/watchdog.c > +++ b/hw/watchdog/watchdog.c > @@ -123,7 +123,8 @@ void watchdog_perform_action(void) > > case WDT_PAUSE: /* same as 'stop' command in monitor */ > qapi_event_send_watchdog(WATCHDOG_EXPIRATION_ACTION_PAUSE, &error_abort); > - vm_stop(RUN_STATE_WATCHDOG); > + qemu_system_vmstop_request_prepare(); > + qemu_system_vmstop_request(RUN_STATE_WATCHDOG); > break; > > case WDT_DEBUG: