KVM: vmx: speed up TPR below threshold vmexits
authorPaolo Bonzini <pbonzini@redhat.com>
Sun, 18 Dec 2016 13:02:21 +0000 (14:02 +0100)
committerRadim Krčmář <rkrcmar@redhat.com>
Mon, 9 Jan 2017 13:48:00 +0000 (14:48 +0100)
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>
arch/x86/kvm/lapic.c
arch/x86/kvm/lapic.h
arch/x86/kvm/vmx.c

index 7e9ac4606279a913a0f7d7cb8a9118b5f4a96985..6b1d3a76c1d0c50a0a03722e99e436de0227ec0b 100644 (file)
@@ -595,6 +595,12 @@ static void apic_update_ppr(struct kvm_lapic *apic)
        }
 }
 
+void kvm_apic_update_ppr(struct kvm_vcpu *vcpu)
+{
+       apic_update_ppr(vcpu->arch.apic);
+}
+EXPORT_SYMBOL_GPL(kvm_apic_update_ppr);
+
 static void apic_set_tpr(struct kvm_lapic *apic, u32 tpr)
 {
        kvm_lapic_set_reg(apic, APIC_TASKPRI, tpr);
index cb16e6fd23301fbedc8330a91fd4509fd2b1e87b..5b5b1ba644cb81f18355f613dac19c1bbacda136 100644 (file)
@@ -73,6 +73,7 @@ bool kvm_apic_match_dest(struct kvm_vcpu *vcpu, struct kvm_lapic *source,
 
 void __kvm_apic_update_irr(u32 *pir, void *regs);
 void kvm_apic_update_irr(struct kvm_vcpu *vcpu, u32 *pir);
+void kvm_apic_update_ppr(struct kvm_vcpu *vcpu);
 int kvm_apic_set_irq(struct kvm_vcpu *vcpu, struct kvm_lapic_irq *irq,
                     struct dest_map *dest_map);
 int kvm_apic_local_deliver(struct kvm_lapic *apic, int lvt_type);
index d2fe3a51876cdada1f4619eb3984cdf9cab6c8fa..94fda2010f5f29611b2cc39bfcbb4daa1b9f0bf0 100644 (file)
@@ -6152,7 +6152,7 @@ static int handle_wrmsr(struct kvm_vcpu *vcpu)
 
 static int handle_tpr_below_threshold(struct kvm_vcpu *vcpu)
 {
-       kvm_make_request(KVM_REQ_EVENT, vcpu);
+       kvm_apic_update_ppr(vcpu);
        return 1;
 }