ANDROID: vendor_hooks: Add hooks for binder
trace_android_vh_binder_proc_transaction_entry: We need change binder thread so that this work can be added in proc->todo, if we found the binder thread, skip native logic. trace_android_vh_binder_select_worklist_ilocked: we need this because we can't change list point in ”trace_android_vh_binder_thread_read“, otherwise, If a work has beed added in our own defined list before, current may goto retry and loop again and again. Bug: 219898723 Change-Id: Ifdb3429c9ddac521bc75c1d21740ee7cc4b8f143 Signed-off-by: Liujie Xie <xieliujie@oppo.com>
This commit is contained in:
@@ -2490,6 +2490,7 @@ static int binder_proc_transaction(struct binder_transaction *t,
|
||||
struct binder_priority node_prio;
|
||||
bool oneway = !!(t->flags & TF_ONE_WAY);
|
||||
bool pending_async = false;
|
||||
bool skip = false;
|
||||
|
||||
BUG_ON(!node);
|
||||
binder_node_lock(node);
|
||||
@@ -2517,7 +2518,10 @@ static int binder_proc_transaction(struct binder_transaction *t,
|
||||
return proc->is_frozen ? BR_FROZEN_REPLY : BR_DEAD_REPLY;
|
||||
}
|
||||
|
||||
if (!thread && !pending_async)
|
||||
trace_android_vh_binder_proc_transaction_entry(proc, t,
|
||||
&thread, node->debug_id, pending_async, !oneway, &skip);
|
||||
|
||||
if (!thread && !pending_async && !skip)
|
||||
thread = binder_select_thread_ilocked(proc);
|
||||
|
||||
trace_android_vh_binder_proc_transaction(current, proc->tsk,
|
||||
@@ -4032,6 +4036,10 @@ retry:
|
||||
size_t trsize = sizeof(*trd);
|
||||
|
||||
binder_inner_proc_lock(proc);
|
||||
trace_android_vh_binder_select_worklist_ilocked(&list, thread,
|
||||
proc, wait_for_proc_work);
|
||||
if (list)
|
||||
goto skip;
|
||||
if (!binder_worklist_empty_ilocked(&thread->todo))
|
||||
list = &thread->todo;
|
||||
else if (!binder_worklist_empty_ilocked(&proc->todo) &&
|
||||
@@ -4045,7 +4053,7 @@ retry:
|
||||
goto retry;
|
||||
break;
|
||||
}
|
||||
|
||||
skip:
|
||||
if (end - ptr < sizeof(tr) + 4) {
|
||||
binder_inner_proc_unlock(proc);
|
||||
break;
|
||||
|
@@ -277,8 +277,10 @@ 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_entry);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_proc_transaction);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_proc_transaction_end);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_select_worklist_ilocked);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_new_ref);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_del_ref);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_post_init_entity_util_avg);
|
||||
|
@@ -59,6 +59,11 @@ DECLARE_RESTRICTED_HOOK(android_rvh_binder_transaction,
|
||||
DECLARE_HOOK(android_vh_binder_preset,
|
||||
TP_PROTO(struct hlist_head *hhead, struct mutex *lock),
|
||||
TP_ARGS(hhead, lock));
|
||||
DECLARE_HOOK(android_vh_binder_proc_transaction_entry,
|
||||
TP_PROTO(struct binder_proc *proc, struct binder_transaction *t,
|
||||
struct binder_thread **thread, int node_debug_id, bool pending_async,
|
||||
bool sync, bool *skip),
|
||||
TP_ARGS(proc, t, thread, node_debug_id, pending_async, sync, skip));
|
||||
DECLARE_HOOK(android_vh_binder_proc_transaction,
|
||||
TP_PROTO(struct task_struct *caller_task, struct task_struct *binder_proc_task,
|
||||
struct task_struct *binder_th_task, int node_debug_id,
|
||||
@@ -69,6 +74,10 @@ DECLARE_HOOK(android_vh_binder_proc_transaction_end,
|
||||
struct task_struct *binder_th_task, unsigned int code,
|
||||
bool pending_async, bool sync),
|
||||
TP_ARGS(caller_task, binder_proc_task, binder_th_task, code, pending_async, sync));
|
||||
DECLARE_HOOK(android_vh_binder_select_worklist_ilocked,
|
||||
TP_PROTO(struct list_head **list, struct binder_thread *thread, struct binder_proc *proc,
|
||||
int wait_for_proc_work),
|
||||
TP_ARGS(list, thread, proc, wait_for_proc_work));
|
||||
DECLARE_HOOK(android_vh_binder_new_ref,
|
||||
TP_PROTO(struct task_struct *proc, uint32_t ref_desc, int node_debug_id),
|
||||
TP_ARGS(proc, ref_desc, node_debug_id));
|
||||
|
Reference in New Issue
Block a user