diff --git a/drivers/android/binder.c b/drivers/android/binder.c index a4ca35b4088f..7d784e263d28 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -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; diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index ff97e31dbb2d..40b2b2fc51bc 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -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); diff --git a/include/trace/hooks/binder.h b/include/trace/hooks/binder.h index 7d32b97a3d7f..5d0ee3a605ff 100644 --- a/include/trace/hooks/binder.h +++ b/include/trace/hooks/binder.h @@ -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