From: Donald Dutile Date: Thu, 15 Jul 2010 18:56:49 +0000 (-0400) Subject: Xen: register panic notifier to take crashes of xen guests on panic X-Git-Tag: v2.6.36-rc1~551^2~2^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f09f6d194d85043e0eb105a577e7ad6d8170ab66;p=platform%2Fkernel%2Flinux-3.10.git Xen: register panic notifier to take crashes of xen guests on panic Register a panic notifier so that when the guest crashes it can shut down the domain and indicate it was a crash to the host. Signed-off-by: Donald Dutile Signed-off-by: Jeremy Fitzhardinge --- diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index 90a3e80..d99522e 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c @@ -1040,6 +1040,26 @@ static void xen_crash_shutdown(struct pt_regs *regs) xen_reboot(SHUTDOWN_crash); } +static int +xen_panic_event(struct notifier_block *this, unsigned long event, void *ptr) +{ + struct sched_shutdown r = { .reason = SHUTDOWN_crash}; + + if (HYPERVISOR_sched_op(SCHEDOP_shutdown, &r)) + BUG(); + return NOTIFY_DONE; +} + +static struct notifier_block xen_panic_block = { + .notifier_call= xen_panic_event, +}; + +int xen_panic_handler_init(void) +{ + atomic_notifier_chain_register(&panic_notifier_list, &xen_panic_block); + return 0; +} + static const struct machine_ops __initdata xen_machine_ops = { .restart = xen_restart, .halt = xen_machine_halt, diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index 9deb6ba..328b003 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c @@ -226,6 +226,8 @@ void __init xen_arch_setup(void) struct physdev_set_iopl set_iopl; int rc; + xen_panic_handler_init(); + HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_4gb_segments); HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_writable_pagetables); diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h index f9153a3..00d59d6 100644 --- a/arch/x86/xen/xen-ops.h +++ b/arch/x86/xen/xen-ops.h @@ -101,4 +101,6 @@ void xen_sysret32(void); void xen_sysret64(void); void xen_adjust_exception_frame(void); +extern int xen_panic_handler_init(void); + #endif /* XEN_OPS_H */