From: Jiri Slaby <jirislaby@kernel.org>
To: Wladislav Wiebe <wladislav.wiebe@nokia.com>,
tglx@linutronix.de, corbet@lwn.net
Cc: akpm@linux-foundation.org, paulmck@kernel.org,
rostedt@goodmis.org, Neeraj.Upadhyay@amd.com, david@redhat.com,
bp@alien8.de, arnd@arndb.de, fvdl@google.com,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
peterz@infradead.org
Subject: Re: [PATCH v3] genirq: add support for warning on long-running IRQ handlers
Date: Thu, 24 Jul 2025 07:30:57 +0200 [thread overview]
Message-ID: <cd9f9c65-4416-4a9e-91e7-572bc25266f9@kernel.org> (raw)
In-Reply-To: <aeeb783d-d921-450c-885d-c8e8b328f81b@kernel.org>
On 24. 07. 25, 7: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"?
>
> Or instead, you could store the diff in irqhandler_duration_threshold_ns
> (mind that "_ns") and avoid the shift and div completely.
>
> And what about the wrap? Don't you need abs_diff()?
Not that ^^^, it won't work, but something else. But if I am counting
correctly, the wrap is in 584 years if counted from 0. Well, for
native/tsc, "Intel guarantees that the time-stamp counter will not
wraparound within 10 years after being reset". I have no idea what
virtualizations return to local_clock(). This is not my call to decide,
though.
> thanks,
--
js
suse labs
next prev parent reply other threads:[~2025-07-24 5:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-23 18:28 Wladislav Wiebe
2025-07-24 5:18 ` Jiri Slaby
2025-07-24 5:30 ` Jiri Slaby [this message]
2025-07-24 9:47 ` Thomas Gleixner
2025-07-24 16:07 ` Wladislav Wiebe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cd9f9c65-4416-4a9e-91e7-572bc25266f9@kernel.org \
--to=jirislaby@kernel.org \
--cc=Neeraj.Upadhyay@amd.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=bp@alien8.de \
--cc=corbet@lwn.net \
--cc=david@redhat.com \
--cc=fvdl@google.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=wladislav.wiebe@nokia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®