diff options
| author | David Thompson <davthompson@nvidia.com> | 2026-11-13 13:44:44 -0500 |
|---|---|---|
| committer | Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> | 2026-11-17 09:30:24 +0100 |
| commit | f95bdff1d53471159e3c7112c5de4f6240772521 (patch) | |
| tree | 12e80d97cbf66e456ebcb5cf96b5a9d44dbeaa9b /rust/kernel/alloc/allocator | |
| parent | 9e3032dc4d92e6214ae687b4c474de9270ce74a2 (diff) | |
gpio: mlxbf2: Disable interrupts around the chip lock in direction ops
mlxbf2_gpio_lock_acquire() takes the generic GPIO chip lock with
gpio_generic_chip_lock(), a plain raw_spin_lock() that leaves
interrupts enabled. The same lock is also taken with the irqsave
variant by the IRQ callbacks (irq_set_type, irq_enable, irq_disable),
which run with the IRQ descriptor lock held.
This creates a possible deadlock that lockdep reports as an IRQ lock
inversion:
CPU0 CPU1
---- ----
lock(&chip->lock) lock(irq_desc->lock)
<GPIO interrupt> lock(&chip->lock)
lock(irq_desc->lock)
If a GPIO interrupt arrives on CPU0 while it holds the chip lock during
a direction change, the interrupt handler spins on the descriptor lock
that CPU1 holds, while CPU1 spins on the chip lock held by CPU0.
This was seen during probe of pwr-mlxbf. acpi_dev_gpio_irq_get() sets
the pin to input through mlxbf2_gpio_direction_input(), and then
irq_set_irq_type() runs with the descriptor lock held.
Use the irqsave variant for the chip lock in mlxbf2_gpio_lock_acquire()
and its release counterpart, and pass the saved flags from
mlxbf2_gpio_direction_input() and mlxbf2_gpio_direction_output(). This
matches the IRQ callbacks, so interrupts stay disabled for the whole
ModeX update.
Fixes: 2b725265cb08 ("gpio: mlxbf2: Introduce IRQ support")
Cc: stable@vger.kernel.org
Signed-off-by: David Thompson <davthompson@nvidia.com>
Link: https://patch.msgid.link/20261113184444.3431-1-davthompson@nvidia.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Diffstat (limited to 'rust/kernel/alloc/allocator')
0 files changed, 0 insertions, 0 deletions
