ANDROID: Add vendor hooks for binder perf tuning

Add some hooks in the binder module so that we can do task dependency analysis and statistical work in OEM's module for further optimization.

Bug: 235925535
Bug: 281920779

Signed-off-by: Zhuguangqing <zhuguangqing@xiaomi.com>
Change-Id: Id47e59c4e3ccd07b26eef758ada147b98cd1964e
Signed-off-by: heshuai1 <heshuai1@xiaomi.com>
This commit is contained in:
Zhuguangqing
2021-03-09 15:47:43 +08:00
committed by Treehugger Robot
parent 788c867435
commit 09c3bee386
3 changed files with 21 additions and 1 deletions
+3 -1
View File
@@ -3285,6 +3285,7 @@ static void binder_transaction(struct binder_proc *proc,
target_proc = target_thread->proc;
target_proc->tmp_ref++;
binder_inner_proc_unlock(target_thread->proc);
trace_android_vh_binder_reply(target_proc, proc, thread, tr);
} else {
if (tr->target.handle) {
struct binder_ref *ref;
@@ -3347,6 +3348,7 @@ static void binder_transaction(struct binder_proc *proc,
return_error_line = __LINE__;
goto err_invalid_target_handle;
}
trace_android_vh_binder_trans(target_proc, proc, thread, tr);
if (security_binder_transaction(proc->cred,
target_proc->cred) < 0) {
binder_txn_error("%d:%d transaction credentials failed\n",
@@ -6276,7 +6278,7 @@ static int binder_open(struct inode *nodp, struct file *filp)
}
hlist_add_head(&proc->proc_node, &binder_procs);
mutex_unlock(&binder_procs_lock);
trace_android_vh_binder_preset(&binder_procs, &binder_procs_lock);
if (binder_debugfs_dir_entry_proc && !existing_pid) {
char strbuf[11];
+3
View File
@@ -362,3 +362,6 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_dma_heap_buffer_alloc_start);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_dma_heap_buffer_alloc_end);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_zs_shrinker_adjust);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_zs_shrinker_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_preset);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_reply);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_trans);
+15
View File
@@ -56,6 +56,21 @@ DECLARE_HOOK(android_vh_binder_buffer_release,
TP_PROTO(struct binder_proc *proc, struct binder_thread *thread,
struct binder_buffer *buffer, bool has_transaction),
TP_ARGS(proc, thread, buffer, has_transaction));
struct binder_proc;
struct binder_thread;
DECLARE_HOOK(android_vh_binder_preset,
TP_PROTO(struct hlist_head *hhead, struct mutex *lock),
TP_ARGS(hhead, lock));
struct binder_transaction_data;
DECLARE_HOOK(android_vh_binder_reply,
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_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));
#endif /* _TRACE_HOOK_BINDER_H */
/* This part must be outside protection */
#include <trace/define_trace.h>