[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 08/12] kvm/x86: add sending hyper-v crash notificati
From: |
Denis V. Lunev |
Subject: |
[Qemu-devel] [PATCH 08/12] kvm/x86: add sending hyper-v crash notification to user space |
Date: |
Thu, 2 Jul 2015 19:07:51 +0300 |
From: Andrey Smetanin <address@hidden>
Sending of notification is done by exiting vcpu to user space
if KVM_REQ_HV_CRASH is enabled for vcpu. At exit to user space
the kvm_run structure contains system_event with type
KVM_SYSTEM_EVENT_CRASH to notify about guest crash occured.
Signed-off-by: Andrey Smetanin <address@hidden>
Signed-off-by: Denis V. Lunev <address@hidden>
Reviewed-by: Peter Hornyack <address@hidden>
CC: Paolo Bonzini <address@hidden>
CC: Gleb Natapov <address@hidden>
---
Documentation/virtual/kvm/api.txt | 5 +++++
arch/x86/kvm/x86.c | 6 ++++++
include/uapi/linux/kvm.h | 1 +
3 files changed, 12 insertions(+)
diff --git a/Documentation/virtual/kvm/api.txt
b/Documentation/virtual/kvm/api.txt
index a7926a9..a4ebcb7 100644
--- a/Documentation/virtual/kvm/api.txt
+++ b/Documentation/virtual/kvm/api.txt
@@ -3277,6 +3277,7 @@ should put the acknowledged interrupt vector into the
'epr' field.
struct {
#define KVM_SYSTEM_EVENT_SHUTDOWN 1
#define KVM_SYSTEM_EVENT_RESET 2
+#define KVM_SYSTEM_EVENT_CRASH 3
__u32 type;
__u64 flags;
} system_event;
@@ -3296,6 +3297,10 @@ Valid values for 'type' are:
KVM_SYSTEM_EVENT_RESET -- the guest has requested a reset of the VM.
As with SHUTDOWN, userspace can choose to ignore the request, or
to schedule the reset to occur in the future and may call KVM_RUN again.
+ KVM_SYSTEM_EVENT_CRASH -- the guest crash occurred and the guest
+ has requested a crash condition maintenance. Userspace can choose
+ to ignore the request, or to gather VM memory core dump and/or
+ reset/shutdown of the VM.
/* Fix the size of the union. */
char padding[256];
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index b4c2767..28e79c0 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -6265,6 +6265,12 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
vcpu_scan_ioapic(vcpu);
if (kvm_check_request(KVM_REQ_APIC_PAGE_RELOAD, vcpu))
kvm_vcpu_reload_apic_access_page(vcpu);
+ if (kvm_check_request(KVM_REQ_HV_CRASH, vcpu)) {
+ vcpu->run->exit_reason = KVM_EXIT_SYSTEM_EVENT;
+ vcpu->run->system_event.type = KVM_SYSTEM_EVENT_CRASH;
+ r = 0;
+ goto out;
+ }
}
if (kvm_check_request(KVM_REQ_EVENT, vcpu) || req_int_win) {
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index 5da4ca3..c8c6b8b 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -317,6 +317,7 @@ struct kvm_run {
struct {
#define KVM_SYSTEM_EVENT_SHUTDOWN 1
#define KVM_SYSTEM_EVENT_RESET 2
+#define KVM_SYSTEM_EVENT_CRASH 3
__u32 type;
__u64 flags;
} system_event;
--
2.1.4
- [Qemu-devel] [PATCH 02/12] kvm: introduce vcpu_debug = kvm_debug + vcpu context, (continued)
- [Qemu-devel] [PATCH 02/12] kvm: introduce vcpu_debug = kvm_debug + vcpu context, Denis V. Lunev, 2015/07/02
- [Qemu-devel] [PATCH 06/12] kvm/x86: mark hyper-v crash msrs as partition wide, Denis V. Lunev, 2015/07/02
- [Qemu-devel] [PATCH 01/12] kvm/x86: move Hyper-V MSR's/hypercall code into hyperv.c file, Denis V. Lunev, 2015/07/02
- [Qemu-devel] [PATCH 10/12] qemu/kvm: added kvm system event crash handler, Denis V. Lunev, 2015/07/02
- [Qemu-devel] [PATCH 07/12] kvm/x86: added hyper-v crash data and ctl msr's get/set'ers, Denis V. Lunev, 2015/07/02
- [Qemu-devel] [PATCH 11/12] qemu: add crash_occurred flag into CPUState, Denis V. Lunev, 2015/07/02
- [Qemu-devel] [PATCH 09/12] qemu: added qemu_system_guest_panicked() - generic guest panic handler, Denis V. Lunev, 2015/07/02
- [Qemu-devel] [PATCH 08/12] kvm/x86: add sending hyper-v crash notification to user space,
Denis V. Lunev <=
- [Qemu-devel] [PATCH 05/12] kvm: added KVM_REQ_HV_CRASH value to notify qemu about hyper-v crash, Denis V. Lunev, 2015/07/02
- [Qemu-devel] [PATCH 12/12] qemu/kvm/x86: hyper-v crash msrs set/get'ers and migration, Denis V. Lunev, 2015/07/02