lkml.org 
[lkml]   [2012]   [Jul]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v5 1/4] kvm: Extend irqfd to support level interrupts
From
Date
On Wed, 2012-07-18 at 15:42 -0300, Marcelo Tosatti wrote:
> On Wed, Jul 18, 2012 at 06:58:24PM +0300, Michael S. Tsirkin wrote:
> > > > > > > Back to original point though current
> > > > > > > situation is that calling kvm_set_irq() under spinlock is not worse for
> > > > > > > scalability than calling it not under one.
> > > > > >
> > > > > > Yes. Still the specific use can just use an atomic flag,
> > > > > > lock+bool is not needed, and we won't need to undo it later.
> > > > >
> > > > >
> > > > > Actually, no, replacing it with an atomic is racy.
> > > > >
> > > > > CPU0 (inject) CPU1 (EOI)
> > > > > atomic_cmpxchg(&asserted, 0, 1)
> > > > > atomic_cmpxchg(&asserted, 1, 0)
> > > > > kvm_set_irq(0)
> > > > > kvm_set_irq(1)
> > > > > eventfd_signal
> > > > >
> > > > > The interrupt is now stuck on until another interrupt is injected.
> > > > >
> > > >
> > > > Well EOI somehow happened here before interrupt so it's a bug somewhere
> > > > else?
> > >
> > > Interrupts can be shared. We also can't guarantee that the guest won't
> > > write a bogus EOI to the ioapic. The irq ack notifier doesn't filter on
> > > irq source id... I'm not sure it can.
> >
> > I guess if Avi OKs adding another kvm_set_irq under spinlock that's
> > the best we can do for now.
>
> Why can't a mutex be used instead of a spinlock again?

eventfd_signal calls the inject function from atomic context.



\
 
 \ /
  Last update: 2012-07-18 21:41    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site