From a78c22c33d463f989ddfc48cda74721b7f1d0c5b Mon Sep 17 00:00:00 2001 From: Muduo Qin Date: Thu, 9 May 2024 19:53:05 +0800 Subject: [PATCH] ANDROID: vendor_hooks:vendor hooks for binder thread info the first one is the lifecycle that they are added to thread pool, and they are released. another is that the data is readed by thread. Bug: 333839270 Change-Id: I41d58474aa66533a2104c07aae525bf09e32df4d Signed-off-by: Muduo Qin (cherry picked from commit b98dd52b77f25f724052221c54b4e197692406e7) --- drivers/android/binder.c | 3 +++ drivers/android/vendor_hooks.c | 3 +++ include/trace/hooks/binder.h | 9 +++++++++ 3 files changed, 15 insertions(+) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index b86cb090a64a..a5fb7163f423 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -4516,6 +4516,7 @@ static int binder_thread_write(struct binder_proc *proc, } thread->looper |= BINDER_LOOPER_STATE_REGISTERED; binder_inner_proc_unlock(proc); + trace_android_vh_binder_looper_state_registered(thread, proc); break; case BC_ENTER_LOOPER: binder_debug(BINDER_DEBUG_THREADS, @@ -5598,6 +5599,7 @@ static int binder_thread_release(struct binder_proc *proc, if (send_reply) binder_send_failed_reply(send_reply, BR_DEAD_REPLY); binder_release_work(proc, &thread->todo); + trace_android_vh_binder_thread_release(proc, thread); binder_thread_dec_tmpref(thread); return active_transactions; } @@ -5671,6 +5673,7 @@ static int binder_ioctl_write_read(struct file *filp, unsigned long arg, if (!binder_worklist_empty_ilocked(&proc->todo) || has_special_work) binder_wakeup_proc_ilocked(proc); binder_inner_proc_unlock(proc); + trace_android_vh_binder_read_done(proc, thread); if (ret < 0) { if (copy_to_user(ubuf, &bwr, sizeof(bwr))) ret = -EFAULT; diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index c37917496b88..093329c34333 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -620,3 +620,6 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mm_split_huge_page_bypass); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mm_try_split_folio_bypass); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_scmi_limit_notify_cb); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_fiq_dump); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_looper_state_registered); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_thread_release); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_read_done); diff --git a/include/trace/hooks/binder.h b/include/trace/hooks/binder.h index 82f43ec144dc..043586ac209c 100644 --- a/include/trace/hooks/binder.h +++ b/include/trace/hooks/binder.h @@ -137,6 +137,15 @@ DECLARE_HOOK(android_vh_binder_new_ref, DECLARE_HOOK(android_vh_binder_del_ref, TP_PROTO(struct binder_proc *proc, uint32_t ref_desc), TP_ARGS(proc, ref_desc)); +DECLARE_HOOK(android_vh_binder_looper_state_registered, + TP_PROTO(struct binder_thread *thread, struct binder_proc *proc), + TP_ARGS(thread, proc)); +DECLARE_HOOK(android_vh_binder_thread_release, + TP_PROTO(struct binder_proc *proc, struct binder_thread *thread), + TP_ARGS(proc, thread)); +DECLARE_HOOK(android_vh_binder_read_done, + TP_PROTO(struct binder_proc *proc, struct binder_thread *thread), + TP_ARGS(proc, thread)); #endif /* _TRACE_HOOK_BINDER_H */ /* This part must be outside protection */ #include