public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Gleb Natapov <gleb@redhat.com>, kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: avoid taking ioapic mutex for non-ioapic EOIs
Date: Mon, 28 Dec 2009 22:47:20 +0200	[thread overview]
Message-ID: <4B391958.8090602@redhat.com> (raw)
In-Reply-To: <20091228203757.GA20508@amt.cnet>

On 12/28/2009 10:37 PM, Marcelo Tosatti wrote:
> On Mon, Dec 28, 2009 at 02:08:30PM +0200, Avi Kivity wrote:
>    
>> When the guest acknowledges an interrupt, it sends an EOI message to the local
>> apic, which broadcasts it to the ioapic.  To handle the EOI, we need to take
>> the ioapic mutex.
>>
>> On large guests, this causes a lot of contention on this mutex.  Since large
>> guests usually don't route interrupts via the ioapic (they use msi instead),
>> this is completely unnecessary.
>>
>> Avoid taking the mutex by introducing a handled_vectors bitmap.  Before taking
>> the mutex, check if the ioapic was actually responsible for the acked vector.
>> If not, we can return early.
>>      
> Can't you skip IOAPIC EOI for edge triggered interrupts (in the LAPIC
> code), instead?
>    

That's a lot cleaner, yes.  Indeed there's the TMR which holds this 
info.  Gleb suggested doing this in the local apic but we didn't think 
of using the TMR.

There's a small race there - the TMR is set after the IRR, so the 
interrupt can be injected and acked before the TMR is updated, but that 
can be fixed by switching the order.

But what about kvm_notify_acked_irq() in __kvm_ioapic_update_eoi()?

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.


  reply	other threads:[~2009-12-28 20:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-28 12:08 [PATCH] KVM: avoid taking ioapic mutex for non-ioapic EOIs Avi Kivity
2009-12-28 20:37 ` Marcelo Tosatti
2009-12-28 20:47   ` Avi Kivity [this message]
2009-12-28 21:30     ` Marcelo Tosatti
2009-12-29 10:35       ` Avi Kivity
2009-12-29 16:59         ` Marcelo Tosatti

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B391958.8090602@redhat.com \
    --to=avi@redhat.com \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox