Received: from eggs.gnu.org ([2001:4830:134:3::10]:40659) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X33s2-0000TE-42 for qemu-devel@nongnu.org; Fri, 04 Jul 2014 09:49:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X33rs-0004WX-C4 for qemu-devel@nongnu.org; Fri, 04 Jul 2014 09:49:46 -0400 Received: from mail-qg0-f45.google.com ([209.85.192.45]:63321) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X33rs-0004WM-8h for qemu-devel@nongnu.org; Fri, 04 Jul 2014 09:49:36 -0400 Received: by mail-qg0-f45.google.com with SMTP id a108so1454384qge.4 for ; Fri, 04 Jul 2014 06:49:00 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Fri, 4 Jul 2014 15:48:50 +0200 Message-Id: <1404481730-3788-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH] watchdog: fix deadlock with -watchdog-action pause List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: lcapitulino@redhat.com 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 --- 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: -- 1.9.3