Re: [RFC PATCH] kvm: Extend irqfd to support level interrupts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2012-06-18 at 13:11 +0300, Michael S. Tsirkin wrote:
> On Mon, Jun 18, 2012 at 12:33:01PM +0300, Avi Kivity wrote:
> > On 06/18/2012 11:52 AM, Jan Kiszka wrote:
> > >> 
> > >> I don't understand how this works.  A level IRQ isn't de-asserted by the
> > >> EOI, it's de-asserted by its source.
> > >> 
> > >> Consider the following sequence:
> > >> 
> > >> device        guest
> > >> 
> > >>   event
> > >>    assert
> > >>               interrupt
> > >>                interrupt handler
> > >>                 handle event
> > >>                 clear ISR bit
> > >>    deassert
> > >>   event
> > >>     assert
> > >>                EOI
> > >> 
> > >> What should happen is that the interrupt will be redelivered
> > >> immmediately after the EOI, but that won't happen with your API since
> > >> the EOI ack notifier will deassert the interrupt and nothing will
> > >> re-assert it.
> > > 
> > > As it's level triggered and we unmask the physical source, another
> > > host-side interrupt will be triggered and then reported to the guest.
> > 
> > That works for real devices.  What about emulated devices
> 
> It's broken for userspace too.  I guess it
> should track the logical state of the device per source id.  On ack, it
> should clear it for assigned devices only, do the
> logical OR over all source IDs and set level to that.

That's basically what it's doing.  Maybe assigned devices are the only
user of this interface, but I'm trying not to make it device assignment
specific.  I'm grabbing a new source id for each user of this interface
specifically so the irqchip just sees it as one of many inputs.

> > (vhost,
> > msi-less ivshmem clone)?
> 
> I guess vhost can poll eventfd and reinject an interrupt.
> Of course to bypass qemu completely we also need to support reads over
> ioeventfd somehow.

If you're going to reinject an interrupt anyway, wouldn't you rather be
told when to do it via an eventfd like this instead of poll?  Thanks,

Alex


--
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


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux