Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) #undef TRACE_SYSTEM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) #define TRACE_SYSTEM timer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) #if !defined(_TRACE_TIMER_H) || defined(TRACE_HEADER_MULTI_READ)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) #define _TRACE_TIMER_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <linux/tracepoint.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include <linux/hrtimer.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/timer.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) DECLARE_EVENT_CLASS(timer_class,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 	TP_PROTO(struct timer_list *timer),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 	TP_ARGS(timer),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 	TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 		__field( void *,	timer	)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 	),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 	TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 		__entry->timer	= timer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 	),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 	TP_printk("timer=%p", __entry->timer)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)  * timer_init - called when the timer is initialized
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)  * @timer:	pointer to struct timer_list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) DEFINE_EVENT(timer_class, timer_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	TP_PROTO(struct timer_list *timer),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	TP_ARGS(timer)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) #define decode_timer_flags(flags)			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	__print_flags(flags, "|",			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 		{  TIMER_MIGRATING,	"M" },		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 		{  TIMER_DEFERRABLE,	"D" },		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 		{  TIMER_PINNED,	"P" },		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 		{  TIMER_IRQSAFE,	"I" })
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48)  * timer_start - called when the timer is started
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49)  * @timer:	pointer to struct timer_list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50)  * @expires:	the timers expiry time
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) TRACE_EVENT(timer_start,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	TP_PROTO(struct timer_list *timer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 		unsigned long expires,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 		unsigned int flags),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	TP_ARGS(timer, expires, flags),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 		__field( void *,	timer		)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 		__field( void *,	function	)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 		__field( unsigned long,	expires		)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 		__field( unsigned long,	now		)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 		__field( unsigned int,	flags		)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 		__entry->timer		= timer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 		__entry->function	= timer->function;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 		__entry->expires	= expires;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 		__entry->now		= jiffies;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 		__entry->flags		= flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	TP_printk("timer=%p function=%ps expires=%lu [timeout=%ld] cpu=%u idx=%u flags=%s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 		  __entry->timer, __entry->function, __entry->expires,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 		  (long)__entry->expires - __entry->now,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 		  __entry->flags & TIMER_CPUMASK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 		  __entry->flags >> TIMER_ARRAYSHIFT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 		  decode_timer_flags(__entry->flags & TIMER_TRACE_FLAGMASK))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85)  * timer_expire_entry - called immediately before the timer callback
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86)  * @timer:	pointer to struct timer_list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88)  * Allows to determine the timer latency.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) TRACE_EVENT(timer_expire_entry,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	TP_PROTO(struct timer_list *timer, unsigned long baseclk),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	TP_ARGS(timer, baseclk),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 		__field( void *,	timer	)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 		__field( unsigned long,	now	)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 		__field( void *,	function)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 		__field( unsigned long,	baseclk	)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 		__entry->timer		= timer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 		__entry->now		= jiffies;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 		__entry->function	= timer->function;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 		__entry->baseclk	= baseclk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	TP_printk("timer=%p function=%ps now=%lu baseclk=%lu",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 		  __entry->timer, __entry->function, __entry->now,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 		  __entry->baseclk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)  * timer_expire_exit - called immediately after the timer callback returns
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)  * @timer:	pointer to struct timer_list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)  * When used in combination with the timer_expire_entry tracepoint we can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)  * determine the runtime of the timer callback function.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)  * NOTE: Do NOT derefernce timer in TP_fast_assign. The pointer might
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)  * be invalid. We solely track the pointer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) DEFINE_EVENT(timer_class, timer_expire_exit,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	TP_PROTO(struct timer_list *timer),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	TP_ARGS(timer)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)  * timer_cancel - called when the timer is canceled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)  * @timer:	pointer to struct timer_list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) DEFINE_EVENT(timer_class, timer_cancel,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	TP_PROTO(struct timer_list *timer),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	TP_ARGS(timer)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) #define decode_clockid(type)						\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	__print_symbolic(type,						\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 		{ CLOCK_REALTIME,	"CLOCK_REALTIME"	},	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 		{ CLOCK_MONOTONIC,	"CLOCK_MONOTONIC"	},	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 		{ CLOCK_BOOTTIME,	"CLOCK_BOOTTIME"	},	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 		{ CLOCK_TAI,		"CLOCK_TAI"		})
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) #define decode_hrtimer_mode(mode)					\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	__print_symbolic(mode,						\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 		{ HRTIMER_MODE_ABS,		"ABS"		},	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 		{ HRTIMER_MODE_REL,		"REL"		},	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 		{ HRTIMER_MODE_ABS_PINNED,	"ABS|PINNED"	},	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 		{ HRTIMER_MODE_REL_PINNED,	"REL|PINNED"	},	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 		{ HRTIMER_MODE_ABS_SOFT,	"ABS|SOFT"	},	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 		{ HRTIMER_MODE_REL_SOFT,	"REL|SOFT"	},	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 		{ HRTIMER_MODE_ABS_PINNED_SOFT,	"ABS|PINNED|SOFT" },	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 		{ HRTIMER_MODE_REL_PINNED_SOFT,	"REL|PINNED|SOFT" })
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)  * hrtimer_init - called when the hrtimer is initialized
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)  * @hrtimer:	pointer to struct hrtimer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)  * @clockid:	the hrtimers clock
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)  * @mode:	the hrtimers mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) TRACE_EVENT(hrtimer_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	TP_PROTO(struct hrtimer *hrtimer, clockid_t clockid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 		 enum hrtimer_mode mode),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	TP_ARGS(hrtimer, clockid, mode),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 		__field( void *,		hrtimer		)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 		__field( clockid_t,		clockid		)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 		__field( enum hrtimer_mode,	mode		)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 		__entry->hrtimer	= hrtimer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 		__entry->clockid	= clockid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 		__entry->mode		= mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	TP_printk("hrtimer=%p clockid=%s mode=%s", __entry->hrtimer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 		  decode_clockid(__entry->clockid),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 		  decode_hrtimer_mode(__entry->mode))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)  * hrtimer_start - called when the hrtimer is started
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)  * @hrtimer: pointer to struct hrtimer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) TRACE_EVENT(hrtimer_start,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	TP_PROTO(struct hrtimer *hrtimer, enum hrtimer_mode mode),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	TP_ARGS(hrtimer, mode),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 		__field( void *,	hrtimer		)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 		__field( void *,	function	)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 		__field( s64,		expires		)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 		__field( s64,		softexpires	)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 		__field( enum hrtimer_mode,	mode	)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 		__entry->hrtimer	= hrtimer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 		__entry->function	= hrtimer->function;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 		__entry->expires	= hrtimer_get_expires(hrtimer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 		__entry->softexpires	= hrtimer_get_softexpires(hrtimer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 		__entry->mode		= mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	TP_printk("hrtimer=%p function=%ps expires=%llu softexpires=%llu "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 		  "mode=%s", __entry->hrtimer, __entry->function,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 		  (unsigned long long) __entry->expires,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 		  (unsigned long long) __entry->softexpires,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 		  decode_hrtimer_mode(__entry->mode))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)  * hrtimer_expire_entry - called immediately before the hrtimer callback
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226)  * @hrtimer:	pointer to struct hrtimer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)  * @now:	pointer to variable which contains current time of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228)  *		timers base.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230)  * Allows to determine the timer latency.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) TRACE_EVENT(hrtimer_expire_entry,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 	TP_PROTO(struct hrtimer *hrtimer, ktime_t *now),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 	TP_ARGS(hrtimer, now),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 	TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 		__field( void *,	hrtimer	)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 		__field( s64,		now	)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 		__field( void *,	function)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 	),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 	TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 		__entry->hrtimer	= hrtimer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 		__entry->now		= *now;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 		__entry->function	= hrtimer->function;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 	),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 	TP_printk("hrtimer=%p function=%ps now=%llu",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 		  __entry->hrtimer, __entry->function,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 		  (unsigned long long) __entry->now)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) DECLARE_EVENT_CLASS(hrtimer_class,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 	TP_PROTO(struct hrtimer *hrtimer),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 	TP_ARGS(hrtimer),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 	TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 		__field( void *,	hrtimer	)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 	),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 	TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 		__entry->hrtimer	= hrtimer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 	),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 	TP_printk("hrtimer=%p", __entry->hrtimer)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273)  * hrtimer_expire_exit - called immediately after the hrtimer callback returns
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274)  * @hrtimer:	pointer to struct hrtimer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276)  * When used in combination with the hrtimer_expire_entry tracepoint we can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277)  * determine the runtime of the callback function.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) DEFINE_EVENT(hrtimer_class, hrtimer_expire_exit,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 	TP_PROTO(struct hrtimer *hrtimer),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 	TP_ARGS(hrtimer)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287)  * hrtimer_cancel - called when the hrtimer is canceled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288)  * @hrtimer:	pointer to struct hrtimer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) DEFINE_EVENT(hrtimer_class, hrtimer_cancel,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 	TP_PROTO(struct hrtimer *hrtimer),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 	TP_ARGS(hrtimer)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298)  * itimer_state - called when itimer is started or canceled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299)  * @which:	name of the interval timer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300)  * @value:	the itimers value, itimer is canceled if value->it_value is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301)  *		zero, otherwise it is started
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302)  * @expires:	the itimers expiry time
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) TRACE_EVENT(itimer_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) 	TP_PROTO(int which, const struct itimerspec64 *const value,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) 		 unsigned long long expires),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) 	TP_ARGS(which, value, expires),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) 	TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 		__field(	int,			which		)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) 		__field(	unsigned long long,	expires		)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) 		__field(	long,			value_sec	)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) 		__field(	long,			value_nsec	)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) 		__field(	long,			interval_sec	)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 		__field(	long,			interval_nsec	)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) 	),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) 	TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) 		__entry->which		= which;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 		__entry->expires	= expires;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) 		__entry->value_sec	= value->it_value.tv_sec;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) 		__entry->value_nsec	= value->it_value.tv_nsec;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) 		__entry->interval_sec	= value->it_interval.tv_sec;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) 		__entry->interval_nsec	= value->it_interval.tv_nsec;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 	),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) 	TP_printk("which=%d expires=%llu it_value=%ld.%06ld it_interval=%ld.%06ld",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) 		  __entry->which, __entry->expires,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) 		  __entry->value_sec, __entry->value_nsec / NSEC_PER_USEC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) 		  __entry->interval_sec, __entry->interval_nsec / NSEC_PER_USEC)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336)  * itimer_expire - called when itimer expires
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337)  * @which:	type of the interval timer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338)  * @pid:	pid of the process which owns the timer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339)  * @now:	current time, used to calculate the latency of itimer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) TRACE_EVENT(itimer_expire,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) 	TP_PROTO(int which, struct pid *pid, unsigned long long now),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) 	TP_ARGS(which, pid, now),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 	TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) 		__field( int ,			which	)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 		__field( pid_t,			pid	)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) 		__field( unsigned long long,	now	)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) 	),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) 	TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) 		__entry->which	= which;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) 		__entry->now	= now;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) 		__entry->pid	= pid_nr(pid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) 	),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) 	TP_printk("which=%d pid=%d now=%llu", __entry->which,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) 		  (int) __entry->pid, __entry->now)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) #ifdef CONFIG_NO_HZ_COMMON
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) #define TICK_DEP_NAMES					\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) 		tick_dep_mask_name(NONE)		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) 		tick_dep_name(POSIX_TIMER)		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) 		tick_dep_name(PERF_EVENTS)		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) 		tick_dep_name(SCHED)			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) 		tick_dep_name(CLOCK_UNSTABLE)		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) 		tick_dep_name_end(RCU)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) #undef tick_dep_name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) #undef tick_dep_mask_name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) #undef tick_dep_name_end
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) /* The MASK will convert to their bits and they need to be processed too */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) #define tick_dep_name(sdep) TRACE_DEFINE_ENUM(TICK_DEP_BIT_##sdep); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) 	TRACE_DEFINE_ENUM(TICK_DEP_MASK_##sdep);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) #define tick_dep_name_end(sdep)  TRACE_DEFINE_ENUM(TICK_DEP_BIT_##sdep); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) 	TRACE_DEFINE_ENUM(TICK_DEP_MASK_##sdep);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) /* NONE only has a mask defined for it */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) #define tick_dep_mask_name(sdep) TRACE_DEFINE_ENUM(TICK_DEP_MASK_##sdep);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) TICK_DEP_NAMES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) #undef tick_dep_name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) #undef tick_dep_mask_name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) #undef tick_dep_name_end
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) #define tick_dep_name(sdep) { TICK_DEP_MASK_##sdep, #sdep },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) #define tick_dep_mask_name(sdep) { TICK_DEP_MASK_##sdep, #sdep },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) #define tick_dep_name_end(sdep) { TICK_DEP_MASK_##sdep, #sdep }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) #define show_tick_dep_name(val)				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) 	__print_symbolic(val, TICK_DEP_NAMES)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) TRACE_EVENT(tick_stop,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) 	TP_PROTO(int success, int dependency),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) 	TP_ARGS(success, dependency),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) 	TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) 		__field( int ,		success	)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) 		__field( int ,		dependency )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) 	),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) 	TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) 		__entry->success	= success;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) 		__entry->dependency	= dependency;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) 	),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) 	TP_printk("success=%d dependency=%s",  __entry->success, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) 			show_tick_dep_name(__entry->dependency))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) #endif /*  _TRACE_TIMER_H */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) /* This part must be outside protection */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) #include <trace/define_trace.h>