lkml.org 
[lkml]   [2012]   [Jul]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v5 1/4] kvm: Extend irqfd to support level interrupts
On Wed, Jul 18, 2012 at 02:22:19PM +0300, Michael S. Tsirkin wrote:
> > > > > > > So as was discussed kvm_set_irq under spinlock is bad for scalability
> > > > > > > with multiple VCPUs. Why do we need a spinlock simply to protect
> > > > > > > level_asserted? Let's use an atomic test and set/test and clear and the
> > > > > > > problem goes away.
> > > > > > >
> > > > > > That sad reality is that for level interrupt we already scan all vcpus
> > > > > > under spinlock.
> > > > >
> > > > > Where?
> > > > >
> > > > ioapic
> > >
> > > $ grep kvm_for_each_vcpu virt/kvm/ioapic.c
> > > $
> > >
> > > ?
> > >
> >
> > Come on Michael. You can do better than grep and actually look at what
> > code does. The code that loops over all vcpus while delivering an irq is
> > in kvm_irq_delivery_to_apic(). Now grep for that.
>
> Hmm, I see, it's actually done for edge if injected from ioapic too,
> right?
>
> So set_irq does a linear scan, and for each matching CPU it calls
> kvm_irq_delivery_to_apic which is another scan?
> So it's actually N^2 worst case for a broadcast?

No it isn't, I misread the code.


Anyway, maybe not trivially but this looks fixable to me: we could drop
the ioapic lock before calling kvm_irq_delivery_to_apic.

> > --
> > Gleb.


\
 
 \ /
  Last update: 2012-07-18 14:01    [from the cache]
©2003-2011 Jasper Spaans