From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: [patch 2/8] KVM: move lapic timer ack to EOI handler Date: Sun, 05 Jul 2009 22:55:13 -0300 Message-ID: <20090706015812.572925843@localhost.localdomain> References: <20090706015511.923596553@localhost.localdomain> Cc: Marcelo Tosatti To: kvm@vger.kernel.org Return-path: Received: from mx2.redhat.com ([66.187.237.31]:39619 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753216AbZGFUBV (ORCPT ); Mon, 6 Jul 2009 16:01:21 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n66K1PYL013633 for ; Mon, 6 Jul 2009 16:01:25 -0400 Content-Disposition: inline; filename=kvm-timer-lapic-ack Sender: kvm-owner@vger.kernel.org List-ID: lapic timer is acked on interrupt injection, move it to EOI handler. Signed-off-by: Marcelo Tosatti Index: kvm-new/arch/x86/kvm/lapic.c =================================================================== --- kvm-new.orig/arch/x86/kvm/lapic.c +++ kvm-new/arch/x86/kvm/lapic.c @@ -427,6 +427,7 @@ int kvm_apic_compare_prio(struct kvm_vcp static void apic_set_eoi(struct kvm_lapic *apic) { int vector = apic_find_highest_isr(apic); + int lvt_vector = apic_get_reg(apic, APIC_LVTT) & APIC_VECTOR_MASK; int trigger_mode; /* * Not every write EOI will has corresponding ISR, @@ -435,6 +436,9 @@ static void apic_set_eoi(struct kvm_lapi if (vector == -1) return; + if (vector == lvt_vector) + kvm_timer_ack(&apic->lapic_timer); + apic_clear_vector(vector, apic->regs + APIC_ISR); apic_update_ppr(apic); @@ -982,10 +986,8 @@ void kvm_inject_apic_timer_irqs(struct k { struct kvm_lapic *apic = vcpu->arch.apic; - if (apic && kvm_timer_has_pending(&apic->lapic_timer)) { - if (kvm_apic_local_deliver(apic, APIC_LVTT)) - kvm_timer_ack(&apic->lapic_timer); - } + if (apic && kvm_timer_has_pending(&apic->lapic_timer)) + kvm_apic_local_deliver(apic, APIC_LVTT); } int kvm_get_apic_interrupt(struct kvm_vcpu *vcpu) --