binder.h 5.0 KB

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