* [Qemu-devel] [PATCH] watchdog: fix deadlock with -watchdog-action pause
@ 2014-07-04 13:48 Paolo Bonzini
2014-07-04 14:07 ` Luiz Capitulino
0 siblings, 1 reply; 2+ messages in thread
From: Paolo Bonzini @ 2014-07-04 13:48 UTC (permalink / raw)
To: qemu-devel; +Cc: lcapitulino
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>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] watchdog: fix deadlock with -watchdog-action pause
2014-07-04 13:48 [Qemu-devel] [PATCH] watchdog: fix deadlock with -watchdog-action pause Paolo Bonzini
@ 2014-07-04 14:07 ` Luiz Capitulino
0 siblings, 0 replies; 2+ messages in thread
From: Luiz Capitulino @ 2014-07-04 14:07 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: qemu-devel
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:
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-07-04 14:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).