diff options
author | Avi Kivity <avi@redhat.com> | 2010-07-27 05:30:24 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2010-10-24 04:52:50 -0400 |
commit | 3842d135ff246b6543f1df77f5600e12094a6845 (patch) | |
tree | 7b65456a0527fc3ea753a49c528643fd3b52a7d6 /arch/x86/kvm/vmx.c | |
parent | b0bc3ee2b54fcea0df42cc9aa05103b1ccd89db0 (diff) |
KVM: Check for pending events before attempting injection
Instead of blindly attempting to inject an event before each guest entry,
check for a possible event first in vcpu->requests. Sites that can trigger
event injection are modified to set KVM_REQ_EVENT:
- interrupt, nmi window opening
- ppr updates
- i8259 output changes
- local apic irr changes
- rflags updates
- gif flag set
- event set on exit
This improves non-injecting entry performance, and sets the stage for
non-atomic injection.
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r-- | arch/x86/kvm/vmx.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 1a7691a87178..2ce2e0b13edb 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -3327,6 +3327,7 @@ static int handle_wrmsr(struct kvm_vcpu *vcpu) | |||
3327 | 3327 | ||
3328 | static int handle_tpr_below_threshold(struct kvm_vcpu *vcpu) | 3328 | static int handle_tpr_below_threshold(struct kvm_vcpu *vcpu) |
3329 | { | 3329 | { |
3330 | kvm_make_request(KVM_REQ_EVENT, vcpu); | ||
3330 | return 1; | 3331 | return 1; |
3331 | } | 3332 | } |
3332 | 3333 | ||
@@ -3339,6 +3340,8 @@ static int handle_interrupt_window(struct kvm_vcpu *vcpu) | |||
3339 | cpu_based_vm_exec_control &= ~CPU_BASED_VIRTUAL_INTR_PENDING; | 3340 | cpu_based_vm_exec_control &= ~CPU_BASED_VIRTUAL_INTR_PENDING; |
3340 | vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, cpu_based_vm_exec_control); | 3341 | vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, cpu_based_vm_exec_control); |
3341 | 3342 | ||
3343 | kvm_make_request(KVM_REQ_EVENT, vcpu); | ||
3344 | |||
3342 | ++vcpu->stat.irq_window_exits; | 3345 | ++vcpu->stat.irq_window_exits; |
3343 | 3346 | ||
3344 | /* | 3347 | /* |
@@ -3595,6 +3598,7 @@ static int handle_nmi_window(struct kvm_vcpu *vcpu) | |||
3595 | cpu_based_vm_exec_control &= ~CPU_BASED_VIRTUAL_NMI_PENDING; | 3598 | cpu_based_vm_exec_control &= ~CPU_BASED_VIRTUAL_NMI_PENDING; |
3596 | vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, cpu_based_vm_exec_control); | 3599 | vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, cpu_based_vm_exec_control); |
3597 | ++vcpu->stat.nmi_window_exits; | 3600 | ++vcpu->stat.nmi_window_exits; |
3601 | kvm_make_request(KVM_REQ_EVENT, vcpu); | ||
3598 | 3602 | ||
3599 | return 1; | 3603 | return 1; |
3600 | } | 3604 | } |
@@ -3828,6 +3832,8 @@ static void vmx_complete_interrupts(struct vcpu_vmx *vmx) | |||
3828 | if (!idtv_info_valid) | 3832 | if (!idtv_info_valid) |
3829 | return; | 3833 | return; |
3830 | 3834 | ||
3835 | kvm_make_request(KVM_REQ_EVENT, &vmx->vcpu); | ||
3836 | |||
3831 | vector = idt_vectoring_info & VECTORING_INFO_VECTOR_MASK; | 3837 | vector = idt_vectoring_info & VECTORING_INFO_VECTOR_MASK; |
3832 | type = idt_vectoring_info & VECTORING_INFO_TYPE_MASK; | 3838 | type = idt_vectoring_info & VECTORING_INFO_TYPE_MASK; |
3833 | 3839 | ||