From 05aa93d251c2b5947d6e9e435561f753c039e09a Mon Sep 17 00:00:00 2001 From: Liujie Xie Date: Fri, 3 Dec 2021 12:01:03 +0800 Subject: [PATCH] ANDROID: vendor_hooks: Add hooks for binder proc transaction When binder transaction happened, We want to know it's transaction code and it is oneway or not. Bug: 208910215 Signed-off-by: Liujie Xie Change-Id: Ic03e5481e96e120a1953a101895714db04ca2bdf --- drivers/android/binder.c | 3 +++ drivers/android/vendor_hooks.c | 1 + include/trace/hooks/binder.h | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index c845c1f8a695..dabfb68c66e2 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -2529,6 +2529,9 @@ static int binder_proc_transaction(struct binder_transaction *t, binder_enqueue_work_ilocked(&t->work, &node->async_todo); } + trace_android_vh_binder_proc_transaction_end(current, proc->tsk, + thread ? thread->task : NULL, t->code, 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 17f42e726b55..3f6157a125c4 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -293,6 +293,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_trans); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_binder_transaction); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_preset); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_proc_transaction); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_proc_transaction_end); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_new_ref); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_del_ref); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_post_init_entity_util_avg); diff --git a/include/trace/hooks/binder.h b/include/trace/hooks/binder.h index 36a70248f5cf..16dd0a2a6514 100644 --- a/include/trace/hooks/binder.h +++ b/include/trace/hooks/binder.h @@ -64,6 +64,11 @@ DECLARE_HOOK(android_vh_binder_proc_transaction, struct task_struct *binder_th_task, int node_debug_id, unsigned int code, bool pending_async), TP_ARGS(caller_task, binder_proc_task, binder_th_task, node_debug_id, code, pending_async)); +DECLARE_HOOK(android_vh_binder_proc_transaction_end, + TP_PROTO(struct task_struct *caller_task, struct task_struct *binder_proc_task, + struct task_struct *binder_th_task, unsigned int code, + bool pending_async, bool sync), + TP_ARGS(caller_task, binder_proc_task, binder_th_task, code, pending_async, sync)); DECLARE_HOOK(android_vh_binder_new_ref, TP_PROTO(struct task_struct *proc, uint32_t ref_desc, int node_debug_id), TP_ARGS(proc, ref_desc, node_debug_id));