From 800936191a26a5aba5caa3cbd70a4154b45eb94a Mon Sep 17 00:00:00 2001 From: Chuang Zhang Date: Mon, 24 Apr 2023 19:05:14 +0800 Subject: Binder: Add timestamp to transaction record This patch adds a timestamp field to the binder_transaction structure to track the time consumed during transmission when reading binder_transaction records. Signed-off-by: Chuang Zhang Acked-by: Carlos Llamas Link: https://lore.kernel.org/r/5ac8c0d09392290be789423f0dd78a520b830fab.1682333709.git.zhangchuang3@xiaomi.com Signed-off-by: Greg Kroah-Hartman --- drivers/android/binder_internal.h | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/android/binder_internal.h') diff --git a/drivers/android/binder_internal.h b/drivers/android/binder_internal.h index 28ef5b3704b1..92e64007f2b0 100644 --- a/drivers/android/binder_internal.h +++ b/drivers/android/binder_internal.h @@ -528,6 +528,7 @@ struct binder_transaction { long priority; long saved_priority; kuid_t sender_euid; + ktime_t start_time; struct list_head fd_fixups; binder_uintptr_t security_ctx; /** -- cgit v1.2.3 From c21c0f9a20a963f5a1874657a4e3d657503f7815 Mon Sep 17 00:00:00 2001 From: Chuang Zhang Date: Mon, 24 Apr 2023 19:05:15 +0800 Subject: Binder: Add async from to transaction record This commit adds support for getting the pid and tid information of the sender for asynchronous transfers in binderfs transfer records. In previous versions, it was not possible to obtain this information from the transfer records. While this information may not be necessary for all use cases, it can be useful in some scenarios. Signed-off-by: Chuang Zhang Acked-by: Carlos Llamas Link: https://lore.kernel.org/r/0c1e8bd37c68dd1518bb737b06b768cde9659386.1682333709.git.zhangchuang3@xiaomi.com Signed-off-by: Greg Kroah-Hartman --- drivers/android/binder.c | 6 ++++-- drivers/android/binder_internal.h | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'drivers/android/binder_internal.h') diff --git a/drivers/android/binder.c b/drivers/android/binder.c index b6413652906e..6674619845e0 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -3172,6 +3172,8 @@ static void binder_transaction(struct binder_proc *proc, t->from = thread; else t->from = NULL; + t->from_pid = proc->pid; + t->from_tid = thread->pid; t->sender_euid = task_euid(proc->tsk); t->to_proc = target_proc; t->to_thread = target_thread; @@ -5940,8 +5942,8 @@ static void print_binder_transaction_ilocked(struct seq_file *m, seq_printf(m, "%s %d: %pK from %d:%d to %d:%d code %x flags %x pri %ld r%d elapsed %lldms", prefix, t->debug_id, t, - t->from ? t->from->proc->pid : 0, - t->from ? t->from->pid : 0, + t->from_pid, + t->from_tid, to_proc ? to_proc->pid : 0, t->to_thread ? t->to_thread->pid : 0, t->code, t->flags, t->priority, t->need_reply, diff --git a/drivers/android/binder_internal.h b/drivers/android/binder_internal.h index 92e64007f2b0..7270d4d22207 100644 --- a/drivers/android/binder_internal.h +++ b/drivers/android/binder_internal.h @@ -515,6 +515,8 @@ struct binder_transaction { int debug_id; struct binder_work work; struct binder_thread *from; + pid_t from_pid; + pid_t from_tid; struct binder_transaction *from_parent; struct binder_proc *to_proc; struct binder_thread *to_thread; -- cgit v1.2.3