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;
|
||||
|
Reference in New Issue
Block a user