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 <linux/tracepoint.h> 9 #include <trace/hooks/vendor_hooks.h> 10 /* 11 * Following tracepoints are not exported in tracefs and provide a 12 * mechanism for vendor modules to hook and extend functionality 13 */ 14 #if defined(__GENKSYMS__) || !IS_ENABLED(CONFIG_ANDROID_BINDER_IPC) 15 struct binder_alloc; 16 struct binder_proc; 17 struct binder_thread; 18 struct binder_transaction; 19 struct binder_transaction_data; 20 #else 21 /* struct binder_alloc */ 22 #include <../drivers/android/binder_alloc.h> 23 /* struct binder_proc, struct binder_thread, struct binder_transaction */ 24 #include <../drivers/android/binder_internal.h> 25 #endif 26 27 #ifdef __GENKSYMS__ 28 struct task_struct; 29 struct seq_file; 30 #else 31 /* struct task_struct */ 32 #include <linux/sched.h> 33 /* struct seq_file */ 34 #include <linux/seq_file.h> 35 /* struct binder_transaction_data */ 36 #include <uapi/linux/android/binder.h> 37 #endif /* __GENKSYMS__ */ 38 39 DECLARE_HOOK(android_vh_binder_transaction_init, 40 TP_PROTO(struct binder_transaction *t), 41 TP_ARGS(t)); 42 DECLARE_HOOK(android_vh_binder_priority_skip, 43 TP_PROTO(struct task_struct *task, bool *skip), 44 TP_ARGS(task, skip)); 45 DECLARE_HOOK(android_vh_binder_set_priority, 46 TP_PROTO(struct binder_transaction *t, struct task_struct *task), 47 TP_ARGS(t, task)); 48 DECLARE_HOOK(android_vh_binder_restore_priority, 49 TP_PROTO(struct binder_transaction *t, struct task_struct *task), 50 TP_ARGS(t, task)); 51 DECLARE_HOOK(android_vh_binder_wakeup_ilocked, 52 TP_PROTO(struct task_struct *task, bool sync, struct binder_proc *proc), 53 TP_ARGS(task, sync, proc)); 54 DECLARE_HOOK(android_vh_binder_wait_for_work, 55 TP_PROTO(bool do_proc_work, struct binder_thread *tsk, struct binder_proc *proc), 56 TP_ARGS(do_proc_work, tsk, proc)); 57 DECLARE_HOOK(android_vh_sync_txn_recvd, 58 TP_PROTO(struct task_struct *tsk, struct task_struct *from), 59 TP_ARGS(tsk, from)); 60 DECLARE_HOOK(android_vh_binder_alloc_new_buf_locked, 61 TP_PROTO(size_t size, struct binder_alloc *alloc, int is_async), 62 TP_ARGS(size, alloc, is_async)); 63 DECLARE_HOOK(android_vh_binder_reply, 64 TP_PROTO(struct binder_proc *target_proc, struct binder_proc *proc, 65 struct binder_thread *thread, struct binder_transaction_data *tr), 66 TP_ARGS(target_proc, proc, thread, tr)); 67 DECLARE_HOOK(android_vh_binder_trans, 68 TP_PROTO(struct binder_proc *target_proc, struct binder_proc *proc, 69 struct binder_thread *thread, struct binder_transaction_data *tr), 70 TP_ARGS(target_proc, proc, thread, tr)); 71 DECLARE_RESTRICTED_HOOK(android_rvh_binder_transaction, 72 TP_PROTO(struct binder_proc *target_proc, struct binder_proc *proc, 73 struct binder_thread *thread, struct binder_transaction_data *tr), 74 TP_ARGS(target_proc, proc, thread, tr), 1); 75 DECLARE_HOOK(android_vh_binder_preset, 76 TP_PROTO(struct hlist_head *hhead, struct mutex *lock), 77 TP_ARGS(hhead, lock)); 78 DECLARE_HOOK(android_vh_binder_proc_transaction, 79 TP_PROTO(struct task_struct *caller_task, struct task_struct *binder_proc_task, 80 struct task_struct *binder_th_task, int node_debug_id, 81 unsigned int code, bool pending_async), 82 TP_ARGS(caller_task, binder_proc_task, binder_th_task, node_debug_id, code, pending_async)); 83 DECLARE_HOOK(android_vh_binder_proc_transaction_end, 84 TP_PROTO(struct task_struct *caller_task, struct task_struct *binder_proc_task, 85 struct task_struct *binder_th_task, unsigned int code, 86 bool pending_async, bool sync), 87 TP_ARGS(caller_task, binder_proc_task, binder_th_task, code, pending_async, sync)); 88 DECLARE_HOOK(android_vh_binder_new_ref, 89 TP_PROTO(struct task_struct *proc, uint32_t ref_desc, int node_debug_id), 90 TP_ARGS(proc, ref_desc, node_debug_id)); 91 DECLARE_HOOK(android_vh_binder_del_ref, 92 TP_PROTO(struct task_struct *proc, uint32_t ref_desc), 93 TP_ARGS(proc, ref_desc)); 94 DECLARE_HOOK(android_vh_binder_print_transaction_info, 95 TP_PROTO(struct seq_file *m, struct binder_proc *proc, 96 const char *prefix, struct binder_transaction *t), 97 TP_ARGS(m, proc, prefix, t)); 98 DECLARE_HOOK(android_vh_binder_looper_state_registered, 99 TP_PROTO(struct binder_thread *thread, struct binder_proc *proc), 100 TP_ARGS(thread, proc)); 101 DECLARE_HOOK(android_vh_binder_thread_read, 102 TP_PROTO(struct list_head **list, struct binder_proc *proc, 103 struct binder_thread *thread), 104 TP_ARGS(list, proc, thread)); 105 DECLARE_HOOK(android_vh_binder_free_proc, 106 TP_PROTO(struct binder_proc *proc), 107 TP_ARGS(proc)); 108 DECLARE_HOOK(android_vh_binder_thread_release, 109 TP_PROTO(struct binder_proc *proc, struct binder_thread *thread), 110 TP_ARGS(proc, thread)); 111 DECLARE_HOOK(android_vh_binder_read_done, 112 TP_PROTO(struct binder_proc *proc, struct binder_thread *thread), 113 TP_ARGS(proc, thread)); 114 DECLARE_HOOK(android_vh_binder_has_work_ilocked, 115 TP_PROTO(struct binder_thread *thread, bool do_proc_work, int *ret), 116 TP_ARGS(thread, do_proc_work, ret)); 117 /* macro versions of hooks are no longer required */ 118 119 #endif /* _TRACE_HOOK_BINDER_H */ 120 /* This part must be outside protection */ 121 #include <trace/define_trace.h> 122