From c97f4f3ed55a41ffbb0ec558d219bd5dabc580eb Mon Sep 17 00:00:00 2001 From: Liujie Xie Date: Thu, 10 Feb 2022 12:11:10 +0800 Subject: [PATCH] ANDROID: vendor_hooks: Add hooks for binder proc transaction We need pointers to proc and t, the current hooks in binder_proc_transaction are unable to use. Bug: 208910215 Change-Id: I730964f965a015e5f5a3e237d9b3bd084b5bd0d0 Signed-off-by: Liujie Xie (cherry picked from commit cb7e10d31bca4f247c34d6791d6db048edf7e7a8) Signed-off-by: Carlos Llamas (cherry picked from commit 8968875ad63f4cda9f263e2a2a930524dd8fdbc7) --- drivers/android/binder.c | 2 ++ drivers/android/vendor_hooks.c | 1 + include/trace/hooks/binder.h | 4 ++++ 3 files changed, 7 insertions(+) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index 501bbec29522..2dfd860b593c 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -2999,6 +2999,8 @@ static int binder_proc_transaction(struct binder_transaction *t, binder_enqueue_work_ilocked(&t->work, &node->async_todo); } + trace_android_vh_binder_proc_transaction_finish(proc, t, + thread ? thread->task : NULL, pending_async, !oneway); if (!pending_async) binder_wakeup_thread_ilocked(proc, thread, !oneway /* sync */); diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 9963ca5ddbef..6e6fb957a406 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -168,6 +168,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cpuidle_psci_exit); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_cgroup_force_kthread_migration); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_wait_for_work); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_binder_transaction); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_proc_transaction_finish); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sync_txn_recvd); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_update_topology_flags_workfn); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_cpufreq_transition); diff --git a/include/trace/hooks/binder.h b/include/trace/hooks/binder.h index c80b3c15ddc9..3e6e020cbec2 100644 --- a/include/trace/hooks/binder.h +++ b/include/trace/hooks/binder.h @@ -42,6 +42,10 @@ DECLARE_RESTRICTED_HOOK(android_rvh_binder_transaction, TP_PROTO(struct binder_proc *target_proc, struct binder_proc *proc, struct binder_thread *thread, struct binder_transaction_data *tr), TP_ARGS(target_proc, proc, thread, tr), 1); +DECLARE_HOOK(android_vh_binder_proc_transaction_finish, + TP_PROTO(struct binder_proc *proc, struct binder_transaction *t, + struct task_struct *binder_th_task, bool pending_async, bool sync), + TP_ARGS(proc, t, binder_th_task, pending_async, sync)); DECLARE_HOOK(android_vh_binder_print_transaction_info, TP_PROTO(struct seq_file *m, struct binder_proc *proc, const char *prefix, struct binder_transaction *t),