1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #undef TRACE_SYSTEM 3 #define TRACE_SYSTEM binder 4 #undef TRACE_INCLUDE_PATH 5 #define TRACE_INCLUDE_PATH trace/hooks 6 #if !defined(_TRACE_HOOK_BINDER_H) || defined(TRACE_HEADER_MULTI_READ) 7 #define _TRACE_HOOK_BINDER_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 struct binder_transaction; 14 struct task_struct; 15 struct binder_thread; 16 struct binder_proc; 17 struct binder_work; 18 struct binder_buffer; 19 struct binder_transaction_data; 20 struct binder_transaction_log; 21 22 DECLARE_HOOK(android_vh_binder_transaction_init, 23 TP_PROTO(struct binder_transaction *t), 24 TP_ARGS(t)); 25 DECLARE_HOOK(android_vh_binder_set_priority, 26 TP_PROTO(struct binder_transaction *t, struct task_struct *task), 27 TP_ARGS(t, task)); 28 DECLARE_HOOK(android_vh_binder_restore_priority, 29 TP_PROTO(struct binder_transaction *t, struct task_struct *task), 30 TP_ARGS(t, task)); 31 DECLARE_HOOK(android_vh_binder_alloc_new_buf_locked, 32 TP_PROTO(size_t size, size_t *free_async_space, int is_async, bool *should_fail), 33 TP_ARGS(size, free_async_space, is_async, should_fail)); 34 DECLARE_HOOK(android_vh_binder_wait_for_work, 35 TP_PROTO(bool do_proc_work, struct binder_thread *tsk, struct binder_proc *proc), 36 TP_ARGS(do_proc_work, tsk, proc)); 37 DECLARE_HOOK(android_vh_sync_txn_recvd, 38 TP_PROTO(struct task_struct *tsk, struct task_struct *from), 39 TP_ARGS(tsk, from)); 40 DECLARE_HOOK(android_vh_binder_proc_transaction_finish, 41 TP_PROTO(struct binder_proc *proc, struct binder_transaction *t, 42 struct task_struct *binder_th_task, bool pending_async, bool sync), 43 TP_ARGS(proc, t, binder_th_task, pending_async, sync)); 44 DECLARE_HOOK(android_vh_binder_select_special_worklist, 45 TP_PROTO(struct list_head **list, struct binder_thread *thread, struct binder_proc *proc, 46 int wait_for_proc_work, bool *nothing_to_do), 47 TP_ARGS(list, thread, proc, wait_for_proc_work, nothing_to_do)); 48 DECLARE_HOOK(android_vh_alloc_oem_binder_struct, 49 TP_PROTO(struct binder_transaction_data *tr, struct binder_transaction *t, 50 struct binder_proc *proc), 51 TP_ARGS(tr, t, proc)); 52 DECLARE_HOOK(android_vh_binder_transaction_received, 53 TP_PROTO(struct binder_transaction *t, struct binder_proc *proc, 54 struct binder_thread *thread, uint32_t cmd), 55 TP_ARGS(t, proc, thread, cmd)); 56 DECLARE_HOOK(android_vh_free_oem_binder_struct, 57 TP_PROTO(struct binder_transaction *t), 58 TP_ARGS(t)); 59 DECLARE_HOOK(android_vh_binder_special_task, 60 TP_PROTO(struct binder_transaction *t, struct binder_proc *proc, 61 struct binder_thread *thread, struct binder_work *w, 62 struct list_head *head, bool sync, bool *special_task), 63 TP_ARGS(t, proc, thread, w, head, sync, special_task)); 64 DECLARE_HOOK(android_vh_binder_buffer_release, 65 TP_PROTO(struct binder_proc *proc, struct binder_thread *thread, 66 struct binder_buffer *buffer, bool has_transaction), 67 TP_ARGS(proc, thread, buffer, has_transaction)); 68 DECLARE_HOOK(android_vh_binder_ioctl_end, 69 TP_PROTO(struct task_struct *caller_task, 70 unsigned int cmd, 71 unsigned long arg, 72 struct binder_thread *thread, 73 struct binder_proc *proc, 74 int *ret), 75 TP_ARGS(caller_task, cmd, arg, thread, proc, ret)); 76 DECLARE_HOOK(android_vh_binder_looper_exited, 77 TP_PROTO(struct binder_thread *thread, struct binder_proc *proc), 78 TP_ARGS(thread, proc)); 79 DECLARE_HOOK(android_vh_binder_spawn_new_thread, 80 TP_PROTO(struct binder_thread *thread, struct binder_proc *proc, bool *force_spawn), 81 TP_ARGS(thread, proc, force_spawn)); 82 DECLARE_HOOK(android_vh_binder_has_special_work_ilocked, 83 TP_PROTO(struct binder_thread *thread, bool do_proc_work, bool *has_work), 84 TP_ARGS(thread, do_proc_work, has_work)); 85 DECLARE_HOOK(android_vh_binder_list_add_work, 86 TP_PROTO(struct binder_work *work, struct list_head *target_list), 87 TP_ARGS(work, target_list)); 88 DECLARE_HOOK(android_vh_binder_has_proc_work_ilocked, 89 TP_PROTO(struct binder_thread *thread, bool do_proc_work, bool *has_work), 90 TP_ARGS(thread, do_proc_work, has_work)); 91 DECLARE_HOOK(android_vh_binder_check_special_work, 92 TP_PROTO(struct binder_proc *proc, struct list_head **special_list), 93 TP_ARGS(proc, special_list)); 94 DECLARE_HOOK(android_vh_binder_free_proc, 95 TP_PROTO(struct binder_proc *proc), 96 TP_ARGS(proc)); 97 DECLARE_HOOK(android_vh_binder_preset, 98 TP_PROTO(struct hlist_head *hhead, struct mutex *lock, struct binder_proc *proc), 99 TP_ARGS(hhead, lock, proc)); 100 DECLARE_HOOK(android_vh_binder_reply, 101 TP_PROTO(struct binder_proc *target_proc, struct binder_proc *proc, 102 struct binder_thread *thread, struct binder_transaction_data *tr), 103 TP_ARGS(target_proc, proc, thread, tr)); 104 DECLARE_HOOK(android_vh_binder_trans, 105 TP_PROTO(struct binder_proc *target_proc, struct binder_proc *proc, 106 struct binder_thread *thread, struct binder_transaction_data *tr), 107 TP_ARGS(target_proc, proc, thread, tr)); 108 DECLARE_HOOK(android_vh_binder_proc_transaction, 109 TP_PROTO(struct task_struct *caller_task, struct task_struct *binder_proc_task, 110 struct task_struct *binder_th_task, int node_debug_id, 111 struct binder_transaction *t, bool pending_async), 112 TP_ARGS(caller_task, binder_proc_task, binder_th_task, node_debug_id, t, pending_async)); 113 DECLARE_HOOK(android_vh_binder_thread_read, 114 TP_PROTO(struct list_head **list, struct binder_proc *proc, 115 struct binder_thread *thread), 116 TP_ARGS(list, proc, thread)); 117 DECLARE_HOOK(android_vh_binder_transaction_record, 118 TP_PROTO(struct binder_transaction_data *tr, 119 struct binder_transaction *t, 120 struct binder_transaction *in_reply_to), 121 TP_ARGS(tr, t, in_reply_to)); 122 DECLARE_HOOK(android_vh_binder_data_preset, 123 TP_PROTO(struct hlist_head *binder_procs, 124 struct mutex *binder_procs_lock, 125 struct binder_transaction_log *binder_transaction_log, 126 struct binder_transaction_log *binder_transaction_log_failed, 127 size_t size), 128 TP_ARGS(binder_procs, 129 binder_procs_lock, binder_transaction_log, 130 binder_transaction_log_failed, size)); 131 DECLARE_RESTRICTED_HOOK(android_rvh_init_binder_logs, 132 TP_PROTO(struct super_block *sb), 133 TP_ARGS(sb), 1); 134 DECLARE_HOOK(android_vh_binder_new_ref, 135 TP_PROTO(struct binder_proc *proc, uint32_t ref_desc, int node_debug_id), 136 TP_ARGS(proc, ref_desc, node_debug_id)); 137 DECLARE_HOOK(android_vh_binder_del_ref, 138 TP_PROTO(struct binder_proc *proc, uint32_t ref_desc), 139 TP_ARGS(proc, ref_desc)); 140 DECLARE_HOOK(android_vh_binder_looper_state_registered, 141 TP_PROTO(struct binder_thread *thread, struct binder_proc *proc), 142 TP_ARGS(thread, proc)); 143 DECLARE_HOOK(android_vh_binder_thread_release, 144 TP_PROTO(struct binder_proc *proc, struct binder_thread *thread), 145 TP_ARGS(proc, thread)); 146 DECLARE_HOOK(android_vh_binder_read_done, 147 TP_PROTO(struct binder_proc *proc, struct binder_thread *thread), 148 TP_ARGS(proc, thread)); 149 #endif /* _TRACE_HOOK_BINDER_H */ 150 /* This part must be outside protection */ 151 #include <trace/define_trace.h> 152