Re: [PATCH v2 3/6] hrtimer: Pause KCOV during deferred rearm

Karl Mehltretter <[email protected]>
Newsgroups dev.linux.lists.linux-rt-devel,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Wed, Aug 12, 2026 at 12:21:00PM +0100, Peter Zijlstra wrote:
> > Deferred hrtimer rearm can run after HARDIRQ_OFFSET is dropped. in_task()
> > is then true, so KCOV attributes the instrumented timer-reprogramming
> > subtree to current.
> 
> But that is clearly noinstr code; there should be no kcov calls in
> there.
> 
> If kcov is emitted inside noinstr, then kcov is a broken piece of crap
> and needs to die.
> 
> NAK

Thanks for the review!

By "instrumented" I meant KCOV-instrumented. The selftest callback comes
from __hrtimer_rearm_deferred() in ordinary .text, not .noinstr.text.

On x86, irq_exit_rcu() runs in an instrumentable IDT-entry region.
__irq_exit_rcu() subtracts hardirq offset before calling
hrtimer_rearm_deferred(), so check_kcov_mode() sees in_task() and records
callee coverage for current.

This is the same class of failure as 477d81a1c47a ("x86/entry: Remove
unwanted instrumentation in common_interrupt()"). There the hardirq offset
had not yet been added, here it has already been removed. Its callee
could be inlined. 

Deferred rearm instead reaches shared hrtimer, tick,
clockevent and architecture code. Statically excluding the graph
would be pervasive and also lose coverage from ordinary task context.

Do you want deferred rearm and its complete call graph converted to
noinstr, or merely built without KCOV instrumentation?

Thanks,
Karl
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.