qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alejandro Jimenez <alejandro.j.jimenez@oracle.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com
Subject: [PATCH 1/1] vl: Add -no-panicstop option
Date: Thu,  1 Oct 2020 22:41:34 -0400	[thread overview]
Message-ID: <1601606494-1154-2-git-send-email-alejandro.j.jimenez@oracle.com> (raw)
In-Reply-To: <1601606494-1154-1-git-send-email-alejandro.j.jimenez@oracle.com>

The current default action of pausing a guest after a panic event
is received leaves the responsibility to resume guest execution to the
management layer. The reasons for this behavior are discussed here:
https://lore.kernel.org/qemu-devel/52148F88.5000509@redhat.com/

However, in instances like the case of older guests (Linux and
Windows) using a pvpanic device but missing support for the
PVPANIC_CRASHLOADED event, and Windows guests using the hv-crash
enlightenment, it is desirable to allow the guests to continue
running after sending a PVPANIC_PANICKED event. This allows such
guests to proceed to capture a crash dump and automatically reboot
without intervention of a management layer.

Add an option to avoid stopping a VM after a panic event is received.

Signed-off-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com>
Reviewed-by: Mark Kanda <mark.kanda@oracle.com>
---
 qemu-options.hx | 11 +++++++++++
 softmmu/vl.c    | 17 ++++++++++++++---
 2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/qemu-options.hx b/qemu-options.hx
index 3564c23..cbaf947 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -3882,6 +3882,17 @@ SRST
     specified domain id (XEN only).
 ERST
 
+DEF("no-panicstop", 0, QEMU_OPTION_no_panicstop, \
+    "-no-panicstop	do not stop the VM on panic\n", QEMU_ARCH_ALL)
+SRST
+``-no-panicstop``
+    Don't stop the VM when a panic event is received. This allows older guests
+    using a pvpanic device but without support for the PVPANIC_CRASHLOADED
+    event, and Windows guests using the hv-crash enlightenment to continue
+    running and capture a crash dump or reboot without intervention of a
+    management layer.
+ERST
+
 DEF("no-reboot", 0, QEMU_OPTION_no_reboot, \
     "-no-reboot      exit instead of rebooting\n", QEMU_ARCH_ALL)
 SRST
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 22bc570..a939b18 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -147,6 +147,7 @@ int win2k_install_hack = 0;
 int singlestep = 0;
 int no_hpet = 0;
 int fd_bootchk = 1;
+static int no_panicstop;
 static int no_reboot;
 int no_shutdown = 0;
 int graphic_rotate = 0;
@@ -1431,9 +1432,16 @@ void qemu_system_guest_panicked(GuestPanicInformation *info)
     if (current_cpu) {
         current_cpu->crash_occurred = true;
     }
-    qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE,
-                                   !!info, info);
-    vm_stop(RUN_STATE_GUEST_PANICKED);
+
+    if (no_panicstop) {
+        qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_RUN,
+                                        !!info, info);
+    } else {
+        qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE,
+                                        !!info, info);
+        vm_stop(RUN_STATE_GUEST_PANICKED);
+    }
+
     if (!no_shutdown) {
         qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_POWEROFF,
                                        !!info, info);
@@ -3558,6 +3566,9 @@ void qemu_init(int argc, char **argv, char **envp)
             case QEMU_OPTION_no_hpet:
                 no_hpet = 1;
                 break;
+            case QEMU_OPTION_no_panicstop:
+                no_panicstop = 1;
+                break;
             case QEMU_OPTION_no_reboot:
                 no_reboot = 1;
                 break;
-- 
1.8.3.1



  reply	other threads:[~2020-10-02  5:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-02  2:41 [PATCH 0/1] Do not stop guest when panic event is received Alejandro Jimenez
2020-10-02  2:41 ` Alejandro Jimenez [this message]
2020-10-20 17:14 ` Paolo Bonzini
2020-10-21 13:26   ` Alejandro Jimenez
2020-10-21 13:33     ` Paolo Bonzini

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=1601606494-1154-2-git-send-email-alejandro.j.jimenez@oracle.com \
    --to=alejandro.j.jimenez@oracle.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).