• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM dtask
4 #define TRACE_INCLUDE_PATH trace/hooks
5 
6 #if !defined(_TRACE_HOOK_DTASK_H) || defined(TRACE_HEADER_MULTI_READ)
7 #define _TRACE_HOOK_DTASK_H
8 #include <trace/hooks/vendor_hooks.h>
9 /*
10  * Following tracepoints are not exported in tracefs and provide a
11  * mechanism for vendor modules to hook and extend functionality
12  */
13 
14 #ifdef __GENKSYMS__
15 #include <linux/mutex.h>
16 #include <linux/rtmutex.h>
17 #include <linux/rwsem.h>
18 #include <linux/sched.h>
19 #endif
20 
21 struct mutex;
22 struct rt_mutex_base;
23 struct rw_semaphore;
24 struct task_struct;
25 
26 DECLARE_HOOK(android_vh_mutex_wait_start,
27 	TP_PROTO(struct mutex *lock),
28 	TP_ARGS(lock));
29 DECLARE_HOOK(android_vh_mutex_wait_finish,
30 	TP_PROTO(struct mutex *lock),
31 	TP_ARGS(lock));
32 DECLARE_HOOK(android_vh_mutex_init,
33 	TP_PROTO(struct mutex *lock),
34 	TP_ARGS(lock));
35 DECLARE_HOOK(android_vh_mutex_opt_spin_start,
36 	TP_PROTO(struct mutex *lock, bool *time_out, int *cnt),
37 	TP_ARGS(lock, time_out, cnt));
38 DECLARE_HOOK(android_vh_mutex_opt_spin_finish,
39 	TP_PROTO(struct mutex *lock, bool taken),
40 	TP_ARGS(lock, taken));
41 DECLARE_HOOK(android_vh_mutex_can_spin_on_owner,
42 	TP_PROTO(struct mutex *lock, int *retval),
43 	TP_ARGS(lock, retval));
44 
45 DECLARE_HOOK(android_vh_rtmutex_wait_start,
46 	TP_PROTO(struct rt_mutex_base *lock),
47 	TP_ARGS(lock));
48 DECLARE_HOOK(android_vh_rtmutex_wait_finish,
49 	TP_PROTO(struct rt_mutex_base *lock),
50 	TP_ARGS(lock));
51 DECLARE_HOOK(android_vh_rt_mutex_steal,
52 	TP_PROTO(int waiter_prio, int top_waiter_prio, bool *ret),
53 	TP_ARGS(waiter_prio, top_waiter_prio, ret));
54 
55 DECLARE_HOOK(android_vh_rwsem_read_wait_start,
56 	TP_PROTO(struct rw_semaphore *sem),
57 	TP_ARGS(sem));
58 DECLARE_HOOK(android_vh_rwsem_read_wait_finish,
59 	TP_PROTO(struct rw_semaphore *sem),
60 	TP_ARGS(sem));
61 DECLARE_HOOK(android_vh_rwsem_write_wait_start,
62 	TP_PROTO(struct rw_semaphore *sem),
63 	TP_ARGS(sem));
64 DECLARE_HOOK(android_vh_rwsem_write_wait_finish,
65 	TP_PROTO(struct rw_semaphore *sem),
66 	TP_ARGS(sem));
67 DECLARE_HOOK(android_vh_rwsem_opt_spin_start,
68 	TP_PROTO(struct rw_semaphore *sem, bool *time_out, int *cnt, bool chk_only),
69 	TP_ARGS(sem, time_out, cnt, chk_only));
70 DECLARE_HOOK(android_vh_rwsem_opt_spin_finish,
71 	TP_PROTO(struct rw_semaphore *sem, bool taken),
72 	TP_ARGS(sem, taken));
73 DECLARE_HOOK(android_vh_rwsem_can_spin_on_owner,
74 	TP_PROTO(struct rw_semaphore *sem, bool *ret),
75 	TP_ARGS(sem, ret));
76 
77 DECLARE_HOOK(android_vh_sched_show_task,
78 	TP_PROTO(struct task_struct *task),
79 	TP_ARGS(task));
80 
81 struct mutex_waiter;
82 DECLARE_HOOK(android_vh_alter_mutex_list_add,
83 	TP_PROTO(struct mutex *lock,
84 		struct mutex_waiter *waiter,
85 		struct list_head *list,
86 		bool *already_on_list),
87 	TP_ARGS(lock, waiter, list, already_on_list));
88 DECLARE_HOOK(android_vh_mutex_unlock_slowpath,
89 	TP_PROTO(struct mutex *lock),
90 	TP_ARGS(lock));
91 DECLARE_HOOK(android_vh_record_mutex_lock_starttime,
92 	TP_PROTO(struct task_struct *tsk, unsigned long settime_jiffies),
93 	TP_ARGS(tsk, settime_jiffies));
94 DECLARE_HOOK(android_vh_record_rtmutex_lock_starttime,
95 	TP_PROTO(struct task_struct *tsk, unsigned long settime_jiffies),
96 	TP_ARGS(tsk, settime_jiffies));
97 DECLARE_HOOK(android_vh_record_rwsem_lock_starttime,
98 	TP_PROTO(struct task_struct *tsk, unsigned long settime_jiffies),
99 	TP_ARGS(tsk, settime_jiffies));
100 DECLARE_HOOK(android_vh_record_pcpu_rwsem_starttime,
101 	TP_PROTO(struct task_struct *tsk, unsigned long settime_jiffies),
102 	TP_ARGS(tsk, settime_jiffies));
103 
104 struct percpu_rw_semaphore;
105 DECLARE_HOOK(android_vh_percpu_rwsem_wq_add,
106 	TP_PROTO(struct percpu_rw_semaphore *sem, bool reader),
107 	TP_ARGS(sem, reader));
108 
109 struct rt_mutex_waiter;
110 struct ww_acquire_ctx;
111 DECLARE_HOOK(android_vh_task_blocks_on_rtmutex,
112 	TP_PROTO(struct rt_mutex_base *lock, struct rt_mutex_waiter *waiter,
113 		struct task_struct *task, struct ww_acquire_ctx *ww_ctx,
114 		unsigned int *chwalk),
115 	TP_ARGS(lock, waiter, task, ww_ctx, chwalk));
116 DECLARE_HOOK(android_vh_rtmutex_waiter_prio,
117 	TP_PROTO(struct task_struct *task, int *waiter_prio),
118 	TP_ARGS(task, waiter_prio));
119 
120 DECLARE_HOOK(android_vh_exit_signal_whether_wake,
121 	TP_PROTO(struct task_struct *p, bool *wake),
122 	TP_ARGS(p, wake));
123 
124 DECLARE_HOOK(android_vh_exit_check,
125 	TP_PROTO(struct task_struct *p),
126 	TP_ARGS(p));
127 
128 DECLARE_HOOK(android_vh_freeze_whether_wake,
129 	TP_PROTO(struct task_struct *t, bool *wake),
130 	TP_ARGS(t, wake));
131 
132 #endif /* _TRACE_HOOK_DTASK_H */
133 /* This part must be outside protection */
134 #include <trace/define_trace.h>
135