ANDROID: Add vendor hook to binder.

Add vendor hook to get the binder message for vendor-specific tuning.

Bug: 182496370

Signed-off-by: Zhuguangqing <zhuguangqing@xiaomi.com>
Change-Id: Id47e59c4e3ccd07b26eef758ada147b98cd1964e
This commit is contained in:
Zhuguangqing
2021-03-09 15:47:43 +08:00
committed by Todd Kjos
parent 0ff110fbb3
commit 301e89472f
4 changed files with 28 additions and 1 deletions

View File

@@ -2652,6 +2652,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;
@@ -2704,6 +2705,7 @@ static void binder_transaction(struct binder_proc *proc,
goto err_dead_binder;
}
e->to_node = target_node->debug_id;
trace_android_vh_binder_trans(target_proc, proc, thread, tr);
if (security_binder_transaction(proc->tsk,
target_proc->tsk) < 0) {
return_error = BR_FAILED_REPLY;
@@ -5155,7 +5157,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];

View File

@@ -25,6 +25,7 @@
#include <linux/sizes.h>
#include "binder_alloc.h"
#include "binder_trace.h"
#include <trace/hooks/binder.h>
struct list_lru binder_alloc_lru;
@@ -415,6 +416,7 @@ static struct binder_buffer *binder_alloc_new_buf_locked(
alloc->pid, extra_buffers_size);
return ERR_PTR(-EINVAL);
}
trace_android_vh_binder_alloc_new_buf_locked(size, alloc, is_async);
if (is_async &&
alloc->free_async_space < size + sizeof(struct binder_buffer)) {
binder_alloc_debug(BINDER_DEBUG_BUFFER_ALLOC,

View File

@@ -223,3 +223,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_account_task_time);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_gpio_block_read);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ep_create_wakeup_source);
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_vh_binder_preset);

View File

@@ -13,6 +13,10 @@
*/
struct binder_transaction;
struct task_struct;
struct binder_alloc;
struct binder_proc;
struct binder_thread;
struct binder_transaction_data;
DECLARE_HOOK(android_vh_binder_transaction_init,
TP_PROTO(struct binder_transaction *t),
TP_ARGS(t));
@@ -33,6 +37,21 @@ DECLARE_HOOK(android_vh_binder_wait_for_work,
DECLARE_HOOK(android_vh_sync_txn_recvd,
TP_PROTO(struct task_struct *tsk, struct task_struct *from),
TP_ARGS(tsk, from));
DECLARE_HOOK(android_vh_binder_alloc_new_buf_locked,
TP_PROTO(size_t size, struct binder_alloc *alloc, int is_async),
TP_ARGS(size, alloc, is_async));
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));
DECLARE_HOOK(android_vh_binder_preset,
TP_PROTO(struct hlist_head *hhead, struct mutex *lock),
TP_ARGS(hhead, lock));
/* macro versions of hooks are no longer required */
#endif /* _TRACE_HOOK_BINDER_H */