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
3277 struct {3277 struct {
3278#define KVM_SYSTEM_EVENT_SHUTDOWN 13278#define KVM_SYSTEM_EVENT_SHUTDOWN 1
3279#define KVM_SYSTEM_EVENT_RESET 23279#define KVM_SYSTEM_EVENT_RESET 2
3280#define KVM_SYSTEM_EVENT_CRASH 3
3280 __u32 type;3281 __u32 type;
3281 __u64 flags;3282 __u64 flags;
3282 } system_event;3283 } system_event;
@@ -3296,6 +3297,10 @@ Valid values for 'type' are: · 13 unmodified lines
3296 KVM_SYSTEM_EVENT_RESET -- the guest has requested a reset of the VM.3297 KVM_SYSTEM_EVENT_RESET -- the guest has requested a reset of the VM.
3297 As with SHUTDOWN, userspace can choose to ignore the request, or3298 As with SHUTDOWN, userspace can choose to ignore the request, or
3298 to schedule the reset to occur in the future and may call KVM_RUN again.3299 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.
3299 3304
3300 /* Fix the size of the union. */3305 /* Fix the size of the union. */
3301 char padding[256];3306 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
6263 vcpu_scan_ioapic(vcpu);6263 vcpu_scan_ioapic(vcpu);
6264 if (kvm_check_request(KVM_REQ_APIC_PAGE_RELOAD, vcpu))6264 if (kvm_check_request(KVM_REQ_APIC_PAGE_RELOAD, vcpu))
6265 kvm_vcpu_reload_apic_access_page(vcpu);6265 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 }
6266 }6272 }
6267 6273
6268 if (kvm_check_request(KVM_REQ_EVENT, vcpu) || req_int_win) {6274 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
139#define KVM_REQ_DISABLE_IBS 24139#define KVM_REQ_DISABLE_IBS 24
140#define KVM_REQ_APIC_PAGE_RELOAD 25140#define KVM_REQ_APIC_PAGE_RELOAD 25
141#define KVM_REQ_SMI 26141#define KVM_REQ_SMI 26
142#define KVM_REQ_HV_CRASH 27
142 143
143#define KVM_USERSPACE_IRQ_SOURCE_ID 0144#define KVM_USERSPACE_IRQ_SOURCE_ID 0
144#define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID 1145#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
317 struct {317 struct {
318#define KVM_SYSTEM_EVENT_SHUTDOWN 1318#define KVM_SYSTEM_EVENT_SHUTDOWN 1
319#define KVM_SYSTEM_EVENT_RESET 2319#define KVM_SYSTEM_EVENT_RESET 2
320#define KVM_SYSTEM_EVENT_CRASH 3
320 __u32 type;321 __u32 type;
321 __u64 flags;322 __u64 flags;
322 } system_event;323 } 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