• Lukas Wunner's avatar
    pinctrl: bcm2835: Use raw spinlock for RT compatibility · 9d9fcc11
    Lukas Wunner authored
    [ Upstream commit 3c7b30f7 ]
    
    The BCM2835 pinctrl driver acquires a spinlock in its ->irq_enable,
    ->irq_disable and ->irq_set_type callbacks.  Spinlocks become sleeping
    locks with CONFIG_PREEMPT_RT_FULL=y, therefore invocation of one of the
    callbacks in atomic context may cause a hard lockup if at least two GPIO
    pins in the same bank are used as interrupts.  The issue doesn't occur
    with just a single interrupt pin per bank because the lock is never
    contended.  I'm experiencing such lockups with GPIO 8 and 28 used as
    level-triggered interrupts, i.e. with ->irq_disable being invoked on
    reception of every IRQ.
    
    The critical section protected by the spinlock is very small (one bitop
    and one RMW of an MMIO register), hence converting to a raw spinlock
    seems a better trade-off than converting the driver to threaded IRQ
    handling (which would increase latency to handle an interrupt).
    
    Cc: Mathias Duckeck <m.duckeck@kunbus.de>
    Signed-off-by: default avatarLukas Wunner <lukas@wunner.de>
    Acked-by: default avatarJulia Cartwright <julia@ni.com>
    Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
    Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
    9d9fcc11
pinctrl-bcm2835.c 28.8 KB