Skip to content

Commit a76beb1

Browse files
awilliamavikivity
authored andcommitted
KVM: Fix device assignment threaded irq handler
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 <[email protected]> Signed-off-by: Alex Williamson <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
1 parent 055c9fa commit a76beb1

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

virt/kvm/assigned-dev.c

+13-2
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,11 @@ static int assigned_device_enable_host_intx(struct kvm *kvm,
334334
}
335335

336336
#ifdef __KVM_HAVE_MSI
337+
static irqreturn_t kvm_assigned_dev_msi(int irq, void *dev_id)
338+
{
339+
return IRQ_WAKE_THREAD;
340+
}
341+
337342
static int assigned_device_enable_host_msi(struct kvm *kvm,
338343
struct kvm_assigned_dev_kernel *dev)
339344
{
@@ -346,7 +351,7 @@ static int assigned_device_enable_host_msi(struct kvm *kvm,
346351
}
347352

348353
dev->host_irq = dev->dev->irq;
349-
if (request_threaded_irq(dev->host_irq, NULL,
354+
if (request_threaded_irq(dev->host_irq, kvm_assigned_dev_msi,
350355
kvm_assigned_dev_thread_msi, 0,
351356
dev->irq_name, dev)) {
352357
pci_disable_msi(dev->dev);
@@ -358,6 +363,11 @@ static int assigned_device_enable_host_msi(struct kvm *kvm,
358363
#endif
359364

360365
#ifdef __KVM_HAVE_MSIX
366+
static irqreturn_t kvm_assigned_dev_msix(int irq, void *dev_id)
367+
{
368+
return IRQ_WAKE_THREAD;
369+
}
370+
361371
static int assigned_device_enable_host_msix(struct kvm *kvm,
362372
struct kvm_assigned_dev_kernel *dev)
363373
{
@@ -374,7 +384,8 @@ static int assigned_device_enable_host_msix(struct kvm *kvm,
374384

375385
for (i = 0; i < dev->entries_nr; i++) {
376386
r = request_threaded_irq(dev->host_msix_entries[i].vector,
377-
NULL, kvm_assigned_dev_thread_msix,
387+
kvm_assigned_dev_msix,
388+
kvm_assigned_dev_thread_msix,
378389
0, dev->irq_name, dev);
379390
if (r)
380391
goto err;

0 commit comments

Comments
 (0)