diff mbox

x86/hvm: Print %cs:%rip in triple fault error message

Message ID 1456254616-4728-1-git-send-email-andrew.cooper3@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andrew Cooper Feb. 23, 2016, 7:10 p.m. UTC
It provides a little more information than just "something went wrong".

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
---
 xen/arch/x86/hvm/emulate.c        | 2 +-
 xen/arch/x86/hvm/hvm.c            | 8 ++++++--
 xen/include/asm-x86/hvm/emulate.h | 1 +
 3 files changed, 8 insertions(+), 3 deletions(-)

Comments

Jan Beulich Feb. 24, 2016, 9:51 a.m. UTC | #1
>>> On 23.02.16 at 20:10, <andrew.cooper3@citrix.com> wrote:
> It provides a little more information than just "something went wrong".

To be honest, rather than adding useful information in piecemeal
steps, why don't we add show_execution_state(guest_cpu_user_regs())
right away. Each time I have to analyze an issue resulting in a guest
triple fault I find myself doing exactly that.

Jan
diff mbox

Patch

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index fef7905..1f2d4a7 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -1907,7 +1907,7 @@  struct segment_register *hvmemul_get_seg_reg(
     return &hvmemul_ctxt->seg_reg[seg];
 }
 
-static const char *guest_x86_mode_to_str(int mode)
+const char *guest_x86_mode_to_str(int mode)
 {
     switch ( mode )
     {
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index a29c421..87b3cce 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -2887,10 +2887,14 @@  void hvm_triple_fault(void)
     struct vcpu *v = current;
     struct domain *d = v->domain;
     u8 reason = d->arch.hvm_domain.params[HVM_PARAM_TRIPLE_FAULT_REASON];
+    const char *mode_str = guest_x86_mode_to_str(hvm_guest_x86_mode(v));
+    struct segment_register cs;
+
+    hvm_get_segment_register(v, x86_seg_cs, &cs);
 
     gprintk(XENLOG_INFO,
-            "Triple fault - invoking HVM shutdown action %d\n",
-            reason);
+            "Triple fault %s @ %04x:%08lx - invoking HVM shutdown action %d\n",
+            mode_str, cs.sel, guest_cpu_user_regs()->rip, reason);
     domain_shutdown(d, reason);
 }
 
diff --git a/xen/include/asm-x86/hvm/emulate.h b/xen/include/asm-x86/hvm/emulate.h
index 142d1b6..c7148c9 100644
--- a/xen/include/asm-x86/hvm/emulate.h
+++ b/xen/include/asm-x86/hvm/emulate.h
@@ -64,6 +64,7 @@  int hvmemul_do_pio_buffer(uint16_t port,
                           uint8_t dir,
                           void *buffer);
 
+const char *guest_x86_mode_to_str(int mode);
 void hvm_dump_emulation_state(const char *prefix,
                               struct hvm_emulate_ctxt *hvmemul_ctxt);