[Devel] [PATCH RHEL7 COMMIT] ms/kvm/x86: add sending hyper-v crash notification to user space
Konstantin Khorenko
khorenko at virtuozzo.com
Fri Oct 2 01:19:35 PDT 2015
The commit is pushed to "branch-rh7-3.10.0-229.7.2.vz7.8.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-229.7.2.vz7.8.2
------>
commit 68d3bb61b238c5fdac105590539600cd276fa95d
Author: Andrey Smetanin <asmetanin at virtuozzo.com>
Date: Fri Oct 2 12:19:35 2015 +0400
ms/kvm/x86: add sending hyper-v crash notification to user space
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 occurred.
ms commit - 2ce7918990641b07e70e1b25752d666369e2016e
Signed-off-by: Andrey Smetanin <asmetanin at virtuozzo.com>
Signed-off-by: Denis V. Lunev <den at openvz.org>
Reviewed-by: Peter Hornyack <peterhornyack at google.com>
CC: Paolo Bonzini <pbonzini at redhat.com>
CC: Gleb Natapov <gleb at kernel.org>
Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
---
Documentation/virtual/kvm/api.txt | 1 +
arch/x86/kvm/x86.c | 6 ++++++
include/uapi/linux/kvm.h | 1 +
3 files changed, 8 insertions(+)
diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt
index 9ae0e53..f919ff6 100644
--- a/Documentation/virtual/kvm/api.txt
+++ b/Documentation/virtual/kvm/api.txt
@@ -2687,6 +2687,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;
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index eeb63f7..db1017b 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -5787,6 +5787,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 c35227f..d2ea15d 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -306,6 +306,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;
More information about the Devel
mailing list