Re: [PATCH v4] genirq: add support for warning on long-running IRQ handlers

From: Jiri Slaby
Date: Thu Jul 31 2025 - 03:47:08 EST


On 24. 07. 25, 17:50, Wladislav Wiebe wrote:
Introduce a mechanism to detect and warn about prolonged IRQ handlers.
With a new command-line parameter (irqhandler.duration_warn_us=),
users can configure the duration threshold in microseconds when a warning
in such format should be emitted:

"[CPU14] long duration of IRQ[159:bad_irq_handler [long_irq]], took: 1330 us"

The implementation uses local_clock() to measure the execution duration of the
generic IRQ per-CPU event handler.


This version LGTM

Reviewed-by: Jiri Slaby <jirislaby@xxxxxxxxxx>

--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
...
+static inline void irqhandler_duration_check(u64 ts_start, unsigned int irq,
+ const struct irqaction *action)
+{
+ u64 delta_ns = local_clock() - ts_start;
+
+ if (unlikely(delta_ns > irqhandler_duration_threshold_ns)) {
+ pr_warn_ratelimited("[CPU%u] long duration of IRQ[%u:%ps], took: %llu us\n",
+ smp_processor_id(), irq, action->handler,
+ delta_ns >> 10);

Only that: would the division matter in here? Or print ns? But feel free to ignore this.

thanks,
--
js
suse labs