From: "Denis V. Lunev" <den@openvz.org>
Cc: kvm@vger.kernel.org, Gleb Natapov <gleb@kernel.org>,
qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
Andrey Smetanin <asmetanin@virtuozzo.com>,
"Denis V. Lunev" <den@openvz.org>
Subject: [Qemu-devel] [PATCH 8/12] kvm/x86: add sending hyper-v crash notification to user space
Date: Fri, 3 Jul 2015 15:01:41 +0300 [thread overview]
Message-ID: <1435924905-8926-9-git-send-email-den@openvz.org> (raw)
In-Reply-To: <1435924905-8926-1-git-send-email-den@openvz.org>
From: Andrey Smetanin <asmetanin@virtuozzo.com>
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.
Signed-off-by: Andrey Smetanin <asmetanin@virtuozzo.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
Reviewed-by: Peter Hornyack <peterhornyack@google.com>
CC: Paolo Bonzini <pbonzini@redhat.com>
CC: Gleb Natapov <gleb@kernel.org>
---
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 ceec9bf..4d71b8f 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -6266,6 +6266,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 716ad4a..9ef19eb 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
next prev parent reply other threads:[~2015-07-03 12:02 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-03 12:01 [Qemu-devel] [PATCH v6 0/12] HyperV equivalent of pvpanic driver Denis V. Lunev
2015-07-03 12:01 ` [Qemu-devel] [PATCH 1/12] kvm/x86: move Hyper-V MSR's/hypercall code into hyperv.c file Denis V. Lunev
2015-07-03 12:01 ` [Qemu-devel] [PATCH 2/12] kvm: introduce vcpu_debug = kvm_debug + vcpu context Denis V. Lunev
2015-07-03 12:01 ` [Qemu-devel] [PATCH 3/12] kvm: add hyper-v crash msrs values Denis V. Lunev
2015-07-03 12:01 ` [Qemu-devel] [PATCH 4/12] kvm/x86: added hyper-v crash msrs into kvm hyperv context Denis V. Lunev
2015-07-03 12:01 ` [Qemu-devel] [PATCH 5/12] kvm: added KVM_REQ_HV_CRASH value to notify qemu about hyper-v crash Denis V. Lunev
2015-07-03 12:01 ` [Qemu-devel] [PATCH 6/12] kvm/x86: mark hyper-v crash msrs as partition wide Denis V. Lunev
2015-07-03 12:01 ` [Qemu-devel] [PATCH 7/12] kvm/x86: added hyper-v crash data and ctl msr's get/set'ers Denis V. Lunev
2015-08-19 0:41 ` Wanpeng Li
2015-08-19 0:47 ` Denis V. Lunev
2015-07-03 12:01 ` Denis V. Lunev [this message]
2015-07-03 12:01 ` [Qemu-devel] [PATCH 09/12] Added generic panic handler qemu_system_guest_panicked() Denis V. Lunev
2015-07-03 12:01 ` [Qemu-devel] [PATCH 10/12] kvm: Add kvm system event crash handler Denis V. Lunev
2015-07-03 12:01 ` [Qemu-devel] [PATCH 11/12] cpu: Add crash_occurred flag into CPUState Denis V. Lunev
2015-09-02 21:13 ` Paolo Bonzini
2015-07-03 12:01 ` [Qemu-devel] [PATCH 12/12] i386/kvm: Hyper-v crash msrs set/get'ers and migration Denis V. Lunev
2015-07-07 10:19 ` Paolo Bonzini
2015-07-07 10:21 ` Paolo Bonzini
2015-07-07 10:20 ` [Qemu-devel] [PATCH v6 0/12] HyperV equivalent of pvpanic driver Paolo Bonzini
2015-08-12 11:54 ` Denis V. Lunev
2015-08-12 12:47 ` Paolo Bonzini
2015-08-12 13:22 ` Denis V. Lunev
-- strict thread matches above, loose matches on Subject: below --
2015-07-02 16:01 [Qemu-devel] [PATCH v4 " Denis V. Lunev
2015-07-02 16:01 ` [Qemu-devel] [PATCH 8/12] kvm/x86: add sending hyper-v crash notification to user space Denis V. Lunev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1435924905-8926-9-git-send-email-den@openvz.org \
--to=den@openvz.org \
--cc=asmetanin@virtuozzo.com \
--cc=gleb@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).