summaryrefslogtreecommitdiffstats
path: root/kernel/time
diff options
context:
space:
mode:
authorAnna-Maria Behnsen <anna-maria@linutronix.de>2023-12-01 10:26:27 +0100
committerThomas Gleixner <tglx@linutronix.de>2023-12-20 16:49:38 +0100
commitb573c73101d8786446535b2ab28cbc8907bda9a9 (patch)
treee140e5e762cd980d96d58917cd4f89bde21303e1 /kernel/time
parentdbcdcb62b59db2cf6a24113873b90da15c6f0b19 (diff)
downloadlinux-b573c73101d8786446535b2ab28cbc8907bda9a9.tar.gz
linux-b573c73101d8786446535b2ab28cbc8907bda9a9.tar.bz2
linux-b573c73101d8786446535b2ab28cbc8907bda9a9.zip
tracing/timers: Add tracepoint for tracking timer base is_idle flag
When debugging timer code the timer tracepoints are very important. There is no tracepoint when the is_idle flag of the timer base changes. Instead of always adding manually trace_printk(), add tracepoints which can be easily enabled whenever required. Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Frederic Weisbecker <frederic@kernel.org> Link: https://lore.kernel.org/r/20231201092654.34614-6-anna-maria@linutronix.de
Diffstat (limited to 'kernel/time')
-rw-r--r--kernel/time/timer.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index a81d793a43d0..ed8d6063d9ef 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -1950,7 +1950,10 @@ u64 get_next_timer_interrupt(unsigned long basej, u64 basem)
if (time_before_eq(nextevt, basej)) {
expires = basem;
- base->is_idle = false;
+ if (base->is_idle) {
+ base->is_idle = false;
+ trace_timer_base_idle(false, base->cpu);
+ }
} else {
if (base->timers_pending)
expires = basem + (u64)(nextevt - basej) * TICK_NSEC;
@@ -1961,8 +1964,10 @@ u64 get_next_timer_interrupt(unsigned long basej, u64 basem)
* logic is only maintained for the BASE_STD base, deferrable
* timers may still see large granularity skew (by design).
*/
- if ((expires - basem) > TICK_NSEC)
+ if ((expires - basem) > TICK_NSEC && !base->is_idle) {
base->is_idle = true;
+ trace_timer_base_idle(true, base->cpu);
+ }
}
raw_spin_unlock(&base->lock);
@@ -1984,7 +1989,10 @@ void timer_clear_idle(void)
* sending the IPI a few instructions smaller for the cost of taking
* the lock in the exit from idle path.
*/
- base->is_idle = false;
+ if (base->is_idle) {
+ base->is_idle = false;
+ trace_timer_base_idle(false, smp_processor_id());
+ }
}
#endif