From eabe9707f264c859d5b0b5b1740a97f8eef97d67 Mon Sep 17 00:00:00 2001 From: zhang chuang Date: Wed, 16 Jun 2021 19:11:38 +0800 Subject: [PATCH] ANDROID: Add hook to show vendor info for transactions When watchdog or anr occur, we need to read dev/binderfs/binder_logs/proc/pid or dev/binderfs/binder_logs/state node to know the time-consuming information of the binder call. We need to add the time-consuming information of binder transaction. Bug: 190413570 Signed-off-by: zhang chuang Change-Id: I0423d4e821d5cd725a848584133dc7245cbc233a --- drivers/android/binder.c | 1 + drivers/android/vendor_hooks.c | 1 + include/trace/hooks/binder.h | 5 +++++ 3 files changed, 7 insertions(+) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index 3b6d6be5e3b7..fb39c14dd44c 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -5481,6 +5481,7 @@ static void print_binder_transaction_ilocked(struct seq_file *m, struct binder_buffer *buffer = t->buffer; spin_lock(&t->lock); + trace_android_vh_binder_print_transaction_info(m, proc, prefix, t); to_proc = t->to_proc; seq_printf(m, "%s %d: %pK from %d:%d to %d:%d code %x flags %x pri %d:%d r%d", diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index b8fab55cbc16..9367f3f512d8 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -333,3 +333,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_aes_encrypt); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_aes_decrypt); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_force_compatible_pre); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_force_compatible_post); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_print_transaction_info); diff --git a/include/trace/hooks/binder.h b/include/trace/hooks/binder.h index ddeb936e8945..afa7b59c5ae2 100644 --- a/include/trace/hooks/binder.h +++ b/include/trace/hooks/binder.h @@ -17,6 +17,7 @@ struct binder_alloc; struct binder_proc; struct binder_thread; struct binder_transaction_data; +struct seq_file; DECLARE_HOOK(android_vh_binder_transaction_init, TP_PROTO(struct binder_transaction *t), TP_ARGS(t)); @@ -65,6 +66,10 @@ DECLARE_HOOK(android_vh_binder_new_ref, DECLARE_HOOK(android_vh_binder_del_ref, TP_PROTO(struct task_struct *proc, uint32_t ref_desc), TP_ARGS(proc, ref_desc)); +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), + TP_ARGS(m, proc, prefix, t)); /* macro versions of hooks are no longer required */