• Marc Zyngier's avatar
    irqchip/mips: Fix RCU violation when using irqdomain lookup on interrupt entry · 1fee9db9
    Marc Zyngier authored
    Since d4a45c68 ("irqdomain: Protect the linear revmap with RCU"),
    any irqdomain lookup requires the RCU read lock to be held.
    
    This assumes that the architecture code will be structured such as
    irq_enter() will be called *before* the interrupt is looked up
    in the irq domain. However, this isn't the case for MIPS, and a number
    of drivers are structured to do it the other way around when handling
    an interrupt in their root irqchip (secondary irqchips are OK by
    construction).
    
    This results in a RCU splat on a lockdep-enabled kernel when the kernel
    takes an interrupt from idle, as reported by Guenter Roeck.
    
    Note that this could have fired previously if any driver had used
    tree-based irqdomain, which always had the RCU requirement.
    
    To solve this, provide a MIPS-specific helper (do_domain_IRQ())
    as the pendent of do_IRQ() that will do thing in the right order
    (and maybe save some cycles in the process).
    
    Ideally, MIPS would be moved over to using handle_domain_irq(),
    but that's much more ambitious.
    Reported-by: default avatarGuenter Roeck <linux@roeck-us.net>
    Tested-by: default avatarGuenter Roeck <linux@roeck-us.net>
    [maz: add dependency on CONFIG_IRQ_DOMAIN after report from the kernelci bot]
    Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
    Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
    Cc: Serge Semin <fancer.lancer@gmail.com>
    Link: https://lore.kernel.org/r/20210705172352.GA56304@roeck-us.net
    Link: https://lore.kernel.org/r/20210706110647.3979002-1-maz@kernel.org
    1fee9db9
irq-mips-cpu.c 6.85 KB