Re: [PATCH RFC] kvm: fast-path msi injection with irqfd

From: Gleb Natapov
Date: Thu Nov 18 2010 - 05:04:48 EST


On Thu, Nov 18, 2010 at 11:34:26AM +0200, Michael S. Tsirkin wrote:
> > > @@ -125,10 +129,18 @@ irqfd_wakeup(wait_queue_t *wait, unsigned mode, int sync, void *key)
> > > {
> > > struct _irqfd *irqfd = container_of(wait, struct _irqfd, wait);
> > > unsigned long flags = (unsigned long)key;
> > > + struct kvm_kernel_irq_routing_entry *irq;
> > >
> > > - if (flags & POLLIN)
> > > + if (flags & POLLIN) {
> > > + rcu_read_lock();
> > > + irq = irqfd->irq_entry;
> > Why not rcu_dereference()?
>
> Of course. Good catch, thanks.
>
> > And why it can't be zero here?
>
> It can, I check below.
>
Yeah, missed that. Thanks.

> > > /* An event has been signaled, inject an interrupt */
> > > - schedule_work(&irqfd->inject);
> > > + if (irq)
> > > + kvm_set_msi(irq, irqfd->kvm, KVM_USERSPACE_IRQ_SOURCE_ID, 1);
> > > + else
> > > + schedule_work(&irqfd->inject);
> > > + rcu_read_unlock();
> > > + }
> > >

--
Gleb.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/