[PATCH 2/2] Call KVM_HC_PANIC if guest panics

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Call KVM hypercall KVM_HC_PANIC if guest kernel calls panic() to signal the
host that the guest paniced.

Depends on CONFIG_KVM_GUEST set.

Signed-off-by: Daniel Gollub <gollub@xxxxxxxxxxxxx>
---
 arch/x86/kernel/kvm.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
index 33c07b0..f3c7d34 100644
--- a/arch/x86/kernel/kvm.c
+++ b/arch/x86/kernel/kvm.c
@@ -534,6 +534,20 @@ static void __init kvm_apf_trap_init(void)
 	set_intr_gate(14, &async_page_fault);
 }
 
+static int kvm_guest_panic(struct notifier_block *nb, unsigned long l, void *p)
+{
+	kvm_hypercall0(KVM_HC_PANIC);
+	return NOTIFY_DONE;
+}
+
+static struct notifier_block kvm_guest_paniced = {
+	.notifier_call = kvm_guest_panic
+};
+
+static void kvm_guest_panic_handler_init(void) {
+	atomic_notifier_chain_register(&panic_notifier_list, &kvm_guest_paniced);
+}
+
 void __init kvm_guest_init(void)
 {
 	int i;
@@ -541,6 +555,8 @@ void __init kvm_guest_init(void)
 	if (!kvm_para_available())
 		return;
 
+	kvm_guest_panic_handler_init();
+
 	paravirt_ops_setup();
 	register_reboot_notifier(&kvm_pv_reboot_nb);
 	for (i = 0; i < KVM_TASK_SLEEP_HASHSIZE; i++)
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux