console: allow a crash dump to be triggered from the xen console This feature is needed to test crash dump. It is essential for development (though developers could easily add the patch). It may also be of use for testing of the roll-out of production systems (people who don't want to add patches). The original version of this patch triggered a panic, Keir Fraser suggested changing it to trigger a crash dump in line with a similar feature in Linux's sysrq. Christian Limpach suggested changing the original trigger 'p' (for panic) to 'D' for dump, as p is already used by the performance counters. This patch uses 'c' for crashdump, again in line with the similar feature in Linux's sysrq. On inspection of the code, 'c' does not seem to be already taken. Signed-Off-By: Horms xen/common/kexec.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) --- x/xen/common/kexec.c +++ x/xen/common/kexec.c @@ -13,6 +13,7 @@ #include #include #include +#include #include DEFINE_PER_CPU (note_buf_t, crash_notes); @@ -55,6 +56,19 @@ void crash_kexec(struct cpu_user_regs *r return; } +static void do_crashdump_trigger(unsigned char key) +{ + printk("triggering crashdump\n"); + crash_kexec(NULL); +} + +static __init int register_crashdump_trigger(void) +{ + register_keyhandler('c', do_crashdump_trigger, "trigger a crashdump"); + return 0; +} +__initcall(register_crashdump_trigger); + static int get_crash_note(int vcpuid, XEN_GUEST_HANDLE(void) uarg) { struct domain *domain = current->domain;