Skip to contentSkip to conversation

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

PATCH In review Andrew Cooper 2 participants 2 messages Feb 23, 2016 – Feb 24, 2016

lore
Share & tools
lore
#0 lore raw

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

It provides a little more information than just "something went wrong".

---
CC: Jan Beulich <[email protected]>

---
 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(-)
xen/arch/x86/hvm/emulate.c +1 -1
index fef7905..1f2d4a7 100644
@@ -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 )
     {
xen/arch/x86/hvm/hvm.c +6 -2
index a29c421..87b3cce 100644
@@ -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);
 }
 
xen/include/asm-x86/hvm/emulate.h +1 -0
index 142d1b6..c7148c9 100644
@@ -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);
 
Signature · 1 line
2.1.4
#1 lore raw
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 23.02.16 at 20:10, <[email protected]> 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