diff options
author | Donald Dutile <ddutile@redhat.com> | 2010-07-15 14:56:49 -0400 |
---|---|---|
committer | Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> | 2010-08-04 17:47:31 -0400 |
commit | f09f6d194d85043e0eb105a577e7ad6d8170ab66 (patch) | |
tree | 1ac8db53e42a15f9f28f20c941d75bb8b94fd385 | |
parent | c06ee78d73fd24e8d8a65f16380f6a0551107e1b (diff) |
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 <ddutile@redhat.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
-rw-r--r-- | arch/x86/xen/enlighten.c | 20 | ||||
-rw-r--r-- | arch/x86/xen/setup.c | 2 | ||||
-rw-r--r-- | arch/x86/xen/xen-ops.h | 2 |
3 files changed, 24 insertions, 0 deletions
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index 90a3e8026767..d99522e8f033 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) | |||
1040 | xen_reboot(SHUTDOWN_crash); | 1040 | xen_reboot(SHUTDOWN_crash); |
1041 | } | 1041 | } |
1042 | 1042 | ||
1043 | static int | ||
1044 | xen_panic_event(struct notifier_block *this, unsigned long event, void *ptr) | ||
1045 | { | ||
1046 | struct sched_shutdown r = { .reason = SHUTDOWN_crash}; | ||
1047 | |||
1048 | if (HYPERVISOR_sched_op(SCHEDOP_shutdown, &r)) | ||
1049 | BUG(); | ||
1050 | return NOTIFY_DONE; | ||
1051 | } | ||
1052 | |||
1053 | static struct notifier_block xen_panic_block = { | ||
1054 | .notifier_call= xen_panic_event, | ||
1055 | }; | ||
1056 | |||
1057 | int xen_panic_handler_init(void) | ||
1058 | { | ||
1059 | atomic_notifier_chain_register(&panic_notifier_list, &xen_panic_block); | ||
1060 | return 0; | ||
1061 | } | ||
1062 | |||
1043 | static const struct machine_ops __initdata xen_machine_ops = { | 1063 | static const struct machine_ops __initdata xen_machine_ops = { |
1044 | .restart = xen_restart, | 1064 | .restart = xen_restart, |
1045 | .halt = xen_machine_halt, | 1065 | .halt = xen_machine_halt, |
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index 9deb6bab6c78..328b00305426 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c | |||
@@ -226,6 +226,8 @@ void __init xen_arch_setup(void) | |||
226 | struct physdev_set_iopl set_iopl; | 226 | struct physdev_set_iopl set_iopl; |
227 | int rc; | 227 | int rc; |
228 | 228 | ||
229 | xen_panic_handler_init(); | ||
230 | |||
229 | HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_4gb_segments); | 231 | HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_4gb_segments); |
230 | HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_writable_pagetables); | 232 | HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_writable_pagetables); |
231 | 233 | ||
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h index f9153a300bce..00d59d608edf 100644 --- a/arch/x86/xen/xen-ops.h +++ b/arch/x86/xen/xen-ops.h | |||
@@ -101,4 +101,6 @@ void xen_sysret32(void); | |||
101 | void xen_sysret64(void); | 101 | void xen_sysret64(void); |
102 | void xen_adjust_exception_frame(void); | 102 | void xen_adjust_exception_frame(void); |
103 | 103 | ||
104 | extern int xen_panic_handler_init(void); | ||
105 | |||
104 | #endif /* XEN_OPS_H */ | 106 | #endif /* XEN_OPS_H */ |