Re: [KVM PATCH 1/2] KVM: Directly inject interrupts via irqfd

From: Gregory Haskins
Date: Wed Oct 21 2009 - 11:42:32 EST


Gleb Natapov wrote:
> On Wed, Oct 21, 2009 at 11:34:51AM -0400, Gregory Haskins wrote:
>> Gleb Natapov wrote:
>>> On Wed, Oct 21, 2009 at 10:34:53AM -0400, Gregory Haskins wrote:
>>>> IRQFD currently uses a deferred workqueue item to execute the injection
>>>> operation. It was originally designed this way because kvm_set_irq()
>>>> required the caller to hold the irq_lock mutex, and the eventfd callback
>>>> is invoked from within a non-preemptible critical section.
>>>>
>>>> With the advent of lockless injection support in kvm_set_irq, the deferment
>>>> mechanism is no longer technically needed. Since context switching to the
>>>> workqueue is a source of interrupt latency, lets switch to a direct
>>>> method.
>>>>
>>> kvm_set_irq is fully lockless only in MSI case. IOAPIC/PIC has mutexes.
>> Right, but irqfd by design only works with MSI (or MSI like edge
>> triggers) anyway. Legacy-type injections follow a different path.
>>
> Ah, If this the case and it will stay that way then the change looks OK
> to me.


I believe Avi, Michael, et. al. were in agreement with me on that design
choice. I believe the reason is that there is no good way to do EOI/ACK
feedback within the constraints of an eventfd pipe which would be
required for the legacy pin-type interrupts. Therefore, we won't even
bother trying. High-performance subsystems will use irqfd/msi, and
legacy emulation can use the existing injection code (which includes the
necessary feedback for ack/eoi).

To that point, perhaps it should be better documented. If we need a v2,
I will add a comment.

Kind Regards,
-Greg

Attachment: signature.asc
Description: OpenPGP digital signature