qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Capitulino <lcapitulino@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] watchdog: fix deadlock with -watchdog-action pause
Date: Fri, 4 Jul 2014 10:07:36 -0400	[thread overview]
Message-ID: <20140704100736.0c813888@redhat.com> (raw)
In-Reply-To: <1404481730-3788-1-git-send-email-pbonzini@redhat.com>

On Fri,  4 Jul 2014 15:48:50 +0200
Paolo Bonzini <pbonzini@redhat.com> 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 <pbonzini@redhat.com>

Tested-by: Luiz Capitulino <lcapitulino@redhat.com>

> ---
>  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:

      reply	other threads:[~2014-07-04 14:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-04 13:48 [Qemu-devel] [PATCH] watchdog: fix deadlock with -watchdog-action pause Paolo Bonzini
2014-07-04 14:07 ` Luiz Capitulino [this message]

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=20140704100736.0c813888@redhat.com \
    --to=lcapitulino@redhat.com \
    --cc=pbonzini@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).