Skip to content

Commit dbcdcb6

Browse files
anna-marialxKAGA-KOKO
authored andcommitted
tracing/timers: Enhance timer_start tracepoint
For starting a timer, the timer is enqueued into a bucket of the timer wheel. The bucket expiry is the defacto expiry of the timer but it is not equal the timer expiry because of increasing granularity when bucket is in a higher level of the wheel. To be able to figure out in a trace whether a timer expired in time or not, the bucket expiry time is required as well. Add bucket expiry time to the timer_start tracepoint and thereby simplify the arguments. 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-5-anna-maria@linutronix.de
1 parent cbf04a2 commit dbcdcb6

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

include/trace/events/timer.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,38 +46,38 @@ DEFINE_EVENT(timer_class, timer_init,
4646

4747
/**
4848
* timer_start - called when the timer is started
49-
* @timer: pointer to struct timer_list
50-
* @expires: the timers expiry time
51-
* @flags: the timers flags
49+
* @timer: pointer to struct timer_list
50+
* @bucket_expiry: the bucket expiry time
5251
*/
5352
TRACE_EVENT(timer_start,
5453

5554
TP_PROTO(struct timer_list *timer,
56-
unsigned long expires,
57-
unsigned int flags),
55+
unsigned long bucket_expiry),
5856

59-
TP_ARGS(timer, expires, flags),
57+
TP_ARGS(timer, bucket_expiry),
6058

6159
TP_STRUCT__entry(
6260
__field( void *, timer )
6361
__field( void *, function )
6462
__field( unsigned long, expires )
63+
__field( unsigned long, bucket_expiry )
6564
__field( unsigned long, now )
6665
__field( unsigned int, flags )
6766
),
6867

6968
TP_fast_assign(
7069
__entry->timer = timer;
7170
__entry->function = timer->function;
72-
__entry->expires = expires;
71+
__entry->expires = timer->expires;
72+
__entry->bucket_expiry = bucket_expiry;
7373
__entry->now = jiffies;
74-
__entry->flags = flags;
74+
__entry->flags = timer->flags;
7575
),
7676

77-
TP_printk("timer=%p function=%ps expires=%lu [timeout=%ld] cpu=%u idx=%u flags=%s",
77+
TP_printk("timer=%p function=%ps expires=%lu [timeout=%ld] bucket_expiry=%lu cpu=%u idx=%u flags=%s",
7878
__entry->timer, __entry->function, __entry->expires,
7979
(long)__entry->expires - __entry->now,
80-
__entry->flags & TIMER_CPUMASK,
80+
__entry->bucket_expiry, __entry->flags & TIMER_CPUMASK,
8181
__entry->flags >> TIMER_ARRAYSHIFT,
8282
decode_timer_flags(__entry->flags & TIMER_TRACE_FLAGMASK))
8383
);

kernel/time/timer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ static void enqueue_timer(struct timer_base *base, struct timer_list *timer,
606606
__set_bit(idx, base->pending_map);
607607
timer_set_idx(timer, idx);
608608

609-
trace_timer_start(timer, timer->expires, timer->flags);
609+
trace_timer_start(timer, bucket_expiry);
610610

611611
/*
612612
* Check whether this is the new first expiring timer. The

0 commit comments

Comments
 (0)