dom0 state dump
RFC PATCH 1/1 dom0 state dump
Since xenctx cannot (for obvious reasons) display the context of dom0's vCPU-s, here are the beginnings of a console based mechanism to achieve the same (useful if dom0 hangs with one or more de-scheduled vCPU-s). The stack handling obviously needs improvement, but the register context should come out fine in all cases.
Signed-off-by Jan Beulich <[email protected]>
xen/arch/x86/traps.c +9 -0
@@ -331,6 +331,15 @@ void show_execution_state(struct cpu_useshow_stack (regs); } +void vcpu_show_execution_state (struct vcpu *v) +{ +vcpu_show_registers (v); +/* XXX Should rather map the guest's top stack page here... */ +if ( v->domain == current->domain && +guest_kernel_mode (v, &v->arch.guest_context.user_regs) ) +show_guest_stack (&v->arch.guest_context.user_regs); +} +char *trapstr (int trapnr) {static char *strings[] = {
xen/arch/x86/x86_32/traps.c +38 -15
71 lines not on this page · raw message
xen/arch/x86/x86_64/traps.c +48 -22
88 lines not on this page · raw message
xen/common/keyhandler.c +26 -0
@@ -130,6 +130,29 @@ static void dump_registers(unsigned charprintk ("\n" ); } +static void dump_dom0_registers (unsigned char key) +{ +struct vcpu *v; + +if ( !dom0 ) +return ; + +printk ("'%c' pressed -> dumping Dom0's registers\n" , key); + + for_each_vcpu ( dom0, v ) + { +printk ("*** Dumping Dom0 vcpu#%d state: ***\n" , v->vcpu_id); +if ( v == current ) +show_execution_state (guest_cpu_user_regs ()); +else + { +vcpu_pause (v); +vcpu_show_execution_state (v); +vcpu_unpause (v); + } + } +} +static void halt_machine (unsigned char key,struct cpu_user_regs *regs) {printk ("'%c' pressed -> rebooting machine\n" , key);
@@ -315,6 +338,9 @@ void __init initialize_keytable(void) 'P', perfc_reset, "reset performance counters");#endif +register_keyhandler ( +'0' , dump_dom0_registers,"dump Dom0 registers" ); +register_irq_keyhandler ('%' , do_debug_key,"Trap to xendbg" ); }
xen/include/asm-ia64/xenprocessor.h +2 -1
@@ -250,6 +250,7 @@ typedef union { }; } ia64_pkr_t; -#define dump_execution_state () printk("FIXME: implement ia64 dump_execution_state()\n"); +#define dump_execution_state () printk("FIXME: implement ia64 dump_execution_state()\n") +#define vcpu_show_execution_state (v) printk("FIXME: implement ia64 vcpu_show_execution_state()\n")#endif // _ASM_IA64_XENPROCESSOR_H
xen/include/asm-x86/domain.h +3 -0
@@ -352,6 +352,9 @@ struct arch_vcpu/* Continue the current hypercall via func(data) on specified cpu. */ int continue_hypercall_on_cpu (int cpu,long (*func)(void *data),void *data); +void vcpu_show_execution_state (struct vcpu *); +void vcpu_show_registers (const struct vcpu *); +/* Clean up CR4 bits that are not under guest control. */ unsigned long pv_guest_cr4_fixup (unsigned long guest_cr4);