lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d9bbedd0-b31e-4803-a070-ccb58e3186a0@nokia.com>
Date: Thu, 24 Jul 2025 18:07:50 +0200
From: Wladislav Wiebe <wladislav.wiebe@...ia.com>
To: Thomas Gleixner <tglx@...utronix.de>, Jiri Slaby <jirislaby@...nel.org>,
 corbet@....net
Cc: akpm@...ux-foundation.org, paulmck@...nel.org, rostedt@...dmis.org,
 Neeraj.Upadhyay@....com, david@...hat.com, bp@...en8.de, arnd@...db.de,
 fvdl@...gle.com, linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
 peterz@...radead.org
Subject: Re: [PATCH v3] genirq: add support for warning on long-running IRQ
 handlers


On 24/07/2025 11:47, Thomas Gleixner wrote:
> On Thu, Jul 24 2025 at 07:18, Jiri Slaby wrote:
>
>> On 23. 07. 25, 20:28, 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.
>> ...> +static inline void irqhandler_duration_check(u64 ts_start,
>> unsigned int irq,
>>> +                                         const struct irqaction *action)
>>> +{
>>> +    /* Approx. conversion to microseconds */
>>> +    u64 delta_us = (local_clock() - ts_start) >> 10;
>> Is this a microoptimization -- have you measured what speedup does it
>> bring? IOW is it worth it instead of cleaner "/ NSEC_PER_USEC"?
> A 64-bit division is definitely more expensive than a shift operation
> and on 32-bit w/o a 64-bit divide instruction it's more than horribly
> slow.
>
>> Or instead, you could store the diff in irqhandler_duration_threshold_ns
>> (mind that "_ns") and avoid the shift and div completely.
> That's the right thing to do. The setup code can do a *1000 and be done.

Excellent optimization proposal! It has been included in v4: https://lore.kernel.org/lkml/20250724155059.2992-1-wladislav.wiebe@nokia.com/ Thanks, - W.W.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ