Skip to content

Commit

Permalink
KVM: Fix device assignment threaded irq handler
Browse files Browse the repository at this point in the history
The kernel no longer allows us to pass NULL for the hard handler
without also specifying IRQF_ONESHOT.  IRQF_ONESHOT imposes latency
in the exit path that we don't need for MSI interrupts.  Long term
we'd like to inject these interrupts from the hard handler when
possible.  In the short term, we can create dummy hard handlers
that return us to the previous behavior.  Credit to Michael for
original patch.

Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=43328

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
  • Loading branch information
Alex Williamson authored and Avi Kivity committed Jul 11, 2012
1 parent 055c9fa commit a76beb1
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions virt/kvm/assigned-dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,11 @@ static int assigned_device_enable_host_intx(struct kvm *kvm,
}

#ifdef __KVM_HAVE_MSI
static irqreturn_t kvm_assigned_dev_msi(int irq, void *dev_id)
{
return IRQ_WAKE_THREAD;
}

static int assigned_device_enable_host_msi(struct kvm *kvm,
struct kvm_assigned_dev_kernel *dev)
{
Expand All @@ -346,7 +351,7 @@ static int assigned_device_enable_host_msi(struct kvm *kvm,
}

dev->host_irq = dev->dev->irq;
if (request_threaded_irq(dev->host_irq, NULL,
if (request_threaded_irq(dev->host_irq, kvm_assigned_dev_msi,
kvm_assigned_dev_thread_msi, 0,
dev->irq_name, dev)) {
pci_disable_msi(dev->dev);
Expand All @@ -358,6 +363,11 @@ static int assigned_device_enable_host_msi(struct kvm *kvm,
#endif

#ifdef __KVM_HAVE_MSIX
static irqreturn_t kvm_assigned_dev_msix(int irq, void *dev_id)
{
return IRQ_WAKE_THREAD;
}

static int assigned_device_enable_host_msix(struct kvm *kvm,
struct kvm_assigned_dev_kernel *dev)
{
Expand All @@ -374,7 +384,8 @@ static int assigned_device_enable_host_msix(struct kvm *kvm,

for (i = 0; i < dev->entries_nr; i++) {
r = request_threaded_irq(dev->host_msix_entries[i].vector,
NULL, kvm_assigned_dev_thread_msix,
kvm_assigned_dev_msix,
kvm_assigned_dev_thread_msix,
0, dev->irq_name, dev);
if (r)
goto err;
Expand Down

0 comments on commit a76beb1

Please sign in to comment.