On Wed, Jul 18, 2012 at 03:42:09PM -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? > Why was it changed at the first place? Commit says that the function is called from unsleepable context, but no stack trace. -- Gleb. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html