From patchwork Mon Jul 6 01:55:13 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 34293 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n66K1SfX005446 for ; Mon, 6 Jul 2009 20:01:28 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753615AbZGFUBX (ORCPT ); Mon, 6 Jul 2009 16:01:23 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753562AbZGFUBW (ORCPT ); Mon, 6 Jul 2009 16:01:22 -0400 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 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n66K1Oab028801; Mon, 6 Jul 2009 16:01:24 -0400 Received: from amt.cnet (vpn-51-10.sfbay.redhat.com [10.14.51.10]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n66K1MN8030076; Mon, 6 Jul 2009 16:01:23 -0400 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 8B7705580A3; Mon, 6 Jul 2009 17:00:45 -0300 (BRT) Received: (from marcelo@localhost) by amt.cnet (8.14.3/8.14.3/Submit) id n66K0i7L008091; Mon, 6 Jul 2009 17:00:44 -0300 Message-Id: <20090706015812.572925843@localhost.localdomain> References: <20090706015511.923596553@localhost.localdomain> User-Agent: quilt/0.46-1 Date: Sun, 05 Jul 2009 22:55:13 -0300 From: Marcelo Tosatti To: kvm@vger.kernel.org Cc: Marcelo Tosatti Subject: [patch 2/8] KVM: move lapic timer ack to EOI handler Content-Disposition: inline; filename=kvm-timer-lapic-ack X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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)