diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2016-12-18 08:02:21 -0500 |
---|---|---|
committer | Radim Krčmář <rkrcmar@redhat.com> | 2017-01-09 08:48:00 -0500 |
commit | eb90f3417a0cc4880e979ccc84e41890d410ea5b (patch) | |
tree | e2fb1a6d70e064e30706848ae6a2899f21e8cc2a | |
parent | 0f1e261ead16ce09169bf2d223d4c8803576f85e (diff) |
KVM: vmx: speed up TPR below threshold vmexits
Since we're already in VCPU context, all we have to do here is recompute
the PPR value. That will in turn generate a KVM_REQ_EVENT if necessary.
Reviewed-by: Roman Kagan <rkagan@virtuozzo.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r-- | arch/x86/kvm/lapic.c | 6 | ||||
-rw-r--r-- | arch/x86/kvm/lapic.h | 1 | ||||
-rw-r--r-- | arch/x86/kvm/vmx.c | 2 |
3 files changed, 8 insertions, 1 deletions
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 7e9ac4606279..6b1d3a76c1d0 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c | |||
@@ -595,6 +595,12 @@ static void apic_update_ppr(struct kvm_lapic *apic) | |||
595 | } | 595 | } |
596 | } | 596 | } |
597 | 597 | ||
598 | void kvm_apic_update_ppr(struct kvm_vcpu *vcpu) | ||
599 | { | ||
600 | apic_update_ppr(vcpu->arch.apic); | ||
601 | } | ||
602 | EXPORT_SYMBOL_GPL(kvm_apic_update_ppr); | ||
603 | |||
598 | static void apic_set_tpr(struct kvm_lapic *apic, u32 tpr) | 604 | static void apic_set_tpr(struct kvm_lapic *apic, u32 tpr) |
599 | { | 605 | { |
600 | kvm_lapic_set_reg(apic, APIC_TASKPRI, tpr); | 606 | kvm_lapic_set_reg(apic, APIC_TASKPRI, tpr); |
diff --git a/arch/x86/kvm/lapic.h b/arch/x86/kvm/lapic.h index cb16e6fd2330..5b5b1ba644cb 100644 --- a/arch/x86/kvm/lapic.h +++ b/arch/x86/kvm/lapic.h | |||
@@ -73,6 +73,7 @@ bool kvm_apic_match_dest(struct kvm_vcpu *vcpu, struct kvm_lapic *source, | |||
73 | 73 | ||
74 | void __kvm_apic_update_irr(u32 *pir, void *regs); | 74 | void __kvm_apic_update_irr(u32 *pir, void *regs); |
75 | void kvm_apic_update_irr(struct kvm_vcpu *vcpu, u32 *pir); | 75 | void kvm_apic_update_irr(struct kvm_vcpu *vcpu, u32 *pir); |
76 | void kvm_apic_update_ppr(struct kvm_vcpu *vcpu); | ||
76 | int kvm_apic_set_irq(struct kvm_vcpu *vcpu, struct kvm_lapic_irq *irq, | 77 | int kvm_apic_set_irq(struct kvm_vcpu *vcpu, struct kvm_lapic_irq *irq, |
77 | struct dest_map *dest_map); | 78 | struct dest_map *dest_map); |
78 | int kvm_apic_local_deliver(struct kvm_lapic *apic, int lvt_type); | 79 | int kvm_apic_local_deliver(struct kvm_lapic *apic, int lvt_type); |
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index d2fe3a51876c..94fda2010f5f 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -6152,7 +6152,7 @@ static int handle_wrmsr(struct kvm_vcpu *vcpu) | |||
6152 | 6152 | ||
6153 | static int handle_tpr_below_threshold(struct kvm_vcpu *vcpu) | 6153 | static int handle_tpr_below_threshold(struct kvm_vcpu *vcpu) |
6154 | { | 6154 | { |
6155 | kvm_make_request(KVM_REQ_EVENT, vcpu); | 6155 | kvm_apic_update_ppr(vcpu); |
6156 | return 1; | 6156 | return 1; |
6157 | } | 6157 | } |
6158 | 6158 | ||