mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 19:08:57 +09:00
ANDROID: vendor_hooks: Add hooks to select binder worklist
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>
(cherry picked from commit acefa91e51)
Signed-off-by: Carlos Llamas <cmllamas@google.com>
(cherry picked from commit d26c0e1c409179ea74aaa89f748006bd76000cc3)
This commit is contained in:
committed by
Carlos Llamas
parent
4619ee1a42
commit
e0d5caf5c9
@@ -2926,6 +2926,7 @@ static int binder_proc_transaction(struct binder_transaction *t,
|
||||
bool oneway = !!(t->flags & TF_ONE_WAY);
|
||||
bool pending_async = false;
|
||||
struct binder_transaction *t_outdated = NULL;
|
||||
bool skip = false;
|
||||
|
||||
BUG_ON(!node);
|
||||
binder_node_lock(node);
|
||||
@@ -2951,7 +2952,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);
|
||||
|
||||
if (thread) {
|
||||
@@ -4614,6 +4618,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) &&
|
||||
@@ -4627,7 +4635,7 @@ retry:
|
||||
goto retry;
|
||||
break;
|
||||
}
|
||||
|
||||
skip:
|
||||
if (end - ptr < sizeof(tr) + 4) {
|
||||
binder_inner_proc_unlock(proc);
|
||||
break;
|
||||
|
||||
@@ -134,6 +134,8 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cpuidle_psci_enter);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cpuidle_psci_exit);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_wait_for_work);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_proc_transaction_finish);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_proc_transaction_entry);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_select_worklist_ilocked);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sync_txn_recvd);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_set_balance_anon_file_reclaim);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_show_max_freq);
|
||||
|
||||
@@ -61,6 +61,15 @@ DECLARE_HOOK(android_vh_binder_has_work_ilocked,
|
||||
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_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));
|
||||
#endif /* _TRACE_HOOK_BINDER_H */
|
||||
/* This part must be outside protection */
|
||||
#include <trace/define_trace.h>
|
||||
|
||||
Reference in New Issue
Block a user