Re: [RFC PATCH 4/5] APIC/IOAPIC EOI callback

Alex Williamson
2010-07-11T21:59:20Z

On Sun, 2010-07-11 at 23:12 +0300, Michael S. Tsirkin wrote:
> On Sun, Jul 11, 2010 at 02:03:34PM -0600, Alex Williamson wrote:
> > > What about threaded interrupts?
>
> Just to make the point, imagine a nested virt situation
> which uses current kvm device assignment in guest.
> Look at the interrupt handler we have there.

Is the problem you're worried about this:

guest masks qemu ioapic rte
device interrupt
host vfio DisINTx+
qemu vfio calls qemu_set_irq
...

In that case, the qemu ioapic irr bit is only toggled by qemu_set_irq
for level triggered interrupts, so the interrupt will be asserted in the
guest when it gets unmasked and we'll get the eoi.

I can't figure out where your other scenario can leave the DisINTx+:

device asserts interrupt
a) DisINTx+ via host vfio
guest disables interrupt
b) DisINTx+ via guest, already set
eoi
c) DisINTx- via qemu vfio
driver clears interrupt
guest enables interrupt
d) DisINTx- via guest
device asserts interrupt

So between c) & d) we're potentially getting more interrupts than we
want, but I can't see anywhere that we drop DisINTx. If you have a
scenario, let me know. Thanks,

Alex