]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
genirq: Move irq resource handling out of spinlocked region
authorThomas Gleixner <tglx@linutronix.de>
Thu, 29 Jun 2017 21:33:38 +0000 (23:33 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 4 Jul 2017 10:46:16 +0000 (12:46 +0200)
commit46e48e257360f0845fe17089713cbad4db611e70
treebd2a904fb949d135cf8bd09964fe734a1d9138e1
parent9114014cf4e6df0b22d764380ae1fc54f1a7a8b2
genirq: Move irq resource handling out of spinlocked region

Aside of being conceptually wrong, there is also an actual (hard to
trigger and mostly theoretical) problem.

CPU0 CPU1
free_irq(X) interrupt X
spin_lock(desc->lock)
wake irq thread()
spin_unlock(desc->lock)
spin_lock(desc->lock)
remove action()
shutdown_irq()
release_resources() thread_handler()
spin_unlock(desc->lock)   access released resources.

synchronize_irq()

Move the release resources invocation after synchronize_irq() so it's
guaranteed that the threaded handler has finished.

Move the resource request call out of the desc->lock held region as well,
so the invocation context is the same for both request and release.

This solves the problems with those functions on RT as well.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: Julia Cartwright <julia@ni.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Brian Norris <briannorris@chromium.org>
Cc: Doug Anderson <dianders@chromium.org>
Cc: linux-rockchip@lists.infradead.org
Cc: John Keeping <john@metanate.com>
Cc: linux-gpio@vger.kernel.org
Link: http://lkml.kernel.org/r/20170629214344.117028181@linutronix.de
kernel/irq/manage.c