treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / drivers / android / binder_trace.h
blob6731c3cd814550ae9364e9fc071706baf04df5d4
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Copyright (C) 2012 Google, Inc.
4 */
6 #undef TRACE_SYSTEM
7 #define TRACE_SYSTEM binder
9 #if !defined(_BINDER_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
10 #define _BINDER_TRACE_H
12 #include <linux/tracepoint.h>
14 struct binder_buffer;
15 struct binder_node;
16 struct binder_proc;
17 struct binder_alloc;
18 struct binder_ref_data;
19 struct binder_thread;
20 struct binder_transaction;
22 TRACE_EVENT(binder_ioctl,
23 TP_PROTO(unsigned int cmd, unsigned long arg),
24 TP_ARGS(cmd, arg),
26 TP_STRUCT__entry(
27 __field(unsigned int, cmd)
28 __field(unsigned long, arg)
30 TP_fast_assign(
31 __entry->cmd = cmd;
32 __entry->arg = arg;
34 TP_printk("cmd=0x%x arg=0x%lx", __entry->cmd, __entry->arg)
37 DECLARE_EVENT_CLASS(binder_lock_class,
38 TP_PROTO(const char *tag),
39 TP_ARGS(tag),
40 TP_STRUCT__entry(
41 __field(const char *, tag)
43 TP_fast_assign(
44 __entry->tag = tag;
46 TP_printk("tag=%s", __entry->tag)
49 #define DEFINE_BINDER_LOCK_EVENT(name) \
50 DEFINE_EVENT(binder_lock_class, name, \
51 TP_PROTO(const char *func), \
52 TP_ARGS(func))
54 DEFINE_BINDER_LOCK_EVENT(binder_lock);
55 DEFINE_BINDER_LOCK_EVENT(binder_locked);
56 DEFINE_BINDER_LOCK_EVENT(binder_unlock);
58 DECLARE_EVENT_CLASS(binder_function_return_class,
59 TP_PROTO(int ret),
60 TP_ARGS(ret),
61 TP_STRUCT__entry(
62 __field(int, ret)
64 TP_fast_assign(
65 __entry->ret = ret;
67 TP_printk("ret=%d", __entry->ret)
70 #define DEFINE_BINDER_FUNCTION_RETURN_EVENT(name) \
71 DEFINE_EVENT(binder_function_return_class, name, \
72 TP_PROTO(int ret), \
73 TP_ARGS(ret))
75 DEFINE_BINDER_FUNCTION_RETURN_EVENT(binder_ioctl_done);
76 DEFINE_BINDER_FUNCTION_RETURN_EVENT(binder_write_done);
77 DEFINE_BINDER_FUNCTION_RETURN_EVENT(binder_read_done);
79 TRACE_EVENT(binder_wait_for_work,
80 TP_PROTO(bool proc_work, bool transaction_stack, bool thread_todo),
81 TP_ARGS(proc_work, transaction_stack, thread_todo),
83 TP_STRUCT__entry(
84 __field(bool, proc_work)
85 __field(bool, transaction_stack)
86 __field(bool, thread_todo)
88 TP_fast_assign(
89 __entry->proc_work = proc_work;
90 __entry->transaction_stack = transaction_stack;
91 __entry->thread_todo = thread_todo;
93 TP_printk("proc_work=%d transaction_stack=%d thread_todo=%d",
94 __entry->proc_work, __entry->transaction_stack,
95 __entry->thread_todo)
98 TRACE_EVENT(binder_transaction,
99 TP_PROTO(bool reply, struct binder_transaction *t,
100 struct binder_node *target_node),
101 TP_ARGS(reply, t, target_node),
102 TP_STRUCT__entry(
103 __field(int, debug_id)
104 __field(int, target_node)
105 __field(int, to_proc)
106 __field(int, to_thread)
107 __field(int, reply)
108 __field(unsigned int, code)
109 __field(unsigned int, flags)
111 TP_fast_assign(
112 __entry->debug_id = t->debug_id;
113 __entry->target_node = target_node ? target_node->debug_id : 0;
114 __entry->to_proc = t->to_proc->pid;
115 __entry->to_thread = t->to_thread ? t->to_thread->pid : 0;
116 __entry->reply = reply;
117 __entry->code = t->code;
118 __entry->flags = t->flags;
120 TP_printk("transaction=%d dest_node=%d dest_proc=%d dest_thread=%d reply=%d flags=0x%x code=0x%x",
121 __entry->debug_id, __entry->target_node,
122 __entry->to_proc, __entry->to_thread,
123 __entry->reply, __entry->flags, __entry->code)
126 TRACE_EVENT(binder_transaction_received,
127 TP_PROTO(struct binder_transaction *t),
128 TP_ARGS(t),
130 TP_STRUCT__entry(
131 __field(int, debug_id)
133 TP_fast_assign(
134 __entry->debug_id = t->debug_id;
136 TP_printk("transaction=%d", __entry->debug_id)
139 TRACE_EVENT(binder_transaction_node_to_ref,
140 TP_PROTO(struct binder_transaction *t, struct binder_node *node,
141 struct binder_ref_data *rdata),
142 TP_ARGS(t, node, rdata),
144 TP_STRUCT__entry(
145 __field(int, debug_id)
146 __field(int, node_debug_id)
147 __field(binder_uintptr_t, node_ptr)
148 __field(int, ref_debug_id)
149 __field(uint32_t, ref_desc)
151 TP_fast_assign(
152 __entry->debug_id = t->debug_id;
153 __entry->node_debug_id = node->debug_id;
154 __entry->node_ptr = node->ptr;
155 __entry->ref_debug_id = rdata->debug_id;
156 __entry->ref_desc = rdata->desc;
158 TP_printk("transaction=%d node=%d src_ptr=0x%016llx ==> dest_ref=%d dest_desc=%d",
159 __entry->debug_id, __entry->node_debug_id,
160 (u64)__entry->node_ptr,
161 __entry->ref_debug_id, __entry->ref_desc)
164 TRACE_EVENT(binder_transaction_ref_to_node,
165 TP_PROTO(struct binder_transaction *t, struct binder_node *node,
166 struct binder_ref_data *rdata),
167 TP_ARGS(t, node, rdata),
169 TP_STRUCT__entry(
170 __field(int, debug_id)
171 __field(int, ref_debug_id)
172 __field(uint32_t, ref_desc)
173 __field(int, node_debug_id)
174 __field(binder_uintptr_t, node_ptr)
176 TP_fast_assign(
177 __entry->debug_id = t->debug_id;
178 __entry->ref_debug_id = rdata->debug_id;
179 __entry->ref_desc = rdata->desc;
180 __entry->node_debug_id = node->debug_id;
181 __entry->node_ptr = node->ptr;
183 TP_printk("transaction=%d node=%d src_ref=%d src_desc=%d ==> dest_ptr=0x%016llx",
184 __entry->debug_id, __entry->node_debug_id,
185 __entry->ref_debug_id, __entry->ref_desc,
186 (u64)__entry->node_ptr)
189 TRACE_EVENT(binder_transaction_ref_to_ref,
190 TP_PROTO(struct binder_transaction *t, struct binder_node *node,
191 struct binder_ref_data *src_ref,
192 struct binder_ref_data *dest_ref),
193 TP_ARGS(t, node, src_ref, dest_ref),
195 TP_STRUCT__entry(
196 __field(int, debug_id)
197 __field(int, node_debug_id)
198 __field(int, src_ref_debug_id)
199 __field(uint32_t, src_ref_desc)
200 __field(int, dest_ref_debug_id)
201 __field(uint32_t, dest_ref_desc)
203 TP_fast_assign(
204 __entry->debug_id = t->debug_id;
205 __entry->node_debug_id = node->debug_id;
206 __entry->src_ref_debug_id = src_ref->debug_id;
207 __entry->src_ref_desc = src_ref->desc;
208 __entry->dest_ref_debug_id = dest_ref->debug_id;
209 __entry->dest_ref_desc = dest_ref->desc;
211 TP_printk("transaction=%d node=%d src_ref=%d src_desc=%d ==> dest_ref=%d dest_desc=%d",
212 __entry->debug_id, __entry->node_debug_id,
213 __entry->src_ref_debug_id, __entry->src_ref_desc,
214 __entry->dest_ref_debug_id, __entry->dest_ref_desc)
217 TRACE_EVENT(binder_transaction_fd_send,
218 TP_PROTO(struct binder_transaction *t, int fd, size_t offset),
219 TP_ARGS(t, fd, offset),
221 TP_STRUCT__entry(
222 __field(int, debug_id)
223 __field(int, fd)
224 __field(size_t, offset)
226 TP_fast_assign(
227 __entry->debug_id = t->debug_id;
228 __entry->fd = fd;
229 __entry->offset = offset;
231 TP_printk("transaction=%d src_fd=%d offset=%zu",
232 __entry->debug_id, __entry->fd, __entry->offset)
235 TRACE_EVENT(binder_transaction_fd_recv,
236 TP_PROTO(struct binder_transaction *t, int fd, size_t offset),
237 TP_ARGS(t, fd, offset),
239 TP_STRUCT__entry(
240 __field(int, debug_id)
241 __field(int, fd)
242 __field(size_t, offset)
244 TP_fast_assign(
245 __entry->debug_id = t->debug_id;
246 __entry->fd = fd;
247 __entry->offset = offset;
249 TP_printk("transaction=%d dest_fd=%d offset=%zu",
250 __entry->debug_id, __entry->fd, __entry->offset)
253 DECLARE_EVENT_CLASS(binder_buffer_class,
254 TP_PROTO(struct binder_buffer *buf),
255 TP_ARGS(buf),
256 TP_STRUCT__entry(
257 __field(int, debug_id)
258 __field(size_t, data_size)
259 __field(size_t, offsets_size)
260 __field(size_t, extra_buffers_size)
262 TP_fast_assign(
263 __entry->debug_id = buf->debug_id;
264 __entry->data_size = buf->data_size;
265 __entry->offsets_size = buf->offsets_size;
266 __entry->extra_buffers_size = buf->extra_buffers_size;
268 TP_printk("transaction=%d data_size=%zd offsets_size=%zd extra_buffers_size=%zd",
269 __entry->debug_id, __entry->data_size, __entry->offsets_size,
270 __entry->extra_buffers_size)
273 DEFINE_EVENT(binder_buffer_class, binder_transaction_alloc_buf,
274 TP_PROTO(struct binder_buffer *buffer),
275 TP_ARGS(buffer));
277 DEFINE_EVENT(binder_buffer_class, binder_transaction_buffer_release,
278 TP_PROTO(struct binder_buffer *buffer),
279 TP_ARGS(buffer));
281 DEFINE_EVENT(binder_buffer_class, binder_transaction_failed_buffer_release,
282 TP_PROTO(struct binder_buffer *buffer),
283 TP_ARGS(buffer));
285 TRACE_EVENT(binder_update_page_range,
286 TP_PROTO(struct binder_alloc *alloc, bool allocate,
287 void __user *start, void __user *end),
288 TP_ARGS(alloc, allocate, start, end),
289 TP_STRUCT__entry(
290 __field(int, proc)
291 __field(bool, allocate)
292 __field(size_t, offset)
293 __field(size_t, size)
295 TP_fast_assign(
296 __entry->proc = alloc->pid;
297 __entry->allocate = allocate;
298 __entry->offset = start - alloc->buffer;
299 __entry->size = end - start;
301 TP_printk("proc=%d allocate=%d offset=%zu size=%zu",
302 __entry->proc, __entry->allocate,
303 __entry->offset, __entry->size)
306 DECLARE_EVENT_CLASS(binder_lru_page_class,
307 TP_PROTO(const struct binder_alloc *alloc, size_t page_index),
308 TP_ARGS(alloc, page_index),
309 TP_STRUCT__entry(
310 __field(int, proc)
311 __field(size_t, page_index)
313 TP_fast_assign(
314 __entry->proc = alloc->pid;
315 __entry->page_index = page_index;
317 TP_printk("proc=%d page_index=%zu",
318 __entry->proc, __entry->page_index)
321 DEFINE_EVENT(binder_lru_page_class, binder_alloc_lru_start,
322 TP_PROTO(const struct binder_alloc *alloc, size_t page_index),
323 TP_ARGS(alloc, page_index));
325 DEFINE_EVENT(binder_lru_page_class, binder_alloc_lru_end,
326 TP_PROTO(const struct binder_alloc *alloc, size_t page_index),
327 TP_ARGS(alloc, page_index));
329 DEFINE_EVENT(binder_lru_page_class, binder_free_lru_start,
330 TP_PROTO(const struct binder_alloc *alloc, size_t page_index),
331 TP_ARGS(alloc, page_index));
333 DEFINE_EVENT(binder_lru_page_class, binder_free_lru_end,
334 TP_PROTO(const struct binder_alloc *alloc, size_t page_index),
335 TP_ARGS(alloc, page_index));
337 DEFINE_EVENT(binder_lru_page_class, binder_alloc_page_start,
338 TP_PROTO(const struct binder_alloc *alloc, size_t page_index),
339 TP_ARGS(alloc, page_index));
341 DEFINE_EVENT(binder_lru_page_class, binder_alloc_page_end,
342 TP_PROTO(const struct binder_alloc *alloc, size_t page_index),
343 TP_ARGS(alloc, page_index));
345 DEFINE_EVENT(binder_lru_page_class, binder_unmap_user_start,
346 TP_PROTO(const struct binder_alloc *alloc, size_t page_index),
347 TP_ARGS(alloc, page_index));
349 DEFINE_EVENT(binder_lru_page_class, binder_unmap_user_end,
350 TP_PROTO(const struct binder_alloc *alloc, size_t page_index),
351 TP_ARGS(alloc, page_index));
353 DEFINE_EVENT(binder_lru_page_class, binder_unmap_kernel_start,
354 TP_PROTO(const struct binder_alloc *alloc, size_t page_index),
355 TP_ARGS(alloc, page_index));
357 DEFINE_EVENT(binder_lru_page_class, binder_unmap_kernel_end,
358 TP_PROTO(const struct binder_alloc *alloc, size_t page_index),
359 TP_ARGS(alloc, page_index));
361 TRACE_EVENT(binder_command,
362 TP_PROTO(uint32_t cmd),
363 TP_ARGS(cmd),
364 TP_STRUCT__entry(
365 __field(uint32_t, cmd)
367 TP_fast_assign(
368 __entry->cmd = cmd;
370 TP_printk("cmd=0x%x %s",
371 __entry->cmd,
372 _IOC_NR(__entry->cmd) < ARRAY_SIZE(binder_command_strings) ?
373 binder_command_strings[_IOC_NR(__entry->cmd)] :
374 "unknown")
377 TRACE_EVENT(binder_return,
378 TP_PROTO(uint32_t cmd),
379 TP_ARGS(cmd),
380 TP_STRUCT__entry(
381 __field(uint32_t, cmd)
383 TP_fast_assign(
384 __entry->cmd = cmd;
386 TP_printk("cmd=0x%x %s",
387 __entry->cmd,
388 _IOC_NR(__entry->cmd) < ARRAY_SIZE(binder_return_strings) ?
389 binder_return_strings[_IOC_NR(__entry->cmd)] :
390 "unknown")
393 #endif /* _BINDER_TRACE_H */
395 #undef TRACE_INCLUDE_PATH
396 #undef TRACE_INCLUDE_FILE
397 #define TRACE_INCLUDE_PATH .
398 #define TRACE_INCLUDE_FILE binder_trace
399 #include <trace/define_trace.h>