[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250513224402.864767-1-briannorris@chromium.org>
Date: Tue, 13 May 2025 15:42:36 -0700
From: Brian Norris <briannorris@...omium.org>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: Douglas Anderson <dianders@...omium.org>,
Tsai Sung-Fu <danielsftsai@...gle.com>,
linux-kernel@...r.kernel.org,
Brian Norris <briannorris@...omium.org>
Subject: [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 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
Powered by blists - more mailing lists