From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [PATCH] kvm: dont clear TMR on EOI Date: Wed, 11 Apr 2012 23:03:18 -0300 Message-ID: <20120412020318.GA3037@amt.cnet> References: <20120411154953.GA24008@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, Avi Kivity , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org To: "Michael S. Tsirkin" , Gleb Natapov Return-path: Content-Disposition: inline In-Reply-To: <20120411154953.GA24008@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On Wed, Apr 11, 2012 at 06:49:55PM +0300, Michael S. Tsirkin wrote: > Intel spec says that TMR needs to be set/cleared > when IRR is set, but kvm also clears it on EOI. > > I did some tests on a real (AMD based) system, > and I see same TMR values both before > and after EOI, so I think it's a minor bug in kvm. > > This patch fixes TMR to be set/cleared on IRR set > only as per spec. > > And now that we don't clear TMR, we can save > an atomic read of TMR on EOI that's not propagated > to ioapic, by checking whether ioapic needs > a specific vector first and calculating > the mode afterwards. > > Signed-off-by: Michael S. Tsirkin > --- > arch/x86/kvm/lapic.c | 19 +++++++++++++------ > virt/kvm/ioapic.c | 10 +++++++--- > virt/kvm/ioapic.h | 1 + > 3 files changed, 21 insertions(+), 9 deletions(-) Looks OK, ioapic_service -> accept_apic_irq will set TMR again if IRR is raised. Gleb, can you review please?