All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] genirq: Retain disable-depth across irq_{shutdown,startup}()
@ 2025-05-13 22:42 Brian Norris
  2025-05-13 22:42 ` [PATCH 1/2] genirq: Add kunit tests for depth counts Brian Norris
  2025-05-13 22:42 ` [PATCH 2/2] genirq: Retain disable depth across irq shutdown/startup Brian Norris
  0 siblings, 2 replies; 8+ messages in thread
From: Brian Norris @ 2025-05-13 22:42 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Douglas Anderson, Tsai Sung-Fu, linux-kernel, Brian Norris

I'm seeing problems in a driver that:
(a) requests an affinity-managed IRQ (struct
    irq_affinity_desc::is_managed == 1);
(b) disables that IRQ (disable_irq()); and
(c) undergoes CPU hotplug for the affined CPU.

When we do the above, the genirq core leaves the IRQ in a different
state than it started -- the kernel IRQ is re-enabled after CPU hot
unplug/plug.

This problem seems to stem from the behavior of irq_shutdown() and
irq_shutdown(): that they assume they always run with an enabled IRQ,
and can simply set depth to 1 and 0 respectively.

I encode my test cases in a few kunit tests in patch 1, and I provide a
blunt attempt at solving the test failures in patch 2. I'm not very
confident in my solution, so please take it with a heavy dose of salt.

Side note: I understand my colleague has reported other issues related
to the same code:
Subject: [PATCH] genirq/PM: Fix IRQCHIP_ENABLE_WAKEUP_ON_SUSPEND if depth > 1
https://lore.kernel.org/lkml/20250512173250.1.If5c00cf9f08732f4af5f104ae59b8785c7f69536@changeid/

We're addressing different problems, but they do happen to hit on some
of the same awkwardness in irq_startup(). These two patches obviously
would need to be reconciled in some way.


Brian Norris (2):
  genirq: Add kunit tests for depth counts
  genirq: Retain disable depth across irq shutdown/startup

 kernel/irq/Kconfig    |  10 +++
 kernel/irq/Makefile   |   1 +
 kernel/irq/chip.c     |   7 +-
 kernel/irq/irq_test.c | 162 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 178 insertions(+), 2 deletions(-)
 create mode 100644 kernel/irq/irq_test.c

-- 
2.49.0.1045.g170613ef41-goog


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-05-14 20:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-13 22:42 [PATCH 0/2] genirq: Retain disable-depth across irq_{shutdown,startup}() Brian Norris
2025-05-13 22:42 ` [PATCH 1/2] genirq: Add kunit tests for depth counts Brian Norris
2025-05-14 15:16   ` kernel test robot
2025-05-14 15:27   ` kernel test robot
2025-05-14 18:05   ` kernel test robot
2025-05-13 22:42 ` [PATCH 2/2] genirq: Retain disable depth across irq shutdown/startup Brian Norris
2025-05-14  7:35   ` Thomas Gleixner
2025-05-14 20:16     ` Brian Norris

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.