]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
PCI/MSI: Set IRQCHIP_ONESHOT_SAFE for PCI-MSI irqchips
authorHeiner Kallweit <hkallweit1@gmail.com>
Sun, 5 Aug 2018 20:31:03 +0000 (22:31 +0200)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 14 Aug 2018 21:11:02 +0000 (16:11 -0500)
If flag IRQCHIP_ONESHOT_SAFE isn't set for an irqchip and we have a
threaded interrupt with no primary handler, flag IRQF_ONESHOT needs to be
set for the interrupt, causing some overhead in the threaded interrupt
handler.  For more detailed explanation also check following comment in
__setup_irq():

  The interrupt was requested with handler = NULL, so we use the default
  primary handler for it. But it does not have the oneshot flag set.  In
  combination with level interrupts this is deadly, because the default
  primary handler just wakes the thread, then the irq lines is reenabled,
  but the device still has the level irq asserted.  Rinse and repeat....

  While this works for edge type interrupts, we play it safe and reject
  unconditionally because we can't say for sure which type this interrupt
  really has.  The type flags are unreliable as the underlying chip
  implementation can override them.

Another comment in __setup_irq() gives a hint already that this
overhead can be avoided for PCI-MSI:

  Some irq chips like MSI based interrupts are per se one shot safe.  Check
  the chip flags, so we can avoid the unmask dance at the end of the
  threaded handler for those.

Following this let's mark all PCI-MSI irqchips as oneshot-safe.

See also discussion here:
https://lkml.kernel.org/r/alpine.DEB.2.21.1808032136490.1658@nanos.tec.linutronix.de

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/msi.c

index 4d88afdfc8433ca159deefc544657f29d1a168b4..f2ef896464b376077462c53315533a555cf0198d 100644 (file)
@@ -1446,6 +1446,9 @@ struct irq_domain *pci_msi_create_irq_domain(struct fwnode_handle *fwnode,
        if (IS_ENABLED(CONFIG_GENERIC_IRQ_RESERVATION_MODE))
                info->flags |= MSI_FLAG_MUST_REACTIVATE;
 
+       /* PCI-MSI is oneshot-safe */
+       info->chip->flags |= IRQCHIP_ONESHOT_SAFE;
+
        domain = msi_create_irq_domain(fwnode, info, parent);
        if (!domain)
                return NULL;