aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/kvm.h
diff options
context:
space:
mode:
authorDor Laor <dor.laor@qumranet.com>2007-01-05 19:36:24 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2007-01-06 02:55:22 -0500
commitc1150d8cf9e9d2b356fab52d79f2366985e5511b (patch)
treedbd50c3e064c22dcab7ce4acc7236370c6750923 /include/linux/kvm.h
parente097f35ce58eb8d687f3a300247cf1a978fcea39 (diff)
[PATCH] KVM: Improve interrupt response
The current interrupt injection mechanism might delay an interrupt under the following circumstances: - if injection fails because the guest is not interruptible (rflags.IF clear, or after a 'mov ss' or 'sti' instruction). Userspace can check rflags, but the other cases or not testable under the current API. - if injection fails because of a fault during delivery. This probably never happens under normal guests. - if injection fails due to a physical interrupt causing a vmexit so that it can be handled by the host. In all cases the guest proceeds without processing the interrupt, reducing the interactive feel and interrupt throughput of the guest. This patch fixes the situation by allowing userspace to request an exit when the 'interrupt window' opens, so that it can re-inject the interrupt at the right time. Guest interactivity is very visibly improved. Signed-off-by: Dor Laor <dor.laor@qumranet.com> Signed-off-by: Avi Kivity <avi@qumranet.com> Acked-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/kvm.h')
-rw-r--r--include/linux/kvm.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index 28fdce1ac1db..bc8b4616bad7 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -11,7 +11,7 @@
11#include <asm/types.h> 11#include <asm/types.h>
12#include <linux/ioctl.h> 12#include <linux/ioctl.h>
13 13
14#define KVM_API_VERSION 1 14#define KVM_API_VERSION 2
15 15
16/* 16/*
17 * Architectural interrupt line count, and the size of the bitmap needed 17 * Architectural interrupt line count, and the size of the bitmap needed
@@ -45,6 +45,7 @@ enum kvm_exit_reason {
45 KVM_EXIT_DEBUG = 4, 45 KVM_EXIT_DEBUG = 4,
46 KVM_EXIT_HLT = 5, 46 KVM_EXIT_HLT = 5,
47 KVM_EXIT_MMIO = 6, 47 KVM_EXIT_MMIO = 6,
48 KVM_EXIT_IRQ_WINDOW_OPEN = 7,
48}; 49};
49 50
50/* for KVM_RUN */ 51/* for KVM_RUN */
@@ -53,11 +54,19 @@ struct kvm_run {
53 __u32 vcpu; 54 __u32 vcpu;
54 __u32 emulated; /* skip current instruction */ 55 __u32 emulated; /* skip current instruction */
55 __u32 mmio_completed; /* mmio request completed */ 56 __u32 mmio_completed; /* mmio request completed */
57 __u8 request_interrupt_window;
58 __u8 padding1[3];
56 59
57 /* out */ 60 /* out */
58 __u32 exit_type; 61 __u32 exit_type;
59 __u32 exit_reason; 62 __u32 exit_reason;
60 __u32 instruction_length; 63 __u32 instruction_length;
64 __u8 ready_for_interrupt_injection;
65 __u8 if_flag;
66 __u16 padding2;
67 __u64 cr8;
68 __u64 apic_base;
69
61 union { 70 union {
62 /* KVM_EXIT_UNKNOWN */ 71 /* KVM_EXIT_UNKNOWN */
63 struct { 72 struct {