aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/android/binder_trace.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-12-15 21:06:13 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-12-15 21:06:13 -0500
commitdab363f938a53ddaee60bfecc1aebdbb3d3af5f0 (patch)
treeccdb11a6e6191ba71fbc7716714c47b79172070d /drivers/android/binder_trace.h
parenta68db9cb858d10820add66682ad4d412f9914288 (diff)
parent17d2c6439be65777245914be354c5a97c76ad246 (diff)
Merge tag 'staging-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging driver updates from Greg KH: "Here's the big staging tree pull request for 3.19-rc1. We continued to delete more lines than were added, always a good thing, but not at a huge rate this release, only about 70k lines removed overall mostly from removing the horrid bcm driver. Lots of normal staging driver cleanups and fixes all over the place, well over a thousand of them, the shortlog shows all the horrid details. The "contentious" thing here is the movement of the Android binder code out of staging into the "real" part of the kernel. This is code that has been stable for a few years now and is working as-is in the tens of millions of devices with no issues. Yes, the code is horrid, and the userspace api leaves a lot to be desired, but it's not going to change due to legacy issues that we have no control over. Because so many devices and companies rely on this, and the code is stable, might as well promote it out of staging. This was all discussed at the Linux Plumbers conference, and everyone participating agreed that this was the best way forward. There is work happening to replace the binder code with something new that is happening right now, but I don't expect to see the results of that work for another year at the earliest. If that ever happens, and Android switches over to it, I'll gladly remove this version. As for maintainers, I'll be glad to maintain this code, I've been doing it for the past few years with no problems. I'll send a MAINTAINERS entry for it before 3.19-final is out, still need to talk to the Google developers about if they are willing to help with it or not, last I checked they were, which was good. All of these patches have been in linux-next for a while with no reported issues" * tag 'staging-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (1382 commits) Staging: slicoss: Fix long line issues in slicoss.c staging: rtl8712: remove unnecessary else after return staging: comedi: change some printk calls to pr_err staging: rtl8723au: hal: Removed the extra semicolon lustre: Deletion of unnecessary checks before three function calls staging: lustre: fix sparse warnings: static function declaration staging: lustre: fixed sparse warnings related to static declarations staging: unisys: remove duplicate header staging: unisys: remove unneeded structure staging: ft1000 : replace __attribute ((__packed__) with __packed drivers: staging: rtl8192e: Include "asm/unaligned.h" instead of "access_ok.h" in "rtl819x_BAProc.c" Drivers:staging:rtl8192e: Fixed checkpatch warning Drivers:staging:clocking-wizard: Added a newline staging: clocking-wizard: check for a valid clk_name pointer staging: rtl8723au: Hal_InitPGData() avoid unnecessary typecasts staging: rtl8723au: _DisableAnalog(): Avoid zero-init variables unnecessarily staging: rtl8723au: Remove unnecessary wrapper _ResetDigitalProcedure1() staging: rtl8723au: _ResetDigitalProcedure1_92C() reduce code obfuscation staging: rtl8723au: Remove unnecessary wrapper _DisableRFAFEAndResetBB() staging: rtl8723au: _DisableRFAFEAndResetBB8192C(): Reduce code obfuscation ...
Diffstat (limited to 'drivers/android/binder_trace.h')
-rw-r--r--drivers/android/binder_trace.h329
1 files changed, 329 insertions, 0 deletions
diff --git a/drivers/android/binder_trace.h b/drivers/android/binder_trace.h
new file mode 100644
index 000000000000..7f20f3dc8369
--- /dev/null
+++ b/drivers/android/binder_trace.h
@@ -0,0 +1,329 @@
1/*
2 * Copyright (C) 2012 Google, Inc.
3 *
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 */
14
15#undef TRACE_SYSTEM
16#define TRACE_SYSTEM binder
17
18#if !defined(_BINDER_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
19#define _BINDER_TRACE_H
20
21#include <linux/tracepoint.h>
22
23struct binder_buffer;
24struct binder_node;
25struct binder_proc;
26struct binder_ref;
27struct binder_thread;
28struct binder_transaction;
29
30TRACE_EVENT(binder_ioctl,
31 TP_PROTO(unsigned int cmd, unsigned long arg),
32 TP_ARGS(cmd, arg),
33
34 TP_STRUCT__entry(
35 __field(unsigned int, cmd)
36 __field(unsigned long, arg)
37 ),
38 TP_fast_assign(
39 __entry->cmd = cmd;
40 __entry->arg = arg;
41 ),
42 TP_printk("cmd=0x%x arg=0x%lx", __entry->cmd, __entry->arg)
43);
44
45DECLARE_EVENT_CLASS(binder_lock_class,
46 TP_PROTO(const char *tag),
47 TP_ARGS(tag),
48 TP_STRUCT__entry(
49 __field(const char *, tag)
50 ),
51 TP_fast_assign(
52 __entry->tag = tag;
53 ),
54 TP_printk("tag=%s", __entry->tag)
55);
56
57#define DEFINE_BINDER_LOCK_EVENT(name) \
58DEFINE_EVENT(binder_lock_class, name, \
59 TP_PROTO(const char *func), \
60 TP_ARGS(func))
61
62DEFINE_BINDER_LOCK_EVENT(binder_lock);
63DEFINE_BINDER_LOCK_EVENT(binder_locked);
64DEFINE_BINDER_LOCK_EVENT(binder_unlock);
65
66DECLARE_EVENT_CLASS(binder_function_return_class,
67 TP_PROTO(int ret),
68 TP_ARGS(ret),
69 TP_STRUCT__entry(
70 __field(int, ret)
71 ),
72 TP_fast_assign(
73 __entry->ret = ret;
74 ),
75 TP_printk("ret=%d", __entry->ret)
76);
77
78#define DEFINE_BINDER_FUNCTION_RETURN_EVENT(name) \
79DEFINE_EVENT(binder_function_return_class, name, \
80 TP_PROTO(int ret), \
81 TP_ARGS(ret))
82
83DEFINE_BINDER_FUNCTION_RETURN_EVENT(binder_ioctl_done);
84DEFINE_BINDER_FUNCTION_RETURN_EVENT(binder_write_done);
85DEFINE_BINDER_FUNCTION_RETURN_EVENT(binder_read_done);
86
87TRACE_EVENT(binder_wait_for_work,
88 TP_PROTO(bool proc_work, bool transaction_stack, bool thread_todo),
89 TP_ARGS(proc_work, transaction_stack, thread_todo),
90
91 TP_STRUCT__entry(
92 __field(bool, proc_work)
93 __field(bool, transaction_stack)
94 __field(bool, thread_todo)
95 ),
96 TP_fast_assign(
97 __entry->proc_work = proc_work;
98 __entry->transaction_stack = transaction_stack;
99 __entry->thread_todo = thread_todo;
100 ),
101 TP_printk("proc_work=%d transaction_stack=%d thread_todo=%d",
102 __entry->proc_work, __entry->transaction_stack,
103 __entry->thread_todo)
104);
105
106TRACE_EVENT(binder_transaction,
107 TP_PROTO(bool reply, struct binder_transaction *t,
108 struct binder_node *target_node),
109 TP_ARGS(reply, t, target_node),
110 TP_STRUCT__entry(
111 __field(int, debug_id)
112 __field(int, target_node)
113 __field(int, to_proc)
114 __field(int, to_thread)
115 __field(int, reply)
116 __field(unsigned int, code)
117 __field(unsigned int, flags)
118 ),
119 TP_fast_assign(
120 __entry->debug_id = t->debug_id;
121 __entry->target_node = target_node ? target_node->debug_id : 0;
122 __entry->to_proc = t->to_proc->pid;
123 __entry->to_thread = t->to_thread ? t->to_thread->pid : 0;
124 __entry->reply = reply;
125 __entry->code = t->code;
126 __entry->flags = t->flags;
127 ),
128 TP_printk("transaction=%d dest_node=%d dest_proc=%d dest_thread=%d reply=%d flags=0x%x code=0x%x",
129 __entry->debug_id, __entry->target_node,
130 __entry->to_proc, __entry->to_thread,
131 __entry->reply, __entry->flags, __entry->code)
132);
133
134TRACE_EVENT(binder_transaction_received,
135 TP_PROTO(struct binder_transaction *t),
136 TP_ARGS(t),
137
138 TP_STRUCT__entry(
139 __field(int, debug_id)
140 ),
141 TP_fast_assign(
142 __entry->debug_id = t->debug_id;
143 ),
144 TP_printk("transaction=%d", __entry->debug_id)
145);
146
147TRACE_EVENT(binder_transaction_node_to_ref,
148 TP_PROTO(struct binder_transaction *t, struct binder_node *node,
149 struct binder_ref *ref),
150 TP_ARGS(t, node, ref),
151
152 TP_STRUCT__entry(
153 __field(int, debug_id)
154 __field(int, node_debug_id)
155 __field(binder_uintptr_t, node_ptr)
156 __field(int, ref_debug_id)
157 __field(uint32_t, ref_desc)
158 ),
159 TP_fast_assign(
160 __entry->debug_id = t->debug_id;
161 __entry->node_debug_id = node->debug_id;
162 __entry->node_ptr = node->ptr;
163 __entry->ref_debug_id = ref->debug_id;
164 __entry->ref_desc = ref->desc;
165 ),
166 TP_printk("transaction=%d node=%d src_ptr=0x%016llx ==> dest_ref=%d dest_desc=%d",
167 __entry->debug_id, __entry->node_debug_id,
168 (u64)__entry->node_ptr,
169 __entry->ref_debug_id, __entry->ref_desc)
170);
171
172TRACE_EVENT(binder_transaction_ref_to_node,
173 TP_PROTO(struct binder_transaction *t, struct binder_ref *ref),
174 TP_ARGS(t, ref),
175
176 TP_STRUCT__entry(
177 __field(int, debug_id)
178 __field(int, ref_debug_id)
179 __field(uint32_t, ref_desc)
180 __field(int, node_debug_id)
181 __field(binder_uintptr_t, node_ptr)
182 ),
183 TP_fast_assign(
184 __entry->debug_id = t->debug_id;
185 __entry->ref_debug_id = ref->debug_id;
186 __entry->ref_desc = ref->desc;
187 __entry->node_debug_id = ref->node->debug_id;
188 __entry->node_ptr = ref->node->ptr;
189 ),
190 TP_printk("transaction=%d node=%d src_ref=%d src_desc=%d ==> dest_ptr=0x%016llx",
191 __entry->debug_id, __entry->node_debug_id,
192 __entry->ref_debug_id, __entry->ref_desc,
193 (u64)__entry->node_ptr)
194);
195
196TRACE_EVENT(binder_transaction_ref_to_ref,
197 TP_PROTO(struct binder_transaction *t, struct binder_ref *src_ref,
198 struct binder_ref *dest_ref),
199 TP_ARGS(t, src_ref, dest_ref),
200
201 TP_STRUCT__entry(
202 __field(int, debug_id)
203 __field(int, node_debug_id)
204 __field(int, src_ref_debug_id)
205 __field(uint32_t, src_ref_desc)
206 __field(int, dest_ref_debug_id)
207 __field(uint32_t, dest_ref_desc)
208 ),
209 TP_fast_assign(
210 __entry->debug_id = t->debug_id;
211 __entry->node_debug_id = src_ref->node->debug_id;
212 __entry->src_ref_debug_id = src_ref->debug_id;
213 __entry->src_ref_desc = src_ref->desc;
214 __entry->dest_ref_debug_id = dest_ref->debug_id;
215 __entry->dest_ref_desc = dest_ref->desc;
216 ),
217 TP_printk("transaction=%d node=%d src_ref=%d src_desc=%d ==> dest_ref=%d dest_desc=%d",
218 __entry->debug_id, __entry->node_debug_id,
219 __entry->src_ref_debug_id, __entry->src_ref_desc,
220 __entry->dest_ref_debug_id, __entry->dest_ref_desc)
221);
222
223TRACE_EVENT(binder_transaction_fd,
224 TP_PROTO(struct binder_transaction *t, int src_fd, int dest_fd),
225 TP_ARGS(t, src_fd, dest_fd),
226
227 TP_STRUCT__entry(
228 __field(int, debug_id)
229 __field(int, src_fd)
230 __field(int, dest_fd)
231 ),
232 TP_fast_assign(
233 __entry->debug_id = t->debug_id;
234 __entry->src_fd = src_fd;
235 __entry->dest_fd = dest_fd;
236 ),
237 TP_printk("transaction=%d src_fd=%d ==> dest_fd=%d",
238 __entry->debug_id, __entry->src_fd, __entry->dest_fd)
239);
240
241DECLARE_EVENT_CLASS(binder_buffer_class,
242 TP_PROTO(struct binder_buffer *buf),
243 TP_ARGS(buf),
244 TP_STRUCT__entry(
245 __field(int, debug_id)
246 __field(size_t, data_size)
247 __field(size_t, offsets_size)
248 ),
249 TP_fast_assign(
250 __entry->debug_id = buf->debug_id;
251 __entry->data_size = buf->data_size;
252 __entry->offsets_size = buf->offsets_size;
253 ),
254 TP_printk("transaction=%d data_size=%zd offsets_size=%zd",
255 __entry->debug_id, __entry->data_size, __entry->offsets_size)
256);
257
258DEFINE_EVENT(binder_buffer_class, binder_transaction_alloc_buf,
259 TP_PROTO(struct binder_buffer *buffer),
260 TP_ARGS(buffer));
261
262DEFINE_EVENT(binder_buffer_class, binder_transaction_buffer_release,
263 TP_PROTO(struct binder_buffer *buffer),
264 TP_ARGS(buffer));
265
266DEFINE_EVENT(binder_buffer_class, binder_transaction_failed_buffer_release,
267 TP_PROTO(struct binder_buffer *buffer),
268 TP_ARGS(buffer));
269
270TRACE_EVENT(binder_update_page_range,
271 TP_PROTO(struct binder_proc *proc, bool allocate,
272 void *start, void *end),
273 TP_ARGS(proc, allocate, start, end),
274 TP_STRUCT__entry(
275 __field(int, proc)
276 __field(bool, allocate)
277 __field(size_t, offset)
278 __field(size_t, size)
279 ),
280 TP_fast_assign(
281 __entry->proc = proc->pid;
282 __entry->allocate = allocate;
283 __entry->offset = start - proc->buffer;
284 __entry->size = end - start;
285 ),
286 TP_printk("proc=%d allocate=%d offset=%zu size=%zu",
287 __entry->proc, __entry->allocate,
288 __entry->offset, __entry->size)
289);
290
291TRACE_EVENT(binder_command,
292 TP_PROTO(uint32_t cmd),
293 TP_ARGS(cmd),
294 TP_STRUCT__entry(
295 __field(uint32_t, cmd)
296 ),
297 TP_fast_assign(
298 __entry->cmd = cmd;
299 ),
300 TP_printk("cmd=0x%x %s",
301 __entry->cmd,
302 _IOC_NR(__entry->cmd) < ARRAY_SIZE(binder_command_strings) ?
303 binder_command_strings[_IOC_NR(__entry->cmd)] :
304 "unknown")
305);
306
307TRACE_EVENT(binder_return,
308 TP_PROTO(uint32_t cmd),
309 TP_ARGS(cmd),
310 TP_STRUCT__entry(
311 __field(uint32_t, cmd)
312 ),
313 TP_fast_assign(
314 __entry->cmd = cmd;
315 ),
316 TP_printk("cmd=0x%x %s",
317 __entry->cmd,
318 _IOC_NR(__entry->cmd) < ARRAY_SIZE(binder_return_strings) ?
319 binder_return_strings[_IOC_NR(__entry->cmd)] :
320 "unknown")
321);
322
323#endif /* _BINDER_TRACE_H */
324
325#undef TRACE_INCLUDE_PATH
326#undef TRACE_INCLUDE_FILE
327#define TRACE_INCLUDE_PATH .
328#define TRACE_INCLUDE_FILE binder_trace
329#include <trace/define_trace.h>