[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v2 57/62] xen/shim: crash instead of reboot in shim mode



From: Roger Pau Monne <roger.pau@xxxxxxxxxx>

All guest shutdown operations are forwarded to L0, so the only native
calls to machine_restart happen from crash related paths inside the
hypervisor, hence switch the reboot code to instead issue a crash
shutdown.

Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
[ wei: fix arm build ]
Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
Changes since v1:
 - Use the ternary operator.
---
 xen/arch/x86/shutdown.c    | 7 ++++++-
 xen/drivers/char/console.c | 4 ++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/shutdown.c b/xen/arch/x86/shutdown.c
index 689f6f137d..a350714319 100644
--- a/xen/arch/x86/shutdown.c
+++ b/xen/arch/x86/shutdown.c
@@ -642,7 +642,12 @@ void machine_restart(unsigned int delay_millisecs)
             break;
 
         case BOOT_XEN:
-            xen_hypercall_shutdown(SHUTDOWN_reboot);
+            /*
+             * When running in PV shim mode guest shutdown calls are
+             * forwarded to L0, hence the only way to get here is if a
+             * shim crash happens.
+             */
+            xen_hypercall_shutdown(pv_shim ? SHUTDOWN_crash : SHUTDOWN_reboot);
             break;
         }
     }
diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index 18f5b7f7aa..121073c8ed 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -1253,7 +1253,11 @@ void panic(const char *fmt, ...)
     if ( opt_noreboot )
         printk("Manual reset required ('noreboot' specified)\n");
     else
+#ifdef CONFIG_X86
+        printk("%s in five seconds...\n", pv_shim ? "Crash" : "Reboot");
+#else
         printk("Reboot in five seconds...\n");
+#endif
 
     spin_unlock_irqrestore(&lock, flags);
 
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.