]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mei: vsc: Fix "BUG: Invalid wait context" lockdep error
authorHans de Goede <hansg@kernel.org>
Mon, 23 Jun 2025 08:50:51 +0000 (10:50 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 24 Jun 2025 15:39:02 +0000 (16:39 +0100)
Kernels build with CONFIG_PROVE_RAW_LOCK_NESTING report the following
tp-vsc lockdep error:

=============================
 [ BUG: Invalid wait context ]
 ...
 swapper/10/0 is trying to lock:
 ffff88819c271888 (&tp->xfer_wait){....}-{3:3},
  at: __wake_up (kernel/sched/wait.c:106 kernel/sched/wait.c:127)
 ...
 Call Trace:
 <IRQ>
 ...
 __raw_spin_lock_irqsave (./include/linux/spinlock_api_smp.h:111)
 __wake_up (kernel/sched/wait.c:106 kernel/sched/wait.c:127)
 vsc_tp_isr (drivers/misc/mei/vsc-tp.c:110) mei_vsc_hw
 __handle_irq_event_percpu (kernel/irq/handle.c:158)
 handle_irq_event (kernel/irq/handle.c:195 kernel/irq/handle.c:210)
 handle_edge_irq (kernel/irq/chip.c:833)
 ...
 </IRQ>

The root-cause of this is the IRQF_NO_THREAD flag used by the intel-pinctrl
code. Setting IRQF_NO_THREAD requires all interrupt handlers for GPIO ISRs
to use raw-spinlocks only since normal spinlocks can sleep in PREEMPT-RT
kernels and with IRQF_NO_THREAD the interrupt handlers will always run in
an atomic context [1].

vsc_tp_isr() calls wake_up(&tp->xfer_wait), which uses a regular spinlock,
breaking the raw-spinlocks only rule for Intel GPIO ISRs.

Make vsc_tp_isr() run as threaded ISR instead of as hard ISR to fix this.

Fixes: 566f5ca97680 ("mei: Add transport driver for IVSC device")
Link: https://lore.kernel.org/linux-gpio/18ab52bd-9171-4667-a600-0f52ab7017ac@kernel.org/
Signed-off-by: Hans de Goede <hansg@kernel.org>
Link: https://lore.kernel.org/r/20250623085052.12347-10-hansg@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/mei/vsc-tp.c

index f5ea38f22419a50417cfd18568fa050e843295eb..5ecf99883996bb4e01839ab3e38aa1971da321eb 100644 (file)
@@ -497,7 +497,7 @@ static int vsc_tp_probe(struct spi_device *spi)
        tp->spi = spi;
 
        irq_set_status_flags(spi->irq, IRQ_DISABLE_UNLAZY);
-       ret = request_threaded_irq(spi->irq, vsc_tp_isr, NULL,
+       ret = request_threaded_irq(spi->irq, NULL, vsc_tp_isr,
                                   IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
                                   dev_name(dev), tp);
        if (ret)