linux/kernel/irq
Brian Norris 5b65258229 genirq/test: Resolve irq lock inversion warnings
irq_shutdown_and_deactivate() is normally called with the descriptor lock
held, and interrupts disabled. Nested a few levels down, it grabs the
global irq_resend_lock. Lockdep rightfully complains when interrupts are
not disabled:

       CPU0                    CPU1
       ----                    ----
  lock(irq_resend_lock);
                               local_irq_disable();
                               lock(&irq_desc_lock_class);
                               lock(irq_resend_lock);
  <Interrupt>
    lock(&irq_desc_lock_class);

...
   _raw_spin_lock+0x2b/0x40
   clear_irq_resend+0x14/0x70
   irq_shutdown_and_deactivate+0x29/0x80
   irq_shutdown_depth_test+0x1ce/0x600
   kunit_try_run_case+0x90/0x120

Grab the descriptor lock and disable interrupts, to resolve the
problem.

Fixes: 66067c3c8a ("genirq: Add kunit tests for depth counts")
Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/all/aJJONEIoIiTSDMqc@google.com
Closes: https://lore.kernel.org/lkml/31a761e4-8f81-40cf-aaf5-d220ba11911c@roeck-us.net/
2025-08-06 10:29:48 +02:00
..
affinity.c lib/group_cpus: Let group_cpu_evenly() return the number of initialized masks 2025-07-01 10:24:11 -06:00
autoprobe.c genirq/autoprobe: Switch to lock guards 2025-05-07 09:08:11 +02:00
chip.c pci-v6.17-changes 2025-08-01 13:59:07 -07:00
cpuhotplug.c genirq/cpuhotplug: Restore affinity even for suspended IRQ 2025-06-13 15:13:35 +02:00
debug.h
debugfs.c genirq: Bump the size of the local variable for sprintf() 2025-05-15 16:28:09 +02:00
devres.c genirq/devres: Don't free interrupt which is not managed by devres 2024-10-24 11:20:06 +02:00
dummychip.c
generic-chip.c genirq/generic-chip: Fix incorrect lock guard conversions 2025-04-08 22:49:02 +02:00
handle.c
internals.h genirq: Split up irq_pm_check_wakeup() 2025-07-22 14:30:42 +02:00
ipi-mux.c genirq/ipi-mux: Use irq_domain_alloc_irqs() 2023-02-06 17:21:15 +00:00
ipi.c genirq/ipi: Fix NULL pointer deref in irq_data_get_affinity_mask() 2023-02-20 13:53:41 +01:00
irq_sim.c genirq/irq_sim: Initialize work context pointers properly 2025-06-13 15:36:35 +02:00
irq_test.c genirq/test: Resolve irq lock inversion warnings 2025-08-06 10:29:48 +02:00
irqdesc.c genirq/irqdesc: Remove double locking in hwirq_show() 2025-05-21 17:48:23 +02:00
irqdomain.c Networking changes for 6.17. 2025-07-30 08:58:55 -07:00
Kconfig genirq: Add kunit tests for depth counts 2025-06-13 15:24:44 +02:00
kexec.c genirq/kexec: Prevent redundant IRQ masking by checking state before shutdown 2024-12-11 20:32:34 +01:00
Makefile genirq: Add kunit tests for depth counts 2025-06-13 15:24:44 +02:00
manage.c genirq/manage: Use the correct lock guard in irq_set_irq_wake() 2025-05-14 12:05:58 +02:00
matrix.c genirq/matrix: Dynamic bitmap allocation 2024-02-23 10:18:44 +01:00
migration.c genirq/migration: Use irqd_get_parent_data() in irq_force_complete_move() 2025-04-04 17:08:36 +02:00
msi.c irqdomain: Add device pointer to irq_domain_info and msi_domain_info 2025-07-03 15:49:24 +02:00
pm.c genirq: Split up irq_pm_check_wakeup() 2025-07-22 14:30:42 +02:00
proc.c genirq: Consistently use '%u' format specifier for unsigned int variables 2025-05-13 09:43:32 +02:00
resend.c genirq/resend: Switch to lock guards 2025-05-07 09:08:11 +02:00
settings.h genirq: Remove IRQ_MOVE_PCNTXT and related code 2025-01-15 21:38:53 +01:00
spurious.c genirq: Move irq_wait_for_poll() to call site 2025-07-22 14:30:42 +02:00
timings.c genirq/timings: Add kernel-doc for a function parameter 2025-01-15 21:38:53 +01:00