lkml.org 
[lkml]   [2009]   [May]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [KVM PATCH v3 2/2] kvm: add support for irqfd via eventfd-notification interface
Michael S. Tsirkin wrote:
> On Mon, Apr 27, 2009 at 02:33:34PM -0400, Gregory Haskins wrote:
>
>> This allows an eventfd to be registered as an irq source with a guest. Any
>> signaling operation on the eventfd (via userspace or kernel) will inject
>> the registered GSI at the next available window.
>>
>> Signed-off-by: Gregory Haskins <ghaskins@novell.com>
>>
>
> If we ever want to use this with e.g. MSI-X emulation in guest, and want
> to be stricly compliant to MSI-X, we'll need a way for guest to mask
> interrupts, and for host to report that a masked interrupt is pending.
> Ideally, all this will be doable with a couple of mmapped pages to avoid
> vmexits/system calls.
>
>

We could do this in two ways:

- move msix entry emulation into the kernel
- require the device to support replacing its irqfd, and juggle it like so:
- guest disables msi
- replace device model fd with eventfd belonging to us
- when the device fires its eventfd, set the irq pending bit
- guest enables msi
- if the pending bit is set, fire the interrupt?
- replace device model fd with the real irqfd

I'm leaning towards the latter, though it's not an easy call.

>> +static void
>> +irqfd_inject(struct work_struct *work)
>> +{
>> + struct _irqfd *irqfd = container_of(work, struct _irqfd, work);
>> + struct kvm *kvm = irqfd->kvm;
>> +
>> + mutex_lock(&kvm->lock);
>> + kvm_set_irq(kvm, KVM_USERSPACE_IRQ_SOURCE_ID, irqfd->gsi, 1);
>> + kvm_set_irq(kvm, KVM_USERSPACE_IRQ_SOURCE_ID, irqfd->gsi, 0);
>> + mutex_unlock(&kvm->lock);
>>
>
> This will do weird stuff (deliver the irq twice) if the irq is
> MSI/MSI-X. I know this was discussed already and is a temporary
> shortcut, but maybe add a comment that we really want kvm_toggle_irq,
> so that we won't forget?
>

If so, that's a bug. MSI should ignore kvm_set_irq(..., 0).

--
error compiling committee.c: too many arguments to function



\
 
 \ /
  Last update: 2009-05-03 19:03    [W:0.220 / U:0.760 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site