Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1719874

[PATCH 13/13] ANDROID: binder: Add tracing for binder priority inheritance.

From Martijn Coenen <maco@android.com>
Newsgroups linux.kernel
Subject [PATCH 13/13] ANDROID: binder: Add tracing for binder priority inheritance.
Date 2017-08-25 11:40 +0200
Message-ID <uijfR-2gM-41@gated-at.bofh.it> (permalink)
References <uijfQ-2gM-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


This allows to easily trace and visualize priority inheritance
in the binder driver.

Change-Id: I8449ae4b002e55c5e9517a47f3581e05eef051d8
Signed-off-by: Martijn Coenen <maco@android.com>
---
 drivers/android/binder.c       |  4 ++++
 drivers/android/binder_trace.h | 24 ++++++++++++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/drivers/android/binder.c b/drivers/android/binder.c
index 337c88fd675d..b29af3de6c34 100644
--- a/drivers/android/binder.c
+++ b/drivers/android/binder.c
@@ -1153,6 +1153,10 @@ static void binder_do_set_priority(struct task_struct *task,
 			      task->pid, desired.prio,
 			      to_kernel_prio(policy, priority));
 
+	trace_binder_set_priority(task->tgid, task->pid, task->normal_prio,
+				  to_kernel_prio(policy, priority),
+				  desired.prio);
+
 	/* Set the actual priority */
 	if (task->policy != policy || is_rt_policy(policy)) {
 		struct sched_param params;
diff --git a/drivers/android/binder_trace.h b/drivers/android/binder_trace.h
index 7967db16ba5a..1e0169796d81 100644
--- a/drivers/android/binder_trace.h
+++ b/drivers/android/binder_trace.h
@@ -85,6 +85,30 @@ DEFINE_BINDER_FUNCTION_RETURN_EVENT(binder_ioctl_done);
 DEFINE_BINDER_FUNCTION_RETURN_EVENT(binder_write_done);
 DEFINE_BINDER_FUNCTION_RETURN_EVENT(binder_read_done);
 
+TRACE_EVENT(binder_set_priority,
+	TP_PROTO(int proc, int thread, unsigned int old_prio,
+		 unsigned int desired_prio, unsigned int new_prio),
+	TP_ARGS(proc, thread, old_prio, new_prio, desired_prio),
+
+	TP_STRUCT__entry(
+		__field(int, proc)
+		__field(int, thread)
+		__field(unsigned int, old_prio)
+		__field(unsigned int, new_prio)
+		__field(unsigned int, desired_prio)
+	),
+	TP_fast_assign(
+		__entry->proc = proc;
+		__entry->thread = thread;
+		__entry->old_prio = old_prio;
+		__entry->new_prio = new_prio;
+		__entry->desired_prio = desired_prio;
+	),
+	TP_printk("proc=%d thread=%d old=%d => new=%d desired=%d",
+		  __entry->proc, __entry->thread, __entry->old_prio,
+		  __entry->new_prio, __entry->desired_prio)
+);
+
 TRACE_EVENT(binder_wait_for_work,
 	TP_PROTO(bool proc_work, bool transaction_stack, bool thread_todo),
 	TP_ARGS(proc_work, transaction_stack, thread_todo),
-- 
2.14.1.480.gb18f417b89-goog

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/13] ANDROID: binder: RT priority inheritance and small fixes. Martijn Coenen <maco@android.com> - 2017-08-25 11:40 +0200
  [PATCH 09/13] ANDROID: binder: Don't BUG_ON(!spin_is_locked()). Martijn Coenen <maco@android.com> - 2017-08-25 11:40 +0200
  [PATCH 03/13] ANDROID: binder: add support for RT prio inheritance. Martijn Coenen <maco@android.com> - 2017-08-25 11:40 +0200
    Re: [PATCH 03/13] ANDROID: binder: add support for RT prio  inheritance. Thomas Gleixner <tglx@linutronix.de> - 2017-08-25 17:10 +0200
      Re: [PATCH 03/13] ANDROID: binder: add support for RT prio inheritance. Martijn Coenen <maco@android.com> - 2017-08-25 20:50 +0200
  [PATCH 05/13] ANDROID: binder: improve priority inheritance. Martijn Coenen <maco@android.com> - 2017-08-25 11:40 +0200
  [PATCH 06/13] ANDROID: binder: add RT inheritance flag to node. Martijn Coenen <maco@android.com> - 2017-08-25 11:40 +0200
  [PATCH 02/13] ANDROID: binder: push new transactions to waiting threads. Martijn Coenen <maco@android.com> - 2017-08-25 11:40 +0200
  [PATCH 01/13] ANDROID: binder: remove proc waitqueue Martijn Coenen <maco@android.com> - 2017-08-25 11:40 +0200
  [PATCH 13/13] ANDROID: binder: Add tracing for binder priority inheritance. Martijn Coenen <maco@android.com> - 2017-08-25 11:40 +0200
  [PATCH 12/13] ANDROID: binder: don't queue async transactions to thread. Martijn Coenen <maco@android.com> - 2017-08-25 11:40 +0200

csiph-web