All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] genirq: Retain depth for managed IRQs across CPU hotplug
@ 2025-05-14 20:13 Brian Norris
  2025-05-14 20:13 ` [PATCH v2 1/2] " Brian Norris
  2025-05-14 20:13 ` [PATCH v2 2/2] genirq: Add kunit tests for depth counts Brian Norris
  0 siblings, 2 replies; 21+ messages in thread
From: Brian Norris @ 2025-05-14 20:13 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Tsai Sung-Fu, Douglas Anderson, linux-kernel, Brian Norris

v1:
 https://lore.kernel.org/lkml/20250513224402.864767-1-briannorris@chromium.org/
 [PATCH 0/2] genirq: Retain disable-depth across irq_{shutdown,startup}()

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 incorporate a fix suggested by Thomas Gleixner in patch 1, and provide
some new kunit test cases for this area in patch 2.

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 would
probably need to be reconciled in some way.

Changes in v2:
 * Adapt Thomas Gleixner's alternative solution, to focus only on CPU
   hotplug cases
 * add request_irq()/disable_irq()/free_irq()/request_irq() test
   sequence
 * clean up more resources in tests
 * move tests to patch 2 (i.e., after bugs are fixed and tests pass)
 * adapt to irq_startup_managed() (new API)

Brian Norris (2):
  genirq: Retain depth for managed IRQs across CPU hotplug
  genirq: Add kunit tests for depth counts

 kernel/irq/Kconfig      |  11 ++
 kernel/irq/Makefile     |   1 +
 kernel/irq/chip.c       |  22 +++-
 kernel/irq/cpuhotplug.c |   2 +-
 kernel/irq/internals.h  |   1 +
 kernel/irq/irq_test.c   | 229 ++++++++++++++++++++++++++++++++++++++++
 6 files changed, 264 insertions(+), 2 deletions(-)
 create mode 100644 kernel/irq/irq_test.c

-- 
2.49.0.1045.g170613ef41-goog


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

end of thread, other threads:[~2025-06-19  8:32 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-14 20:13 [PATCH v2 0/2] genirq: Retain depth for managed IRQs across CPU hotplug Brian Norris
2025-05-14 20:13 ` [PATCH v2 1/2] " Brian Norris
2025-05-15 14:51   ` [tip: irq/core] genirq: Retain disable depth for managed interrupts " tip-bot2 for Brian Norris
2025-06-06 12:21   ` [PATCH v2 1/2] genirq: Retain depth for managed IRQs " Aleksandrs Vinarskis
2025-06-09 17:13     ` Brian Norris
2025-06-09 18:19       ` Aleksandrs Vinarskis
2025-06-10 20:07         ` Brian Norris
2025-06-11  6:50           ` Thomas Gleixner
2025-06-11  8:50             ` Thomas Gleixner
2025-06-11 18:51               ` Brian Norris
2025-06-11  6:56           ` Aleksandrs Vinarskis
2025-06-11 19:08             ` Brian Norris
2025-06-12 18:40               ` Brian Norris
2025-06-18 10:17                 ` Johan Hovold
2025-06-18 17:10                   ` Brian Norris
2025-06-19  8:32                     ` Johan Hovold
2025-05-14 20:13 ` [PATCH v2 2/2] genirq: Add kunit tests for depth counts Brian Norris
2025-05-15 14:01   ` kernel test robot
2025-05-15 17:21     ` Brian Norris
2025-05-15 22:24       ` Thomas Gleixner
2025-05-15 14:51   ` [tip: irq/core] genirq: Add kunit tests for disable " tip-bot2 for 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.