From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH] kvm: dont clear TMR on EOI Date: Thu, 12 Apr 2012 14:49:55 +0300 Message-ID: <20120412114955.GI20431@redhat.com> References: <20120411154953.GA24008@redhat.com> <20120412020318.GA3037@amt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: "Michael S. Tsirkin" , kvm@vger.kernel.org, Avi Kivity , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org To: Marcelo Tosatti Return-path: Content-Disposition: inline In-Reply-To: <20120412020318.GA3037@amt.cnet> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On Wed, Apr 11, 2012 at 11:03:18PM -0300, Marcelo Tosatti wrote: > 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? > Looks good to me. -- Gleb.