History

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.

Andrey Smetanin committed 11 years ago

Commit 2ce79181 parent e7d95134 files · +13 −0Browse files

Unified · Split

4 files
  1. Documentation/virtual/kvm/api.txt +5 −0
  2. arch/x86/kvm/x86.c +6 −0
  3. include/linux/kvm_host.h +1 −0
  4. include/uapi/linux/kvm.h +1 −0
Documentation/virtual/kvm/api.txt+5−0
@@ -3277,6 +3277,7 @@ should put the acknowledged interrupt vector into the 'epr' field. · 3276 unmodified lines
32773277 struct {
32783278 #define KVM_SYSTEM_EVENT_SHUTDOWN 1
32793279 #define KVM_SYSTEM_EVENT_RESET 2
3280+#define KVM_SYSTEM_EVENT_CRASH 3
32803281 __u32 type;
32813282 __u64 flags;
32823283 } system_event;
@@ -3296,6 +3297,10 @@ Valid values for 'type' are: · 13 unmodified lines
32963297 KVM_SYSTEM_EVENT_RESET -- the guest has requested a reset of the VM.
32973298 As with SHUTDOWN, userspace can choose to ignore the request, or
32983299 to schedule the reset to occur in the future and may call KVM_RUN again.
3300+ KVM_SYSTEM_EVENT_CRASH -- the guest crash occurred and the guest
3301+ has requested a crash condition maintenance. Userspace can choose
3302+ to ignore the request, or to gather VM memory core dump and/or
3303+ reset/shutdown of the VM.
32993304
33003305 /* Fix the size of the union. */
33013306 char padding[256];
arch/x86/kvm/x86.c+6−0
@@ -6263,6 +6263,12 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) · 6262 unmodified lines
62636263 vcpu_scan_ioapic(vcpu);
62646264 if (kvm_check_request(KVM_REQ_APIC_PAGE_RELOAD, vcpu))
62656265 kvm_vcpu_reload_apic_access_page(vcpu);
6266+ if (kvm_check_request(KVM_REQ_HV_CRASH, vcpu)) {
6267+ vcpu->run->exit_reason = KVM_EXIT_SYSTEM_EVENT;
6268+ vcpu->run->system_event.type = KVM_SYSTEM_EVENT_CRASH;
6269+ r = 0;
6270+ goto out;
6271+ }
62666272 }
62676273
62686274 if (kvm_check_request(KVM_REQ_EVENT, vcpu) || req_int_win) {
include/linux/kvm_host.h+1−0
@@ -139,6 +139,7 @@ static inline bool is_error_page(struct page *page) · 138 unmodified lines
139139 #define KVM_REQ_DISABLE_IBS 24
140140 #define KVM_REQ_APIC_PAGE_RELOAD 25
141141 #define KVM_REQ_SMI 26
142+#define KVM_REQ_HV_CRASH 27
142143
143144 #define KVM_USERSPACE_IRQ_SOURCE_ID 0
144145 #define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID 1
include/uapi/linux/kvm.h+1−0
@@ -317,6 +317,7 @@ struct kvm_run { · 316 unmodified lines
317317 struct {
318318 #define KVM_SYSTEM_EVENT_SHUTDOWN 1
319319 #define KVM_SYSTEM_EVENT_RESET 2
320+#define KVM_SYSTEM_EVENT_CRASH 3
320321 __u32 type;
321322 __u64 flags;
322323 } system_event;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t