[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] tools: hvmloader: attempt to SHUTDOWN_crash on BUG
# HG changeset patch # User Ian Campbell <ian.campbell@xxxxxxxxxx> # Date 1303143704 -3600 # Node ID 05abea47f4dc670974cd513a0e74db54d22eacc9 # Parent 052ffd72382924eee479ca479fd1574750a8adf7 tools: hvmloader: attempt to SHUTDOWN_crash on BUG If we have got as far as having enabled hypercalls then this signals to the toolstack that something went wrong. Otherwise they tend to assume the guest has either shutdown or rebooted which can lead to simply trying again repeatedly. Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx> diff -r 052ffd723829 -r 05abea47f4dc tools/firmware/hvmloader/hvmloader.c --- a/tools/firmware/hvmloader/hvmloader.c Mon Apr 18 14:53:03 2011 +0100 +++ b/tools/firmware/hvmloader/hvmloader.c Mon Apr 18 17:21:44 2011 +0100 @@ -114,6 +114,8 @@ unsigned long pci_mem_end = PCI_MEM_END; enum virtual_vga virtual_vga = VGA_none; +int hypercalls_available = 0; + static void init_hypercalls(void) { uint32_t eax, ebx, ecx, edx; @@ -146,6 +148,7 @@ static void init_hypercalls(void) cpuid(base + 1, &eax, &ebx, &ecx, &edx); hypercall_xen_version(XENVER_extraversion, extraversion); printf("Detected Xen v%u.%u%s\n", eax >> 16, eax & 0xffff, extraversion); + hypercalls_available = 1; } /* diff -r 052ffd723829 -r 05abea47f4dc tools/firmware/hvmloader/hypercall.h --- a/tools/firmware/hvmloader/hypercall.h Mon Apr 18 14:53:03 2011 +0100 +++ b/tools/firmware/hvmloader/hypercall.h Mon Apr 18 17:21:44 2011 +0100 @@ -35,6 +35,9 @@ #include <xen/xen.h> #include "config.h" +/* Have hypercalls been successfully enabled */ +extern int hypercalls_available; + /* * NB. Hypercall address needs to be relative to a linkage symbol for * some version of ld to relocate the relative calls properly. diff -r 052ffd723829 -r 05abea47f4dc tools/firmware/hvmloader/util.c --- a/tools/firmware/hvmloader/util.c Mon Apr 18 14:53:03 2011 +0100 +++ b/tools/firmware/hvmloader/util.c Mon Apr 18 17:21:44 2011 +0100 @@ -24,6 +24,7 @@ #include <stdint.h> #include <xen/xen.h> #include <xen/memory.h> +#include <xen/sched.h> void wrmsr(uint32_t idx, uint64_t v) { @@ -547,7 +548,15 @@ void __assert_failed(char *assertion, ch void __bug(char *file, int line) { + struct sched_shutdown shutdown = { + .reason = SHUTDOWN_crash, + }; + printf("HVMLoader bug at %s:%d\n", file, line); + if (hypercalls_available) { + printf("SCHEDOP_shutdown: reason=SHUTDOWN_crash\n"); + hypercall_sched_op(SCHEDOP_shutdown, &shutdown); + } for ( ; ; ) asm volatile ( "ud2" ); } _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |