Re: [PATCH v4 4/9] KVM: Switch assigned device IRQ forwarding to threaded handler

Avi Kivity
2010-11-09T12:26:46Z

On 11/08/2010 01:21 PM, Jan Kiszka wrote:
> This improves the IRQ forwarding for assigned devices: By using the
> kernel's threaded IRQ scheme, we can get rid of the latency-prone work
> queue and simplify the code in the same run.
>
> Moreover, we no longer have to hold assigned_dev_lock while raising the
> guest IRQ, which can be a lenghty operation as we may have to iterate
> over all VCPUs. The lock is now only used for synchronizing masking vs.
> unmasking of INTx-type IRQs, thus is renames to intx_lock.

Nice stuff.

>
> -#define KVM_ASSIGNED_MSIX_PENDING 0x1
> -struct kvm_guest_msix_entry {
> - u32 vector;
> - u16 entry;
> - u16 flags;
> -};
> -

Ok, so .flags was used to handle the delay between the interrupt handler
and the work queue, which is now done automatically by threaded
interrupts. Good.

> @@ -313,10 +276,10 @@ static int assigned_device_enable_host_msix(struct kvm *kvm,
> return r;
>
> for (i = 0; i< dev->entries_nr; i++) {
> - r = request_irq(dev->host_msix_entries[i].vector,
> - kvm_assigned_dev_intr, 0,
> - "kvm_assigned_msix_device",
> - (void *)dev);
> + r = request_threaded_irq(dev->host_msix_entries[i].vector,
> + NULL, kvm_assigned_dev_thread,
> + 0, "kvm_assigned_msix_device",
> + (void *)dev);
> if (r)
> goto err;
> }

Should eventually be done from interrupt context. msix delivery only
needs a routing table lookup and smp reschedule IPI, which can be done
from interrupt context.

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