• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM sched
4 #define TRACE_INCLUDE_PATH trace/hooks
5 #if !defined(_TRACE_HOOK_SCHED_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_HOOK_SCHED_H
7 #include <trace/hooks/vendor_hooks.h>
8 /*
9  * Following tracepoints are not exported in tracefs and provide a
10  * mechanism for vendor modules to hook and extend functionality
11  */
12 struct cgroup_taskset;
13 struct cgroup_subsys_state;
14 struct cpufreq_policy;
15 struct em_perf_domain;
16 enum uclamp_id;
17 struct sched_entity;
18 struct task_struct;
19 struct uclamp_se;
20 
21 DECLARE_RESTRICTED_HOOK(android_rvh_select_task_rq_fair,
22 	TP_PROTO(struct task_struct *p, int prev_cpu, int sd_flag, int wake_flags, int *new_cpu),
23 	TP_ARGS(p, prev_cpu, sd_flag, wake_flags, new_cpu), 1);
24 
25 DECLARE_RESTRICTED_HOOK(android_rvh_select_task_rq_rt,
26 	TP_PROTO(struct task_struct *p, int prev_cpu, int sd_flag, int wake_flags, int *new_cpu),
27 	TP_ARGS(p, prev_cpu, sd_flag, wake_flags, new_cpu), 1);
28 
29 DECLARE_RESTRICTED_HOOK(android_rvh_select_task_rq_dl,
30 	TP_PROTO(struct task_struct *p, int prev_cpu, int sd_flag, int wake_flags, int *new_cpu),
31 	TP_ARGS(p, prev_cpu, sd_flag, wake_flags, new_cpu), 1);
32 
33 DECLARE_RESTRICTED_HOOK(android_rvh_select_fallback_rq,
34 	TP_PROTO(int cpu, struct task_struct *p, int *new_cpu),
35 	TP_ARGS(cpu, p, new_cpu), 1);
36 
37 struct rq;
38 DECLARE_HOOK(android_vh_scheduler_tick,
39 	TP_PROTO(struct rq *rq),
40 	TP_ARGS(rq));
41 
42 DECLARE_RESTRICTED_HOOK(android_rvh_enqueue_task,
43 	TP_PROTO(struct rq *rq, struct task_struct *p, int flags),
44 	TP_ARGS(rq, p, flags), 1);
45 
46 DECLARE_RESTRICTED_HOOK(android_rvh_dequeue_task,
47 	TP_PROTO(struct rq *rq, struct task_struct *p, int flags),
48 	TP_ARGS(rq, p, flags), 1);
49 
50 DECLARE_RESTRICTED_HOOK(android_rvh_can_migrate_task,
51 	TP_PROTO(struct task_struct *p, int dst_cpu, int *can_migrate),
52 	TP_ARGS(p, dst_cpu, can_migrate), 1);
53 
54 DECLARE_RESTRICTED_HOOK(android_rvh_find_lowest_rq,
55 	TP_PROTO(struct task_struct *p, struct cpumask *local_cpu_mask,
56 			int ret, int *lowest_cpu),
57 	TP_ARGS(p, local_cpu_mask, ret, lowest_cpu), 1);
58 
59 DECLARE_RESTRICTED_HOOK(android_rvh_prepare_prio_fork,
60 	TP_PROTO(struct task_struct *p),
61 	TP_ARGS(p), 1);
62 
63 DECLARE_RESTRICTED_HOOK(android_rvh_finish_prio_fork,
64 	TP_PROTO(struct task_struct *p),
65 	TP_ARGS(p), 1);
66 
67 DECLARE_RESTRICTED_HOOK(android_rvh_rtmutex_prepare_setprio,
68 	TP_PROTO(struct task_struct *p, struct task_struct *pi_task),
69 	TP_ARGS(p, pi_task), 1);
70 
71 DECLARE_RESTRICTED_HOOK(android_rvh_set_user_nice,
72 	TP_PROTO(struct task_struct *p, long *nice, bool *allowed),
73 	TP_ARGS(p, nice, allowed), 1);
74 
75 DECLARE_RESTRICTED_HOOK(android_rvh_set_user_nice_locked,
76 	TP_PROTO(struct task_struct *p, long *nice),
77 	TP_ARGS(p, nice), 1);
78 
79 DECLARE_RESTRICTED_HOOK(android_rvh_setscheduler,
80 	TP_PROTO(struct task_struct *p),
81 	TP_ARGS(p), 1);
82 
83 struct sched_group;
84 DECLARE_RESTRICTED_HOOK(android_rvh_find_busiest_group,
85 	TP_PROTO(struct sched_group *busiest, struct rq *dst_rq, int *out_balance),
86 		TP_ARGS(busiest, dst_rq, out_balance), 1);
87 
88 DECLARE_HOOK(android_vh_dump_throttled_rt_tasks,
89 	TP_PROTO(int cpu, u64 clock, ktime_t rt_period, u64 rt_runtime,
90 			s64 rt_period_timer_expires),
91 	TP_ARGS(cpu, clock, rt_period, rt_runtime, rt_period_timer_expires));
92 
93 DECLARE_HOOK(android_vh_jiffies_update,
94 	TP_PROTO(void *unused),
95 	TP_ARGS(unused));
96 
97 struct rq_flags;
98 DECLARE_RESTRICTED_HOOK(android_rvh_sched_newidle_balance,
99 	TP_PROTO(struct rq *this_rq, struct rq_flags *rf,
100 		 int *pulled_task, int *done),
101 	TP_ARGS(this_rq, rf, pulled_task, done), 1);
102 
103 DECLARE_RESTRICTED_HOOK(android_rvh_sched_nohz_balancer_kick,
104 	TP_PROTO(struct rq *rq, unsigned int *flags, int *done),
105 	TP_ARGS(rq, flags, done), 1);
106 
107 DECLARE_RESTRICTED_HOOK(android_rvh_sched_rebalance_domains,
108 	TP_PROTO(struct rq *rq, int *continue_balancing),
109 	TP_ARGS(rq, continue_balancing), 1);
110 
111 DECLARE_RESTRICTED_HOOK(android_rvh_find_busiest_queue,
112 	TP_PROTO(int dst_cpu, struct sched_group *group,
113 		 struct cpumask *env_cpus, struct rq **busiest,
114 		 int *done),
115 	TP_ARGS(dst_cpu, group, env_cpus, busiest, done), 1);
116 
117 DECLARE_RESTRICTED_HOOK(android_rvh_migrate_queued_task,
118 	TP_PROTO(struct rq *rq, struct rq_flags *rf,
119 		 struct task_struct *p, int new_cpu,
120 		 int *detached),
121 	TP_ARGS(rq, rf, p, new_cpu, detached), 1);
122 
123 DECLARE_RESTRICTED_HOOK(android_rvh_resume_cpus,
124 	TP_PROTO(struct cpumask *cpus, int *err),
125 	TP_ARGS(cpus, err), 1);
126 
127 DECLARE_RESTRICTED_HOOK(android_rvh_find_energy_efficient_cpu,
128 	TP_PROTO(struct task_struct *p, int prev_cpu, int sync, int *new_cpu),
129 	TP_ARGS(p, prev_cpu, sync, new_cpu), 1);
130 
131 DECLARE_RESTRICTED_HOOK(android_rvh_set_iowait,
132 	TP_PROTO(struct task_struct *p, int *should_iowait_boost),
133 	TP_ARGS(p, should_iowait_boost), 1);
134 
135 DECLARE_RESTRICTED_HOOK(android_rvh_cpu_overutilized,
136 	TP_PROTO(int cpu, int *overutilized),
137 	TP_ARGS(cpu, overutilized), 1);
138 
139 DECLARE_RESTRICTED_HOOK(android_rvh_sched_setaffinity,
140 	TP_PROTO(struct task_struct *p, const struct cpumask *in_mask, int *retval),
141 	TP_ARGS(p, in_mask, retval), 1);
142 
143 DECLARE_RESTRICTED_HOOK(android_rvh_update_cpus_allowed,
144 	TP_PROTO(struct task_struct *p, cpumask_var_t cpus_requested,
145 		 const struct cpumask *new_mask, int *ret),
146 	TP_ARGS(p, cpus_requested, new_mask, ret), 1);
147 
148 DECLARE_RESTRICTED_HOOK(android_rvh_set_task_cpu,
149 	TP_PROTO(struct task_struct *p, unsigned int new_cpu),
150 	TP_ARGS(p, new_cpu), 1);
151 
152 DECLARE_RESTRICTED_HOOK(android_rvh_sched_fork,
153 	TP_PROTO(struct task_struct *p),
154 	TP_ARGS(p), 1);
155 
156 DECLARE_RESTRICTED_HOOK(android_rvh_wake_up_new_task,
157 	TP_PROTO(struct task_struct *p),
158 	TP_ARGS(p), 1);
159 
160 DECLARE_RESTRICTED_HOOK(android_rvh_schedule,
161 	TP_PROTO(struct task_struct *prev, struct task_struct *next, struct rq *rq),
162 	TP_ARGS(prev, next, rq), 1);
163 
164 DECLARE_RESTRICTED_HOOK(android_rvh_build_perf_domains,
165 	TP_PROTO(bool *eas_check),
166 	TP_ARGS(eas_check), 1);
167 
168 DECLARE_RESTRICTED_HOOK(android_rvh_update_misfit_status,
169 	TP_PROTO(struct task_struct *p, struct rq *rq, bool *need_update),
170 	TP_ARGS(p, rq, need_update), 1);
171 
172 DECLARE_RESTRICTED_HOOK(android_rvh_cpu_cgroup_attach,
173 	TP_PROTO(struct cgroup_taskset *tset),
174 	TP_ARGS(tset), 1);
175 
176 DECLARE_RESTRICTED_HOOK(android_rvh_cpu_cgroup_can_attach,
177 	TP_PROTO(struct cgroup_taskset *tset, int *retval),
178 	TP_ARGS(tset, retval), 1);
179 
180 DECLARE_RESTRICTED_HOOK(android_rvh_cpu_cgroup_online,
181 	TP_PROTO(struct cgroup_subsys_state *css),
182 	TP_ARGS(css), 1);
183 
184 DECLARE_RESTRICTED_HOOK(android_rvh_sched_fork_init,
185 	TP_PROTO(struct task_struct *p),
186 	TP_ARGS(p), 1);
187 
188 DECLARE_RESTRICTED_HOOK(android_rvh_ttwu_cond,
189 	TP_PROTO(bool *cond),
190 	TP_ARGS(cond), 1);
191 
192 DECLARE_RESTRICTED_HOOK(android_rvh_schedule_bug,
193 	TP_PROTO(struct task_struct *p),
194 	TP_ARGS(p), 1);
195 
196 DECLARE_RESTRICTED_HOOK(android_rvh_sched_exec,
197 	TP_PROTO(bool *cond),
198 	TP_ARGS(cond), 1);
199 
200 DECLARE_HOOK(android_vh_map_util_freq,
201 	TP_PROTO(unsigned long util, unsigned long freq,
202 		unsigned long cap, unsigned long *next_freq, struct cpufreq_policy *policy,
203 		bool *need_freq_update),
204 	TP_ARGS(util, freq, cap, next_freq, policy, need_freq_update));
205 
206 DECLARE_HOOK(android_vh_update_next_freq,
207 	TP_PROTO(struct cpufreq_policy *policy, unsigned int old_next_freq,
208 		unsigned int *new_next_freq, s64 delta_ns),
209 	TP_ARGS(policy, old_next_freq, new_next_freq, delta_ns));
210 
211 DECLARE_HOOK(android_vh_sugov_get_util,
212 	TP_PROTO(unsigned int cpu, unsigned long *ret),
213 	TP_ARGS(cpu, ret));
214 
215 DECLARE_HOOK(android_vh_em_cpu_energy,
216 	TP_PROTO(struct em_perf_domain *pd,
217 		unsigned long max_util, unsigned long sum_util,
218 		unsigned long *energy),
219 	TP_ARGS(pd, max_util, sum_util, energy));
220 
221 DECLARE_RESTRICTED_HOOK(android_rvh_sched_balance_rt,
222 	TP_PROTO(struct rq *rq, struct task_struct *p, int *done),
223 	TP_ARGS(rq, p, done), 1);
224 
225 DECLARE_RESTRICTED_HOOK(android_rvh_dequeue_task_idle,
226 	TP_PROTO(struct task_struct *p),
227 	TP_ARGS(p), 1);
228 
229 struct cfs_rq;
230 DECLARE_RESTRICTED_HOOK(android_rvh_pick_next_entity,
231 	TP_PROTO(struct cfs_rq *cfs_rq, struct sched_entity *curr,
232 		 struct sched_entity **se),
233 	TP_ARGS(cfs_rq, curr, se), 1);
234 
235 DECLARE_RESTRICTED_HOOK(android_rvh_check_preempt_wakeup,
236 	TP_PROTO(struct rq *rq, struct task_struct *p, bool *preempt, bool *nopreempt,
237 			int wake_flags, struct sched_entity *se, struct sched_entity *pse,
238 			int next_buddy_marked, unsigned int granularity),
239 	TP_ARGS(rq, p, preempt, nopreempt, wake_flags, se, pse, next_buddy_marked,
240 			granularity), 1);
241 
242 DECLARE_HOOK(android_vh_do_wake_up_sync,
243 	TP_PROTO(struct wait_queue_head *wq_head, int *done),
244 	TP_ARGS(wq_head, done));
245 
246 DECLARE_HOOK(android_vh_set_wake_flags,
247 	TP_PROTO(int *wake_flags, unsigned int *mode),
248 	TP_ARGS(wake_flags, mode));
249 
250 DECLARE_RESTRICTED_HOOK(android_rvh_uclamp_eff_get,
251 	TP_PROTO(struct task_struct *p, enum uclamp_id clamp_id,
252 		 struct uclamp_se *uclamp_max, struct uclamp_se *uclamp_eff, int *ret),
253 	TP_ARGS(p, clamp_id, uclamp_max, uclamp_eff, ret), 1);
254 
255 DECLARE_RESTRICTED_HOOK(android_rvh_uclamp_task_util,
256 	TP_PROTO(unsigned long task_util, unsigned long min_util,
257 		 unsigned long max_util, unsigned long *ret),
258 	TP_ARGS(task_util, min_util, max_util, ret), 1);
259 
260 DECLARE_RESTRICTED_HOOK(android_rvh_uclamp_rq_util_with,
261 	TP_PROTO(unsigned long util, unsigned long min_util,
262 		 unsigned long max_util, unsigned long *ret),
263 	TP_ARGS(util, min_util, max_util, ret), 1);
264 
265 DECLARE_HOOK(android_vh_build_sched_domains,
266 	TP_PROTO(bool has_asym),
267 	TP_ARGS(has_asym));
268 DECLARE_RESTRICTED_HOOK(android_rvh_check_preempt_tick,
269 	TP_PROTO(struct task_struct *p, unsigned long *ideal_runtime, bool *skip_preempt,
270 			unsigned long delta_exec, struct cfs_rq *cfs_rq, struct sched_entity *curr,
271 			unsigned int granularity),
272 	TP_ARGS(p, ideal_runtime, skip_preempt, delta_exec, cfs_rq, curr, granularity), 1);
273 DECLARE_RESTRICTED_HOOK(android_rvh_check_preempt_wakeup_ignore,
274 	TP_PROTO(struct task_struct *p, bool *ignore),
275 	TP_ARGS(p, ignore), 1);
276 DECLARE_RESTRICTED_HOOK(android_rvh_replace_next_task_fair,
277 	TP_PROTO(struct rq *rq, struct task_struct **p, struct sched_entity **se, bool *repick,
278 			bool simple, struct task_struct *prev),
279 	TP_ARGS(rq, p, se, repick, simple, prev), 1);
280 
281 DECLARE_RESTRICTED_HOOK(android_rvh_util_est_update,
282 	TP_PROTO(struct cfs_rq *cfs_rq, struct task_struct *p, bool task_sleep, int *ret),
283 	TP_ARGS(cfs_rq, p, task_sleep, ret), 1);
284 
285 DECLARE_HOOK(android_vh_account_task_time,
286 	TP_PROTO(struct task_struct *p, struct rq *rq, int user_tick),
287 	TP_ARGS(p, rq, user_tick));
288 
289 DECLARE_HOOK(android_vh_irqtime_account_process_tick,
290 	TP_PROTO(struct task_struct *p, struct rq *rq, int user_tick, int ticks),
291 	TP_ARGS(p, rq, user_tick, ticks));
292 
293 DECLARE_RESTRICTED_HOOK(android_rvh_post_init_entity_util_avg,
294 	TP_PROTO(struct sched_entity *se),
295 	TP_ARGS(se), 1);
296 
297 DECLARE_RESTRICTED_HOOK(android_rvh_set_cpus_allowed_comm,
298 	TP_PROTO(struct task_struct *p, const struct cpumask *new_mask),
299 	TP_ARGS(p, new_mask), 1);
300 
301 DECLARE_HOOK(android_vh_sched_setaffinity_early,
302 	TP_PROTO(struct task_struct *p, const struct cpumask *new_mask, int *retval),
303 	TP_ARGS(p, new_mask, retval));
304 
305 DECLARE_RESTRICTED_HOOK(android_rvh_cpumask_any_and_distribute,
306 	TP_PROTO(struct task_struct *p, const struct cpumask *cpu_valid_mask ,
307 		const struct cpumask *new_mask, int *dest_cpu),
308 	TP_ARGS(p, cpu_valid_mask, new_mask, dest_cpu), 1);
309 
310 DECLARE_RESTRICTED_HOOK(android_rvh_do_sched_yield,
311 	TP_PROTO(struct rq *rq),
312 	TP_ARGS(rq), 1);
313 
314 DECLARE_HOOK(android_vh_free_task,
315 	TP_PROTO(struct task_struct *p),
316 	TP_ARGS(p));
317 
318 DECLARE_RESTRICTED_HOOK(android_rvh_after_enqueue_task,
319 	TP_PROTO(struct rq *rq, struct task_struct *p),
320 	TP_ARGS(rq, p), 1);
321 
322 DECLARE_RESTRICTED_HOOK(android_rvh_after_dequeue_task,
323 	TP_PROTO(struct rq *rq, struct task_struct *p),
324 	TP_ARGS(rq, p), 1);
325 
326 struct cfs_rq;
327 struct rq_flags;
328 DECLARE_RESTRICTED_HOOK(android_rvh_enqueue_entity,
329 	TP_PROTO(struct cfs_rq *cfs, struct sched_entity *se),
330 	TP_ARGS(cfs, se), 1);
331 
332 DECLARE_RESTRICTED_HOOK(android_rvh_dequeue_entity,
333 	TP_PROTO(struct cfs_rq *cfs, struct sched_entity *se),
334 	TP_ARGS(cfs, se), 1);
335 
336 DECLARE_RESTRICTED_HOOK(android_rvh_entity_tick,
337 	TP_PROTO(struct cfs_rq *cfs_rq, struct sched_entity *se),
338 	TP_ARGS(cfs_rq, se), 1);
339 
340 DECLARE_RESTRICTED_HOOK(android_rvh_enqueue_task_fair,
341 	TP_PROTO(struct rq *rq, struct task_struct *p, int flags),
342 	TP_ARGS(rq, p, flags), 1);
343 
344 DECLARE_RESTRICTED_HOOK(android_rvh_dequeue_task_fair,
345 	TP_PROTO(struct rq *rq, struct task_struct *p, int flags),
346 	TP_ARGS(rq, p, flags), 1);
347 
348 DECLARE_HOOK(android_vh_prepare_update_load_avg_se,
349 	TP_PROTO(struct sched_entity *se, int flags),
350 	TP_ARGS(se, flags));
351 
352 DECLARE_HOOK(android_vh_finish_update_load_avg_se,
353 	TP_PROTO(struct sched_entity *se, int flags),
354 	TP_ARGS(se, flags));
355 
356 DECLARE_HOOK(android_vh_uclamp_validate,
357 	TP_PROTO(struct task_struct *p, const struct sched_attr *attr,
358 		 int *ret, bool *done),
359 	TP_ARGS(p, attr, ret, done));
360 
361 DECLARE_HOOK(android_vh_dup_task_struct,
362 	TP_PROTO(struct task_struct *tsk, struct task_struct *orig),
363 	TP_ARGS(tsk, orig));
364 
365 DECLARE_HOOK(android_vh_set_task_comm,
366 	TP_PROTO(struct task_struct *p),
367 	TP_ARGS(p));
368 
369 DECLARE_RESTRICTED_HOOK(android_rvh_find_new_ilb,
370 	TP_PROTO(struct cpumask *nohz_idle_cpus_mask, int *ilb),
371 	TP_ARGS(nohz_idle_cpus_mask, ilb), 1);
372 
373 DECLARE_RESTRICTED_HOOK(android_rvh_force_compatible_pre,
374 	TP_PROTO(void *unused),
375 	TP_ARGS(unused), 1);
376 
377 DECLARE_RESTRICTED_HOOK(android_rvh_force_compatible_post,
378 	TP_PROTO(void *unused),
379 	TP_ARGS(unused), 1);
380 
381 DECLARE_HOOK(android_vh_setscheduler_uclamp,
382 	TP_PROTO(struct task_struct *tsk, int clamp_id, unsigned int value),
383 	TP_ARGS(tsk, clamp_id, value));
384 
385 DECLARE_RESTRICTED_HOOK(android_rvh_attach_entity_load_avg,
386 	TP_PROTO(struct cfs_rq *cfs_rq, struct sched_entity *se),
387 	TP_ARGS(cfs_rq, se), 1);
388 
389 DECLARE_RESTRICTED_HOOK(android_rvh_detach_entity_load_avg,
390 	TP_PROTO(struct cfs_rq *cfs_rq, struct sched_entity *se),
391 	TP_ARGS(cfs_rq, se), 1);
392 
393 DECLARE_RESTRICTED_HOOK(android_rvh_update_load_avg,
394 	TP_PROTO(u64 now, struct cfs_rq *cfs_rq, struct sched_entity *se),
395 	TP_ARGS(now, cfs_rq, se), 1);
396 
397 DECLARE_RESTRICTED_HOOK(android_rvh_remove_entity_load_avg,
398 	TP_PROTO(struct cfs_rq *cfs_rq, struct sched_entity *se),
399 	TP_ARGS(cfs_rq, se), 1);
400 
401 DECLARE_RESTRICTED_HOOK(android_rvh_update_blocked_fair,
402 	TP_PROTO(struct rq *rq),
403 	TP_ARGS(rq), 1);
404 
405 DECLARE_RESTRICTED_HOOK(android_rvh_update_rt_rq_load_avg,
406 	TP_PROTO(u64 now, struct rq *rq, struct task_struct *tsk, int running),
407 	TP_ARGS(now, rq, tsk, running), 1);
408 
409 DECLARE_RESTRICTED_HOOK(android_rvh_update_rq_clock_pelt,
410 	TP_PROTO(struct rq *rq, s64 delta, bool *ret),
411 	TP_ARGS(rq, delta, ret), 1);
412 
413 DECLARE_HOOK(android_vh_pidfd_open,
414 	TP_PROTO(struct pid *p),
415 	TP_ARGS(p));
416 
417 DECLARE_HOOK(android_vh_mmput,
418 	TP_PROTO(void *unused),
419 	TP_ARGS(unused));
420 
421 DECLARE_HOOK(android_vh_rebuild_root_domains_bypass,
422 	TP_PROTO(bool tasks_frozen, bool *bypass),
423 	TP_ARGS(tasks_frozen, bypass));
424 /* macro versions of hooks are no longer required */
425 
426 #endif /* _TRACE_HOOK_SCHED_H */
427 /* This part must be outside protection */
428 #include <trace/define_trace.h>
429