From 2f3f5731de0536a6a1048ae01e129cebec48e664 Mon Sep 17 00:00:00 2001 From: Liangliang Li Date: Wed, 10 Nov 2021 18:05:13 +0800 Subject: [PATCH] ANDROID: GKI: Add vendor hook to binder transaction We want to get binder free space information in the binder transaction, but this needs to hold the mutex lock. So we add this restrict hook to do this. Bug: 205648032 Change-Id: Ie1f377018da686bd62f5ac2d1e5421899741e6d5 Signed-off-by: Liangliang Li --- drivers/android/binder.c | 1 + drivers/android/vendor_hooks.c | 1 + include/trace/hooks/binder.h | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index b03bf4e11a08..c845c1f8a695 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -2797,6 +2797,7 @@ static void binder_transaction(struct binder_proc *proc, if (target_thread) e->to_thread = target_thread->pid; e->to_proc = target_proc->pid; + trace_android_rvh_binder_transaction(target_proc, proc, thread, tr); /* TODO: reuse incoming transaction for reply */ t = kzalloc(sizeof(*t), GFP_KERNEL); diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 952053d4f5fa..9d2a765b164d 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -289,6 +289,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_timerfd_create); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_alloc_new_buf_locked); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_reply); 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_new_ref); diff --git a/include/trace/hooks/binder.h b/include/trace/hooks/binder.h index ffba8746e58b..36a70248f5cf 100644 --- a/include/trace/hooks/binder.h +++ b/include/trace/hooks/binder.h @@ -52,6 +52,10 @@ DECLARE_HOOK(android_vh_binder_trans, 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)); +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_preset, TP_PROTO(struct hlist_head *hhead, struct mutex *lock), TP_ARGS(hhead, lock));