cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
218e99
From 5ef9ff360b8856803c2d9e865c3c2e83f59b1099 Mon Sep 17 00:00:00 2001
218e99
From: Marcel Apfelbaum <marcel.a@redhat.com>
218e99
Date: Wed, 6 Nov 2013 16:32:36 +0100
218e99
Subject: [PATCH 77/81] vl: allow "cont" from panicked state
218e99
218e99
RH-Author: Marcel Apfelbaum <marcel.a@redhat.com>
218e99
Message-id: <1383755557-21590-9-git-send-email-marcel.a@redhat.com>
218e99
Patchwork-id: 55553
218e99
O-Subject: [RHEL-7 qemu-kvm PATCH v3 8/9] vl: allow "cont" from panicked state
218e99
Bugzilla: 990601
218e99
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
218e99
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
218e99
RH-Acked-by: Alex Williamson <alex.williamson@redhat.com>
218e99
218e99
From: Paolo Bonzini <pbonzini@redhat.com>
218e99
218e99
After reporting the GUEST_PANICKED monitor event, QEMU stops the VM.
218e99
The reason for this is that events are edge-triggered, and can be lost if
218e99
management dies at the wrong time.  Stopping a panicked VM lets management
218e99
know of a panic even if it has crashed; management can learn about the
218e99
panic when it restarts and queries running QEMU processes.  The downside
218e99
is of course that the VM will be paused while management is not running,
218e99
but that is acceptable if it only happens with explicit "-device pvpanic".
218e99
218e99
Upon learning of a panic, management (if configured to do so) can pick a
218e99
variety of behaviors: leave the VM paused, reset it, destroy it.  In
218e99
addition to all of these behaviors, it is possible to dump the VM core
218e99
from the host.
218e99
218e99
However, right now, the panicked state is irreversible, and can only be
218e99
exited by resetting the machine.  This means that any policy decision
218e99
is entirely in the hands of the host.  In particular there is no way to
218e99
use the "reboot on panic" option together with pvpanic.
218e99
218e99
This patch makes the panicked state reversible (and removes various
218e99
workarounds that were there because of the state being irreversible).
218e99
With this change, management has a wider set of possible policies: it
218e99
can just log the crash and leave policy to the guest, it can leave the
218e99
VM paused.  In particular, the "log the crash and continue" is implemented
218e99
simply by sending a "cont" as soon as management learns about the panic.
218e99
Management could also implement the "irreversible paused state" itself.
218e99
And again, all such actions can be coupled with dumping the VM core.
218e99
218e99
Unfortunately we cannot change the behavior of 1.6.0.  Thus, even if
218e99
it uses "-device pvpanic", management should check for "cont" failures.
218e99
If "cont" fails, management can then log that the VM remained paused
218e99
and urge the administrator to update QEMU.
218e99
218e99
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
218e99
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
218e99
Acked-by: Michael S. Tsirkin <mst@redhat.com>
218e99
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
218e99
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
218e99
(cherry picked from commit df39076850958b842ac9e414dc3ab2895f1877bf)
218e99
Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
218e99
---
218e99
 vl.c | 5 ++---
218e99
 1 file changed, 2 insertions(+), 3 deletions(-)
218e99
218e99
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
---
218e99
 vl.c |    5 ++---
218e99
 1 files changed, 2 insertions(+), 3 deletions(-)
218e99
218e99
diff --git a/vl.c b/vl.c
218e99
index 7c8ba63..9b1738b 100644
218e99
--- a/vl.c
218e99
+++ b/vl.c
218e99
@@ -640,7 +640,7 @@ static const RunStateTransition runstate_transitions_def[] = {
218e99
     { RUN_STATE_WATCHDOG, RUN_STATE_RUNNING },
218e99
     { RUN_STATE_WATCHDOG, RUN_STATE_FINISH_MIGRATE },
218e99
 
218e99
-    { RUN_STATE_GUEST_PANICKED, RUN_STATE_PAUSED },
218e99
+    { RUN_STATE_GUEST_PANICKED, RUN_STATE_RUNNING },
218e99
     { RUN_STATE_GUEST_PANICKED, RUN_STATE_FINISH_MIGRATE },
218e99
 
218e99
     { RUN_STATE_MAX, RUN_STATE_MAX },
218e99
@@ -687,8 +687,7 @@ int runstate_is_running(void)
218e99
 bool runstate_needs_reset(void)
218e99
 {
218e99
     return runstate_check(RUN_STATE_INTERNAL_ERROR) ||
218e99
-        runstate_check(RUN_STATE_SHUTDOWN) ||
218e99
-        runstate_check(RUN_STATE_GUEST_PANICKED);
218e99
+        runstate_check(RUN_STATE_SHUTDOWN);
218e99
 }
218e99
 
218e99
 StatusInfo *qmp_query_status(Error **errp)
218e99
-- 
218e99
1.7.1
218e99