aboutsummaryrefslogtreecommitdiffstats
path: root/include/trace
diff options
context:
space:
mode:
Diffstat (limited to 'include/trace')
-rw-r--r--include/trace/define_trace.h11
-rw-r--r--include/trace/events/bkl.h61
-rw-r--r--include/trace/events/block.h202
-rw-r--r--include/trace/events/ext4.h129
-rw-r--r--include/trace/events/irq.h52
-rw-r--r--include/trace/events/jbd2.h63
-rw-r--r--include/trace/events/kmem.h130
-rw-r--r--include/trace/events/lock.h (renamed from include/trace/events/lockdep.h)8
-rw-r--r--include/trace/events/module.h22
-rw-r--r--include/trace/events/power.h38
-rw-r--r--include/trace/events/sched.h217
-rw-r--r--include/trace/events/signal.h173
-rw-r--r--include/trace/events/timer.h79
-rw-r--r--include/trace/events/workqueue.h22
-rw-r--r--include/trace/ftrace.h323
-rw-r--r--include/trace/syscall.h33
16 files changed, 807 insertions, 756 deletions
diff --git a/include/trace/define_trace.h b/include/trace/define_trace.h
index 2a4b3bf74033..5acfb1eb4df9 100644
--- a/include/trace/define_trace.h
+++ b/include/trace/define_trace.h
@@ -31,6 +31,14 @@
31 assign, print, reg, unreg) \ 31 assign, print, reg, unreg) \
32 DEFINE_TRACE_FN(name, reg, unreg) 32 DEFINE_TRACE_FN(name, reg, unreg)
33 33
34#undef DEFINE_EVENT
35#define DEFINE_EVENT(template, name, proto, args) \
36 DEFINE_TRACE(name)
37
38#undef DEFINE_EVENT_PRINT
39#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
40 DEFINE_TRACE(name)
41
34#undef DECLARE_TRACE 42#undef DECLARE_TRACE
35#define DECLARE_TRACE(name, proto, args) \ 43#define DECLARE_TRACE(name, proto, args) \
36 DEFINE_TRACE(name) 44 DEFINE_TRACE(name)
@@ -63,6 +71,9 @@
63 71
64#undef TRACE_EVENT 72#undef TRACE_EVENT
65#undef TRACE_EVENT_FN 73#undef TRACE_EVENT_FN
74#undef DECLARE_EVENT_CLASS
75#undef DEFINE_EVENT
76#undef DEFINE_EVENT_PRINT
66#undef TRACE_HEADER_MULTI_READ 77#undef TRACE_HEADER_MULTI_READ
67 78
68/* Only undef what we defined in this file */ 79/* Only undef what we defined in this file */
diff --git a/include/trace/events/bkl.h b/include/trace/events/bkl.h
new file mode 100644
index 000000000000..1af72dc24278
--- /dev/null
+++ b/include/trace/events/bkl.h
@@ -0,0 +1,61 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM bkl
3
4#if !defined(_TRACE_BKL_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_BKL_H
6
7#include <linux/tracepoint.h>
8
9TRACE_EVENT(lock_kernel,
10
11 TP_PROTO(const char *func, const char *file, int line),
12
13 TP_ARGS(func, file, line),
14
15 TP_STRUCT__entry(
16 __field( int, depth )
17 __field_ext( const char *, func, FILTER_PTR_STRING )
18 __field_ext( const char *, file, FILTER_PTR_STRING )
19 __field( int, line )
20 ),
21
22 TP_fast_assign(
23 /* We want to record the lock_depth after lock is acquired */
24 __entry->depth = current->lock_depth + 1;
25 __entry->func = func;
26 __entry->file = file;
27 __entry->line = line;
28 ),
29
30 TP_printk("depth=%d file:line=%s:%d func=%s()", __entry->depth,
31 __entry->file, __entry->line, __entry->func)
32);
33
34TRACE_EVENT(unlock_kernel,
35
36 TP_PROTO(const char *func, const char *file, int line),
37
38 TP_ARGS(func, file, line),
39
40 TP_STRUCT__entry(
41 __field(int, depth )
42 __field(const char *, func )
43 __field(const char *, file )
44 __field(int, line )
45 ),
46
47 TP_fast_assign(
48 __entry->depth = current->lock_depth;
49 __entry->func = func;
50 __entry->file = file;
51 __entry->line = line;
52 ),
53
54 TP_printk("depth=%d file:line=%s:%d func=%s()", __entry->depth,
55 __entry->file, __entry->line, __entry->func)
56);
57
58#endif /* _TRACE_BKL_H */
59
60/* This part must be outside protection */
61#include <trace/define_trace.h>
diff --git a/include/trace/events/block.h b/include/trace/events/block.h
index 00405b5f624a..5fb72733331e 100644
--- a/include/trace/events/block.h
+++ b/include/trace/events/block.h
@@ -8,7 +8,7 @@
8#include <linux/blkdev.h> 8#include <linux/blkdev.h>
9#include <linux/tracepoint.h> 9#include <linux/tracepoint.h>
10 10
11TRACE_EVENT(block_rq_abort, 11DECLARE_EVENT_CLASS(block_rq_with_error,
12 12
13 TP_PROTO(struct request_queue *q, struct request *rq), 13 TP_PROTO(struct request_queue *q, struct request *rq),
14 14
@@ -40,41 +40,28 @@ TRACE_EVENT(block_rq_abort,
40 __entry->nr_sector, __entry->errors) 40 __entry->nr_sector, __entry->errors)
41); 41);
42 42
43TRACE_EVENT(block_rq_insert, 43DEFINE_EVENT(block_rq_with_error, block_rq_abort,
44 44
45 TP_PROTO(struct request_queue *q, struct request *rq), 45 TP_PROTO(struct request_queue *q, struct request *rq),
46 46
47 TP_ARGS(q, rq), 47 TP_ARGS(q, rq)
48);
48 49
49 TP_STRUCT__entry( 50DEFINE_EVENT(block_rq_with_error, block_rq_requeue,
50 __field( dev_t, dev )
51 __field( sector_t, sector )
52 __field( unsigned int, nr_sector )
53 __field( unsigned int, bytes )
54 __array( char, rwbs, 6 )
55 __array( char, comm, TASK_COMM_LEN )
56 __dynamic_array( char, cmd, blk_cmd_buf_len(rq) )
57 ),
58 51
59 TP_fast_assign( 52 TP_PROTO(struct request_queue *q, struct request *rq),
60 __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0;
61 __entry->sector = blk_pc_request(rq) ? 0 : blk_rq_pos(rq);
62 __entry->nr_sector = blk_pc_request(rq) ? 0 : blk_rq_sectors(rq);
63 __entry->bytes = blk_pc_request(rq) ? blk_rq_bytes(rq) : 0;
64 53
65 blk_fill_rwbs_rq(__entry->rwbs, rq); 54 TP_ARGS(q, rq)
66 blk_dump_cmd(__get_str(cmd), rq); 55);
67 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
68 ),
69 56
70 TP_printk("%d,%d %s %u (%s) %llu + %u [%s]", 57DEFINE_EVENT(block_rq_with_error, block_rq_complete,
71 MAJOR(__entry->dev), MINOR(__entry->dev), 58
72 __entry->rwbs, __entry->bytes, __get_str(cmd), 59 TP_PROTO(struct request_queue *q, struct request *rq),
73 (unsigned long long)__entry->sector, 60
74 __entry->nr_sector, __entry->comm) 61 TP_ARGS(q, rq)
75); 62);
76 63
77TRACE_EVENT(block_rq_issue, 64DECLARE_EVENT_CLASS(block_rq,
78 65
79 TP_PROTO(struct request_queue *q, struct request *rq), 66 TP_PROTO(struct request_queue *q, struct request *rq),
80 67
@@ -86,7 +73,7 @@ TRACE_EVENT(block_rq_issue,
86 __field( unsigned int, nr_sector ) 73 __field( unsigned int, nr_sector )
87 __field( unsigned int, bytes ) 74 __field( unsigned int, bytes )
88 __array( char, rwbs, 6 ) 75 __array( char, rwbs, 6 )
89 __array( char, comm, TASK_COMM_LEN ) 76 __array( char, comm, TASK_COMM_LEN )
90 __dynamic_array( char, cmd, blk_cmd_buf_len(rq) ) 77 __dynamic_array( char, cmd, blk_cmd_buf_len(rq) )
91 ), 78 ),
92 79
@@ -108,68 +95,18 @@ TRACE_EVENT(block_rq_issue,
108 __entry->nr_sector, __entry->comm) 95 __entry->nr_sector, __entry->comm)
109); 96);
110 97
111TRACE_EVENT(block_rq_requeue, 98DEFINE_EVENT(block_rq, block_rq_insert,
112 99
113 TP_PROTO(struct request_queue *q, struct request *rq), 100 TP_PROTO(struct request_queue *q, struct request *rq),
114 101
115 TP_ARGS(q, rq), 102 TP_ARGS(q, rq)
116
117 TP_STRUCT__entry(
118 __field( dev_t, dev )
119 __field( sector_t, sector )
120 __field( unsigned int, nr_sector )
121 __field( int, errors )
122 __array( char, rwbs, 6 )
123 __dynamic_array( char, cmd, blk_cmd_buf_len(rq) )
124 ),
125
126 TP_fast_assign(
127 __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0;
128 __entry->sector = blk_pc_request(rq) ? 0 : blk_rq_pos(rq);
129 __entry->nr_sector = blk_pc_request(rq) ? 0 : blk_rq_sectors(rq);
130 __entry->errors = rq->errors;
131
132 blk_fill_rwbs_rq(__entry->rwbs, rq);
133 blk_dump_cmd(__get_str(cmd), rq);
134 ),
135
136 TP_printk("%d,%d %s (%s) %llu + %u [%d]",
137 MAJOR(__entry->dev), MINOR(__entry->dev),
138 __entry->rwbs, __get_str(cmd),
139 (unsigned long long)__entry->sector,
140 __entry->nr_sector, __entry->errors)
141); 103);
142 104
143TRACE_EVENT(block_rq_complete, 105DEFINE_EVENT(block_rq, block_rq_issue,
144 106
145 TP_PROTO(struct request_queue *q, struct request *rq), 107 TP_PROTO(struct request_queue *q, struct request *rq),
146 108
147 TP_ARGS(q, rq), 109 TP_ARGS(q, rq)
148
149 TP_STRUCT__entry(
150 __field( dev_t, dev )
151 __field( sector_t, sector )
152 __field( unsigned int, nr_sector )
153 __field( int, errors )
154 __array( char, rwbs, 6 )
155 __dynamic_array( char, cmd, blk_cmd_buf_len(rq) )
156 ),
157
158 TP_fast_assign(
159 __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0;
160 __entry->sector = blk_pc_request(rq) ? 0 : blk_rq_pos(rq);
161 __entry->nr_sector = blk_pc_request(rq) ? 0 : blk_rq_sectors(rq);
162 __entry->errors = rq->errors;
163
164 blk_fill_rwbs_rq(__entry->rwbs, rq);
165 blk_dump_cmd(__get_str(cmd), rq);
166 ),
167
168 TP_printk("%d,%d %s (%s) %llu + %u [%d]",
169 MAJOR(__entry->dev), MINOR(__entry->dev),
170 __entry->rwbs, __get_str(cmd),
171 (unsigned long long)__entry->sector,
172 __entry->nr_sector, __entry->errors)
173); 110);
174 111
175TRACE_EVENT(block_bio_bounce, 112TRACE_EVENT(block_bio_bounce,
@@ -228,7 +165,7 @@ TRACE_EVENT(block_bio_complete,
228 __entry->nr_sector, __entry->error) 165 __entry->nr_sector, __entry->error)
229); 166);
230 167
231TRACE_EVENT(block_bio_backmerge, 168DECLARE_EVENT_CLASS(block_bio,
232 169
233 TP_PROTO(struct request_queue *q, struct bio *bio), 170 TP_PROTO(struct request_queue *q, struct bio *bio),
234 171
@@ -256,63 +193,28 @@ TRACE_EVENT(block_bio_backmerge,
256 __entry->nr_sector, __entry->comm) 193 __entry->nr_sector, __entry->comm)
257); 194);
258 195
259TRACE_EVENT(block_bio_frontmerge, 196DEFINE_EVENT(block_bio, block_bio_backmerge,
260 197
261 TP_PROTO(struct request_queue *q, struct bio *bio), 198 TP_PROTO(struct request_queue *q, struct bio *bio),
262 199
263 TP_ARGS(q, bio), 200 TP_ARGS(q, bio)
264
265 TP_STRUCT__entry(
266 __field( dev_t, dev )
267 __field( sector_t, sector )
268 __field( unsigned, nr_sector )
269 __array( char, rwbs, 6 )
270 __array( char, comm, TASK_COMM_LEN )
271 ),
272
273 TP_fast_assign(
274 __entry->dev = bio->bi_bdev->bd_dev;
275 __entry->sector = bio->bi_sector;
276 __entry->nr_sector = bio->bi_size >> 9;
277 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
278 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
279 ),
280
281 TP_printk("%d,%d %s %llu + %u [%s]",
282 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
283 (unsigned long long)__entry->sector,
284 __entry->nr_sector, __entry->comm)
285); 201);
286 202
287TRACE_EVENT(block_bio_queue, 203DEFINE_EVENT(block_bio, block_bio_frontmerge,
288 204
289 TP_PROTO(struct request_queue *q, struct bio *bio), 205 TP_PROTO(struct request_queue *q, struct bio *bio),
290 206
291 TP_ARGS(q, bio), 207 TP_ARGS(q, bio)
208);
292 209
293 TP_STRUCT__entry( 210DEFINE_EVENT(block_bio, block_bio_queue,
294 __field( dev_t, dev )
295 __field( sector_t, sector )
296 __field( unsigned int, nr_sector )
297 __array( char, rwbs, 6 )
298 __array( char, comm, TASK_COMM_LEN )
299 ),
300 211
301 TP_fast_assign( 212 TP_PROTO(struct request_queue *q, struct bio *bio),
302 __entry->dev = bio->bi_bdev->bd_dev;
303 __entry->sector = bio->bi_sector;
304 __entry->nr_sector = bio->bi_size >> 9;
305 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
306 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
307 ),
308 213
309 TP_printk("%d,%d %s %llu + %u [%s]", 214 TP_ARGS(q, bio)
310 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
311 (unsigned long long)__entry->sector,
312 __entry->nr_sector, __entry->comm)
313); 215);
314 216
315TRACE_EVENT(block_getrq, 217DECLARE_EVENT_CLASS(block_get_rq,
316 218
317 TP_PROTO(struct request_queue *q, struct bio *bio, int rw), 219 TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
318 220
@@ -341,33 +243,18 @@ TRACE_EVENT(block_getrq,
341 __entry->nr_sector, __entry->comm) 243 __entry->nr_sector, __entry->comm)
342); 244);
343 245
344TRACE_EVENT(block_sleeprq, 246DEFINE_EVENT(block_get_rq, block_getrq,
345 247
346 TP_PROTO(struct request_queue *q, struct bio *bio, int rw), 248 TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
347 249
348 TP_ARGS(q, bio, rw), 250 TP_ARGS(q, bio, rw)
251);
349 252
350 TP_STRUCT__entry( 253DEFINE_EVENT(block_get_rq, block_sleeprq,
351 __field( dev_t, dev )
352 __field( sector_t, sector )
353 __field( unsigned int, nr_sector )
354 __array( char, rwbs, 6 )
355 __array( char, comm, TASK_COMM_LEN )
356 ),
357 254
358 TP_fast_assign( 255 TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
359 __entry->dev = bio ? bio->bi_bdev->bd_dev : 0;
360 __entry->sector = bio ? bio->bi_sector : 0;
361 __entry->nr_sector = bio ? bio->bi_size >> 9 : 0;
362 blk_fill_rwbs(__entry->rwbs,
363 bio ? bio->bi_rw : 0, __entry->nr_sector);
364 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
365 ),
366 256
367 TP_printk("%d,%d %s %llu + %u [%s]", 257 TP_ARGS(q, bio, rw)
368 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
369 (unsigned long long)__entry->sector,
370 __entry->nr_sector, __entry->comm)
371); 258);
372 259
373TRACE_EVENT(block_plug, 260TRACE_EVENT(block_plug,
@@ -387,7 +274,7 @@ TRACE_EVENT(block_plug,
387 TP_printk("[%s]", __entry->comm) 274 TP_printk("[%s]", __entry->comm)
388); 275);
389 276
390TRACE_EVENT(block_unplug_timer, 277DECLARE_EVENT_CLASS(block_unplug,
391 278
392 TP_PROTO(struct request_queue *q), 279 TP_PROTO(struct request_queue *q),
393 280
@@ -406,23 +293,18 @@ TRACE_EVENT(block_unplug_timer,
406 TP_printk("[%s] %d", __entry->comm, __entry->nr_rq) 293 TP_printk("[%s] %d", __entry->comm, __entry->nr_rq)
407); 294);
408 295
409TRACE_EVENT(block_unplug_io, 296DEFINE_EVENT(block_unplug, block_unplug_timer,
410 297
411 TP_PROTO(struct request_queue *q), 298 TP_PROTO(struct request_queue *q),
412 299
413 TP_ARGS(q), 300 TP_ARGS(q)
301);
414 302
415 TP_STRUCT__entry( 303DEFINE_EVENT(block_unplug, block_unplug_io,
416 __field( int, nr_rq )
417 __array( char, comm, TASK_COMM_LEN )
418 ),
419 304
420 TP_fast_assign( 305 TP_PROTO(struct request_queue *q),
421 __entry->nr_rq = q->rq.count[READ] + q->rq.count[WRITE];
422 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
423 ),
424 306
425 TP_printk("[%s] %d", __entry->comm, __entry->nr_rq) 307 TP_ARGS(q)
426); 308);
427 309
428TRACE_EVENT(block_split, 310TRACE_EVENT(block_split,
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index d09550bf3f95..318f76535bd4 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -90,7 +90,7 @@ TRACE_EVENT(ext4_allocate_inode,
90 (unsigned long) __entry->dir, __entry->mode) 90 (unsigned long) __entry->dir, __entry->mode)
91); 91);
92 92
93TRACE_EVENT(ext4_write_begin, 93DECLARE_EVENT_CLASS(ext4__write_begin,
94 94
95 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, 95 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
96 unsigned int flags), 96 unsigned int flags),
@@ -118,7 +118,23 @@ TRACE_EVENT(ext4_write_begin,
118 __entry->pos, __entry->len, __entry->flags) 118 __entry->pos, __entry->len, __entry->flags)
119); 119);
120 120
121TRACE_EVENT(ext4_ordered_write_end, 121DEFINE_EVENT(ext4__write_begin, ext4_write_begin,
122
123 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
124 unsigned int flags),
125
126 TP_ARGS(inode, pos, len, flags)
127);
128
129DEFINE_EVENT(ext4__write_begin, ext4_da_write_begin,
130
131 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
132 unsigned int flags),
133
134 TP_ARGS(inode, pos, len, flags)
135);
136
137DECLARE_EVENT_CLASS(ext4__write_end,
122 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, 138 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
123 unsigned int copied), 139 unsigned int copied),
124 140
@@ -145,57 +161,36 @@ TRACE_EVENT(ext4_ordered_write_end,
145 __entry->pos, __entry->len, __entry->copied) 161 __entry->pos, __entry->len, __entry->copied)
146); 162);
147 163
148TRACE_EVENT(ext4_writeback_write_end, 164DEFINE_EVENT(ext4__write_end, ext4_ordered_write_end,
165
149 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, 166 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
150 unsigned int copied), 167 unsigned int copied),
151 168
152 TP_ARGS(inode, pos, len, copied), 169 TP_ARGS(inode, pos, len, copied)
170);
153 171
154 TP_STRUCT__entry( 172DEFINE_EVENT(ext4__write_end, ext4_writeback_write_end,
155 __field( dev_t, dev )
156 __field( ino_t, ino )
157 __field( loff_t, pos )
158 __field( unsigned int, len )
159 __field( unsigned int, copied )
160 ),
161 173
162 TP_fast_assign( 174 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
163 __entry->dev = inode->i_sb->s_dev; 175 unsigned int copied),
164 __entry->ino = inode->i_ino;
165 __entry->pos = pos;
166 __entry->len = len;
167 __entry->copied = copied;
168 ),
169 176
170 TP_printk("dev %s ino %lu pos %llu len %u copied %u", 177 TP_ARGS(inode, pos, len, copied)
171 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
172 __entry->pos, __entry->len, __entry->copied)
173); 178);
174 179
175TRACE_EVENT(ext4_journalled_write_end, 180DEFINE_EVENT(ext4__write_end, ext4_journalled_write_end,
181
176 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, 182 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
177 unsigned int copied), 183 unsigned int copied),
178 TP_ARGS(inode, pos, len, copied),
179 184
180 TP_STRUCT__entry( 185 TP_ARGS(inode, pos, len, copied)
181 __field( dev_t, dev ) 186);
182 __field( ino_t, ino )
183 __field( loff_t, pos )
184 __field( unsigned int, len )
185 __field( unsigned int, copied )
186 ),
187 187
188 TP_fast_assign( 188DEFINE_EVENT(ext4__write_end, ext4_da_write_end,
189 __entry->dev = inode->i_sb->s_dev;
190 __entry->ino = inode->i_ino;
191 __entry->pos = pos;
192 __entry->len = len;
193 __entry->copied = copied;
194 ),
195 189
196 TP_printk("dev %s ino %lu pos %llu len %u copied %u", 190 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
197 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, 191 unsigned int copied),
198 __entry->pos, __entry->len, __entry->copied) 192
193 TP_ARGS(inode, pos, len, copied)
199); 194);
200 195
201TRACE_EVENT(ext4_writepage, 196TRACE_EVENT(ext4_writepage,
@@ -337,60 +332,6 @@ TRACE_EVENT(ext4_da_writepages_result,
337 (unsigned long) __entry->writeback_index) 332 (unsigned long) __entry->writeback_index)
338); 333);
339 334
340TRACE_EVENT(ext4_da_write_begin,
341 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
342 unsigned int flags),
343
344 TP_ARGS(inode, pos, len, flags),
345
346 TP_STRUCT__entry(
347 __field( dev_t, dev )
348 __field( ino_t, ino )
349 __field( loff_t, pos )
350 __field( unsigned int, len )
351 __field( unsigned int, flags )
352 ),
353
354 TP_fast_assign(
355 __entry->dev = inode->i_sb->s_dev;
356 __entry->ino = inode->i_ino;
357 __entry->pos = pos;
358 __entry->len = len;
359 __entry->flags = flags;
360 ),
361
362 TP_printk("dev %s ino %lu pos %llu len %u flags %u",
363 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
364 __entry->pos, __entry->len, __entry->flags)
365);
366
367TRACE_EVENT(ext4_da_write_end,
368 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
369 unsigned int copied),
370
371 TP_ARGS(inode, pos, len, copied),
372
373 TP_STRUCT__entry(
374 __field( dev_t, dev )
375 __field( ino_t, ino )
376 __field( loff_t, pos )
377 __field( unsigned int, len )
378 __field( unsigned int, copied )
379 ),
380
381 TP_fast_assign(
382 __entry->dev = inode->i_sb->s_dev;
383 __entry->ino = inode->i_ino;
384 __entry->pos = pos;
385 __entry->len = len;
386 __entry->copied = copied;
387 ),
388
389 TP_printk("dev %s ino %lu pos %llu len %u copied %u",
390 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
391 __entry->pos, __entry->len, __entry->copied)
392);
393
394TRACE_EVENT(ext4_discard_blocks, 335TRACE_EVENT(ext4_discard_blocks,
395 TP_PROTO(struct super_block *sb, unsigned long long blk, 336 TP_PROTO(struct super_block *sb, unsigned long long blk,
396 unsigned long long count), 337 unsigned long long count),
diff --git a/include/trace/events/irq.h b/include/trace/events/irq.h
index b89f9db4a404..0e4cfb694fe7 100644
--- a/include/trace/events/irq.h
+++ b/include/trace/events/irq.h
@@ -48,7 +48,7 @@ TRACE_EVENT(irq_handler_entry,
48 __assign_str(name, action->name); 48 __assign_str(name, action->name);
49 ), 49 ),
50 50
51 TP_printk("irq=%d handler=%s", __entry->irq, __get_str(name)) 51 TP_printk("irq=%d name=%s", __entry->irq, __get_str(name))
52); 52);
53 53
54/** 54/**
@@ -78,22 +78,11 @@ TRACE_EVENT(irq_handler_exit,
78 __entry->ret = ret; 78 __entry->ret = ret;
79 ), 79 ),
80 80
81 TP_printk("irq=%d return=%s", 81 TP_printk("irq=%d ret=%s",
82 __entry->irq, __entry->ret ? "handled" : "unhandled") 82 __entry->irq, __entry->ret ? "handled" : "unhandled")
83); 83);
84 84
85/** 85DECLARE_EVENT_CLASS(softirq,
86 * softirq_entry - called immediately before the softirq handler
87 * @h: pointer to struct softirq_action
88 * @vec: pointer to first struct softirq_action in softirq_vec array
89 *
90 * The @h parameter, contains a pointer to the struct softirq_action
91 * which has a pointer to the action handler that is called. By subtracting
92 * the @vec pointer from the @h pointer, we can determine the softirq
93 * number. Also, when used in combination with the softirq_exit tracepoint
94 * we can determine the softirq latency.
95 */
96TRACE_EVENT(softirq_entry,
97 86
98 TP_PROTO(struct softirq_action *h, struct softirq_action *vec), 87 TP_PROTO(struct softirq_action *h, struct softirq_action *vec),
99 88
@@ -107,11 +96,29 @@ TRACE_EVENT(softirq_entry,
107 __entry->vec = (int)(h - vec); 96 __entry->vec = (int)(h - vec);
108 ), 97 ),
109 98
110 TP_printk("softirq=%d action=%s", __entry->vec, 99 TP_printk("vec=%d [action=%s]", __entry->vec,
111 show_softirq_name(__entry->vec)) 100 show_softirq_name(__entry->vec))
112); 101);
113 102
114/** 103/**
104 * softirq_entry - called immediately before the softirq handler
105 * @h: pointer to struct softirq_action
106 * @vec: pointer to first struct softirq_action in softirq_vec array
107 *
108 * The @h parameter, contains a pointer to the struct softirq_action
109 * which has a pointer to the action handler that is called. By subtracting
110 * the @vec pointer from the @h pointer, we can determine the softirq
111 * number. Also, when used in combination with the softirq_exit tracepoint
112 * we can determine the softirq latency.
113 */
114DEFINE_EVENT(softirq, softirq_entry,
115
116 TP_PROTO(struct softirq_action *h, struct softirq_action *vec),
117
118 TP_ARGS(h, vec)
119);
120
121/**
115 * softirq_exit - called immediately after the softirq handler returns 122 * softirq_exit - called immediately after the softirq handler returns
116 * @h: pointer to struct softirq_action 123 * @h: pointer to struct softirq_action
117 * @vec: pointer to first struct softirq_action in softirq_vec array 124 * @vec: pointer to first struct softirq_action in softirq_vec array
@@ -122,22 +129,11 @@ TRACE_EVENT(softirq_entry,
122 * combination with the softirq_entry tracepoint we can determine the softirq 129 * combination with the softirq_entry tracepoint we can determine the softirq
123 * latency. 130 * latency.
124 */ 131 */
125TRACE_EVENT(softirq_exit, 132DEFINE_EVENT(softirq, softirq_exit,
126 133
127 TP_PROTO(struct softirq_action *h, struct softirq_action *vec), 134 TP_PROTO(struct softirq_action *h, struct softirq_action *vec),
128 135
129 TP_ARGS(h, vec), 136 TP_ARGS(h, vec)
130
131 TP_STRUCT__entry(
132 __field( int, vec )
133 ),
134
135 TP_fast_assign(
136 __entry->vec = (int)(h - vec);
137 ),
138
139 TP_printk("softirq=%d action=%s", __entry->vec,
140 show_softirq_name(__entry->vec))
141); 137);
142 138
143#endif /* _TRACE_IRQ_H */ 139#endif /* _TRACE_IRQ_H */
diff --git a/include/trace/events/jbd2.h b/include/trace/events/jbd2.h
index 3c60b75adb9e..96b370a050de 100644
--- a/include/trace/events/jbd2.h
+++ b/include/trace/events/jbd2.h
@@ -30,7 +30,7 @@ TRACE_EVENT(jbd2_checkpoint,
30 jbd2_dev_to_name(__entry->dev), __entry->result) 30 jbd2_dev_to_name(__entry->dev), __entry->result)
31); 31);
32 32
33TRACE_EVENT(jbd2_start_commit, 33DECLARE_EVENT_CLASS(jbd2_commit,
34 34
35 TP_PROTO(journal_t *journal, transaction_t *commit_transaction), 35 TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
36 36
@@ -53,73 +53,32 @@ TRACE_EVENT(jbd2_start_commit,
53 __entry->sync_commit) 53 __entry->sync_commit)
54); 54);
55 55
56TRACE_EVENT(jbd2_commit_locking, 56DEFINE_EVENT(jbd2_commit, jbd2_start_commit,
57 57
58 TP_PROTO(journal_t *journal, transaction_t *commit_transaction), 58 TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
59 59
60 TP_ARGS(journal, commit_transaction), 60 TP_ARGS(journal, commit_transaction)
61
62 TP_STRUCT__entry(
63 __field( dev_t, dev )
64 __field( char, sync_commit )
65 __field( int, transaction )
66 ),
67
68 TP_fast_assign(
69 __entry->dev = journal->j_fs_dev->bd_dev;
70 __entry->sync_commit = commit_transaction->t_synchronous_commit;
71 __entry->transaction = commit_transaction->t_tid;
72 ),
73
74 TP_printk("dev %s transaction %d sync %d",
75 jbd2_dev_to_name(__entry->dev), __entry->transaction,
76 __entry->sync_commit)
77); 61);
78 62
79TRACE_EVENT(jbd2_commit_flushing, 63DEFINE_EVENT(jbd2_commit, jbd2_commit_locking,
80 64
81 TP_PROTO(journal_t *journal, transaction_t *commit_transaction), 65 TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
82 66
83 TP_ARGS(journal, commit_transaction), 67 TP_ARGS(journal, commit_transaction)
84
85 TP_STRUCT__entry(
86 __field( dev_t, dev )
87 __field( char, sync_commit )
88 __field( int, transaction )
89 ),
90
91 TP_fast_assign(
92 __entry->dev = journal->j_fs_dev->bd_dev;
93 __entry->sync_commit = commit_transaction->t_synchronous_commit;
94 __entry->transaction = commit_transaction->t_tid;
95 ),
96
97 TP_printk("dev %s transaction %d sync %d",
98 jbd2_dev_to_name(__entry->dev), __entry->transaction,
99 __entry->sync_commit)
100); 68);
101 69
102TRACE_EVENT(jbd2_commit_logging, 70DEFINE_EVENT(jbd2_commit, jbd2_commit_flushing,
103 71
104 TP_PROTO(journal_t *journal, transaction_t *commit_transaction), 72 TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
105 73
106 TP_ARGS(journal, commit_transaction), 74 TP_ARGS(journal, commit_transaction)
75);
107 76
108 TP_STRUCT__entry( 77DEFINE_EVENT(jbd2_commit, jbd2_commit_logging,
109 __field( dev_t, dev )
110 __field( char, sync_commit )
111 __field( int, transaction )
112 ),
113 78
114 TP_fast_assign( 79 TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
115 __entry->dev = journal->j_fs_dev->bd_dev;
116 __entry->sync_commit = commit_transaction->t_synchronous_commit;
117 __entry->transaction = commit_transaction->t_tid;
118 ),
119 80
120 TP_printk("dev %s transaction %d sync %d", 81 TP_ARGS(journal, commit_transaction)
121 jbd2_dev_to_name(__entry->dev), __entry->transaction,
122 __entry->sync_commit)
123); 82);
124 83
125TRACE_EVENT(jbd2_end_commit, 84TRACE_EVENT(jbd2_end_commit,
diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h
index eaf46bdd18a5..3adca0ca9dbe 100644
--- a/include/trace/events/kmem.h
+++ b/include/trace/events/kmem.h
@@ -44,7 +44,7 @@
44 {(unsigned long)__GFP_MOVABLE, "GFP_MOVABLE"} \ 44 {(unsigned long)__GFP_MOVABLE, "GFP_MOVABLE"} \
45 ) : "GFP_NOWAIT" 45 ) : "GFP_NOWAIT"
46 46
47TRACE_EVENT(kmalloc, 47DECLARE_EVENT_CLASS(kmem_alloc,
48 48
49 TP_PROTO(unsigned long call_site, 49 TP_PROTO(unsigned long call_site,
50 const void *ptr, 50 const void *ptr,
@@ -78,41 +78,23 @@ TRACE_EVENT(kmalloc,
78 show_gfp_flags(__entry->gfp_flags)) 78 show_gfp_flags(__entry->gfp_flags))
79); 79);
80 80
81TRACE_EVENT(kmem_cache_alloc, 81DEFINE_EVENT(kmem_alloc, kmalloc,
82 82
83 TP_PROTO(unsigned long call_site, 83 TP_PROTO(unsigned long call_site, const void *ptr,
84 const void *ptr, 84 size_t bytes_req, size_t bytes_alloc, gfp_t gfp_flags),
85 size_t bytes_req,
86 size_t bytes_alloc,
87 gfp_t gfp_flags),
88 85
89 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags), 86 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags)
87);
90 88
91 TP_STRUCT__entry( 89DEFINE_EVENT(kmem_alloc, kmem_cache_alloc,
92 __field( unsigned long, call_site )
93 __field( const void *, ptr )
94 __field( size_t, bytes_req )
95 __field( size_t, bytes_alloc )
96 __field( gfp_t, gfp_flags )
97 ),
98 90
99 TP_fast_assign( 91 TP_PROTO(unsigned long call_site, const void *ptr,
100 __entry->call_site = call_site; 92 size_t bytes_req, size_t bytes_alloc, gfp_t gfp_flags),
101 __entry->ptr = ptr;
102 __entry->bytes_req = bytes_req;
103 __entry->bytes_alloc = bytes_alloc;
104 __entry->gfp_flags = gfp_flags;
105 ),
106 93
107 TP_printk("call_site=%lx ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s", 94 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags)
108 __entry->call_site,
109 __entry->ptr,
110 __entry->bytes_req,
111 __entry->bytes_alloc,
112 show_gfp_flags(__entry->gfp_flags))
113); 95);
114 96
115TRACE_EVENT(kmalloc_node, 97DECLARE_EVENT_CLASS(kmem_alloc_node,
116 98
117 TP_PROTO(unsigned long call_site, 99 TP_PROTO(unsigned long call_site,
118 const void *ptr, 100 const void *ptr,
@@ -150,45 +132,25 @@ TRACE_EVENT(kmalloc_node,
150 __entry->node) 132 __entry->node)
151); 133);
152 134
153TRACE_EVENT(kmem_cache_alloc_node, 135DEFINE_EVENT(kmem_alloc_node, kmalloc_node,
154 136
155 TP_PROTO(unsigned long call_site, 137 TP_PROTO(unsigned long call_site, const void *ptr,
156 const void *ptr, 138 size_t bytes_req, size_t bytes_alloc,
157 size_t bytes_req, 139 gfp_t gfp_flags, int node),
158 size_t bytes_alloc,
159 gfp_t gfp_flags,
160 int node),
161 140
162 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node), 141 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node)
142);
163 143
164 TP_STRUCT__entry( 144DEFINE_EVENT(kmem_alloc_node, kmem_cache_alloc_node,
165 __field( unsigned long, call_site )
166 __field( const void *, ptr )
167 __field( size_t, bytes_req )
168 __field( size_t, bytes_alloc )
169 __field( gfp_t, gfp_flags )
170 __field( int, node )
171 ),
172 145
173 TP_fast_assign( 146 TP_PROTO(unsigned long call_site, const void *ptr,
174 __entry->call_site = call_site; 147 size_t bytes_req, size_t bytes_alloc,
175 __entry->ptr = ptr; 148 gfp_t gfp_flags, int node),
176 __entry->bytes_req = bytes_req;
177 __entry->bytes_alloc = bytes_alloc;
178 __entry->gfp_flags = gfp_flags;
179 __entry->node = node;
180 ),
181 149
182 TP_printk("call_site=%lx ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s node=%d", 150 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node)
183 __entry->call_site,
184 __entry->ptr,
185 __entry->bytes_req,
186 __entry->bytes_alloc,
187 show_gfp_flags(__entry->gfp_flags),
188 __entry->node)
189); 151);
190 152
191TRACE_EVENT(kfree, 153DECLARE_EVENT_CLASS(kmem_free,
192 154
193 TP_PROTO(unsigned long call_site, const void *ptr), 155 TP_PROTO(unsigned long call_site, const void *ptr),
194 156
@@ -207,23 +169,18 @@ TRACE_EVENT(kfree,
207 TP_printk("call_site=%lx ptr=%p", __entry->call_site, __entry->ptr) 169 TP_printk("call_site=%lx ptr=%p", __entry->call_site, __entry->ptr)
208); 170);
209 171
210TRACE_EVENT(kmem_cache_free, 172DEFINE_EVENT(kmem_free, kfree,
211 173
212 TP_PROTO(unsigned long call_site, const void *ptr), 174 TP_PROTO(unsigned long call_site, const void *ptr),
213 175
214 TP_ARGS(call_site, ptr), 176 TP_ARGS(call_site, ptr)
177);
215 178
216 TP_STRUCT__entry( 179DEFINE_EVENT(kmem_free, kmem_cache_free,
217 __field( unsigned long, call_site )
218 __field( const void *, ptr )
219 ),
220 180
221 TP_fast_assign( 181 TP_PROTO(unsigned long call_site, const void *ptr),
222 __entry->call_site = call_site;
223 __entry->ptr = ptr;
224 ),
225 182
226 TP_printk("call_site=%lx ptr=%p", __entry->call_site, __entry->ptr) 183 TP_ARGS(call_site, ptr)
227); 184);
228 185
229TRACE_EVENT(mm_page_free_direct, 186TRACE_EVENT(mm_page_free_direct,
@@ -299,7 +256,7 @@ TRACE_EVENT(mm_page_alloc,
299 show_gfp_flags(__entry->gfp_flags)) 256 show_gfp_flags(__entry->gfp_flags))
300); 257);
301 258
302TRACE_EVENT(mm_page_alloc_zone_locked, 259DECLARE_EVENT_CLASS(mm_page,
303 260
304 TP_PROTO(struct page *page, unsigned int order, int migratetype), 261 TP_PROTO(struct page *page, unsigned int order, int migratetype),
305 262
@@ -325,29 +282,22 @@ TRACE_EVENT(mm_page_alloc_zone_locked,
325 __entry->order == 0) 282 __entry->order == 0)
326); 283);
327 284
328TRACE_EVENT(mm_page_pcpu_drain, 285DEFINE_EVENT(mm_page, mm_page_alloc_zone_locked,
329 286
330 TP_PROTO(struct page *page, int order, int migratetype), 287 TP_PROTO(struct page *page, unsigned int order, int migratetype),
331 288
332 TP_ARGS(page, order, migratetype), 289 TP_ARGS(page, order, migratetype)
290);
333 291
334 TP_STRUCT__entry( 292DEFINE_EVENT_PRINT(mm_page, mm_page_pcpu_drain,
335 __field( struct page *, page )
336 __field( int, order )
337 __field( int, migratetype )
338 ),
339 293
340 TP_fast_assign( 294 TP_PROTO(struct page *page, unsigned int order, int migratetype),
341 __entry->page = page; 295
342 __entry->order = order; 296 TP_ARGS(page, order, migratetype),
343 __entry->migratetype = migratetype;
344 ),
345 297
346 TP_printk("page=%p pfn=%lu order=%d migratetype=%d", 298 TP_printk("page=%p pfn=%lu order=%d migratetype=%d",
347 __entry->page, 299 __entry->page, page_to_pfn(__entry->page),
348 page_to_pfn(__entry->page), 300 __entry->order, __entry->migratetype)
349 __entry->order,
350 __entry->migratetype)
351); 301);
352 302
353TRACE_EVENT(mm_page_alloc_extfrag, 303TRACE_EVENT(mm_page_alloc_extfrag,
diff --git a/include/trace/events/lockdep.h b/include/trace/events/lock.h
index bcf1d209a00d..a870ba125aa8 100644
--- a/include/trace/events/lockdep.h
+++ b/include/trace/events/lock.h
@@ -1,8 +1,8 @@
1#undef TRACE_SYSTEM 1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM lockdep 2#define TRACE_SYSTEM lock
3 3
4#if !defined(_TRACE_LOCKDEP_H) || defined(TRACE_HEADER_MULTI_READ) 4#if !defined(_TRACE_LOCK_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_LOCKDEP_H 5#define _TRACE_LOCK_H
6 6
7#include <linux/lockdep.h> 7#include <linux/lockdep.h>
8#include <linux/tracepoint.h> 8#include <linux/tracepoint.h>
@@ -90,7 +90,7 @@ TRACE_EVENT(lock_acquired,
90#endif 90#endif
91#endif 91#endif
92 92
93#endif /* _TRACE_LOCKDEP_H */ 93#endif /* _TRACE_LOCK_H */
94 94
95/* This part must be outside protection */ 95/* This part must be outside protection */
96#include <trace/define_trace.h> 96#include <trace/define_trace.h>
diff --git a/include/trace/events/module.h b/include/trace/events/module.h
index 84160fb18478..4b0f48ba16a6 100644
--- a/include/trace/events/module.h
+++ b/include/trace/events/module.h
@@ -51,7 +51,7 @@ TRACE_EVENT(module_free,
51 TP_printk("%s", __get_str(name)) 51 TP_printk("%s", __get_str(name))
52); 52);
53 53
54TRACE_EVENT(module_get, 54DECLARE_EVENT_CLASS(module_refcnt,
55 55
56 TP_PROTO(struct module *mod, unsigned long ip, int refcnt), 56 TP_PROTO(struct module *mod, unsigned long ip, int refcnt),
57 57
@@ -73,26 +73,18 @@ TRACE_EVENT(module_get,
73 __get_str(name), (void *)__entry->ip, __entry->refcnt) 73 __get_str(name), (void *)__entry->ip, __entry->refcnt)
74); 74);
75 75
76TRACE_EVENT(module_put, 76DEFINE_EVENT(module_refcnt, module_get,
77 77
78 TP_PROTO(struct module *mod, unsigned long ip, int refcnt), 78 TP_PROTO(struct module *mod, unsigned long ip, int refcnt),
79 79
80 TP_ARGS(mod, ip, refcnt), 80 TP_ARGS(mod, ip, refcnt)
81);
81 82
82 TP_STRUCT__entry( 83DEFINE_EVENT(module_refcnt, module_put,
83 __field( unsigned long, ip )
84 __field( int, refcnt )
85 __string( name, mod->name )
86 ),
87 84
88 TP_fast_assign( 85 TP_PROTO(struct module *mod, unsigned long ip, int refcnt),
89 __entry->ip = ip;
90 __entry->refcnt = refcnt;
91 __assign_str(name, mod->name);
92 ),
93 86
94 TP_printk("%s call_site=%pf refcnt=%d", 87 TP_ARGS(mod, ip, refcnt)
95 __get_str(name), (void *)__entry->ip, __entry->refcnt)
96); 88);
97 89
98TRACE_EVENT(module_request, 90TRACE_EVENT(module_request,
diff --git a/include/trace/events/power.h b/include/trace/events/power.h
index ea6d579261ad..c4efe9b8280d 100644
--- a/include/trace/events/power.h
+++ b/include/trace/events/power.h
@@ -16,9 +16,7 @@ enum {
16}; 16};
17#endif 17#endif
18 18
19 19DECLARE_EVENT_CLASS(power,
20
21TRACE_EVENT(power_start,
22 20
23 TP_PROTO(unsigned int type, unsigned int state), 21 TP_PROTO(unsigned int type, unsigned int state),
24 22
@@ -37,42 +35,36 @@ TRACE_EVENT(power_start,
37 TP_printk("type=%lu state=%lu", (unsigned long)__entry->type, (unsigned long)__entry->state) 35 TP_printk("type=%lu state=%lu", (unsigned long)__entry->type, (unsigned long)__entry->state)
38); 36);
39 37
40TRACE_EVENT(power_end, 38DEFINE_EVENT(power, power_start,
41
42 TP_PROTO(int dummy),
43 39
44 TP_ARGS(dummy), 40 TP_PROTO(unsigned int type, unsigned int state),
45 41
46 TP_STRUCT__entry( 42 TP_ARGS(type, state)
47 __field( u64, dummy ) 43);
48 ),
49 44
50 TP_fast_assign( 45DEFINE_EVENT(power, power_frequency,
51 __entry->dummy = 0xffff;
52 ),
53 46
54 TP_printk("dummy=%lu", (unsigned long)__entry->dummy) 47 TP_PROTO(unsigned int type, unsigned int state),
55 48
49 TP_ARGS(type, state)
56); 50);
57 51
52TRACE_EVENT(power_end,
58 53
59TRACE_EVENT(power_frequency, 54 TP_PROTO(int dummy),
60
61 TP_PROTO(unsigned int type, unsigned int state),
62 55
63 TP_ARGS(type, state), 56 TP_ARGS(dummy),
64 57
65 TP_STRUCT__entry( 58 TP_STRUCT__entry(
66 __field( u64, type ) 59 __field( u64, dummy )
67 __field( u64, state )
68 ), 60 ),
69 61
70 TP_fast_assign( 62 TP_fast_assign(
71 __entry->type = type; 63 __entry->dummy = 0xffff;
72 __entry->state = state;
73 ), 64 ),
74 65
75 TP_printk("type=%lu state=%lu", (unsigned long)__entry->type, (unsigned long) __entry->state) 66 TP_printk("dummy=%lu", (unsigned long)__entry->dummy)
67
76); 68);
77 69
78#endif /* _TRACE_POWER_H */ 70#endif /* _TRACE_POWER_H */
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index 4069c43f4187..cfceb0b73e20 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -26,7 +26,7 @@ TRACE_EVENT(sched_kthread_stop,
26 __entry->pid = t->pid; 26 __entry->pid = t->pid;
27 ), 27 ),
28 28
29 TP_printk("task %s:%d", __entry->comm, __entry->pid) 29 TP_printk("comm=%s pid=%d", __entry->comm, __entry->pid)
30); 30);
31 31
32/* 32/*
@@ -46,7 +46,7 @@ TRACE_EVENT(sched_kthread_stop_ret,
46 __entry->ret = ret; 46 __entry->ret = ret;
47 ), 47 ),
48 48
49 TP_printk("ret %d", __entry->ret) 49 TP_printk("ret=%d", __entry->ret)
50); 50);
51 51
52/* 52/*
@@ -73,7 +73,7 @@ TRACE_EVENT(sched_wait_task,
73 __entry->prio = p->prio; 73 __entry->prio = p->prio;
74 ), 74 ),
75 75
76 TP_printk("task %s:%d [%d]", 76 TP_printk("comm=%s pid=%d prio=%d",
77 __entry->comm, __entry->pid, __entry->prio) 77 __entry->comm, __entry->pid, __entry->prio)
78); 78);
79 79
@@ -83,7 +83,7 @@ TRACE_EVENT(sched_wait_task,
83 * (NOTE: the 'rq' argument is not used by generic trace events, 83 * (NOTE: the 'rq' argument is not used by generic trace events,
84 * but used by the latency tracer plugin. ) 84 * but used by the latency tracer plugin. )
85 */ 85 */
86TRACE_EVENT(sched_wakeup, 86DECLARE_EVENT_CLASS(sched_wakeup_template,
87 87
88 TP_PROTO(struct rq *rq, struct task_struct *p, int success), 88 TP_PROTO(struct rq *rq, struct task_struct *p, int success),
89 89
@@ -94,7 +94,7 @@ TRACE_EVENT(sched_wakeup,
94 __field( pid_t, pid ) 94 __field( pid_t, pid )
95 __field( int, prio ) 95 __field( int, prio )
96 __field( int, success ) 96 __field( int, success )
97 __field( int, cpu ) 97 __field( int, target_cpu )
98 ), 98 ),
99 99
100 TP_fast_assign( 100 TP_fast_assign(
@@ -102,46 +102,27 @@ TRACE_EVENT(sched_wakeup,
102 __entry->pid = p->pid; 102 __entry->pid = p->pid;
103 __entry->prio = p->prio; 103 __entry->prio = p->prio;
104 __entry->success = success; 104 __entry->success = success;
105 __entry->cpu = task_cpu(p); 105 __entry->target_cpu = task_cpu(p);
106 ), 106 ),
107 107
108 TP_printk("task %s:%d [%d] success=%d [%03d]", 108 TP_printk("comm=%s pid=%d prio=%d success=%d target_cpu=%03d",
109 __entry->comm, __entry->pid, __entry->prio, 109 __entry->comm, __entry->pid, __entry->prio,
110 __entry->success, __entry->cpu) 110 __entry->success, __entry->target_cpu)
111); 111);
112 112
113DEFINE_EVENT(sched_wakeup_template, sched_wakeup,
114 TP_PROTO(struct rq *rq, struct task_struct *p, int success),
115 TP_ARGS(rq, p, success));
116
113/* 117/*
114 * Tracepoint for waking up a new task: 118 * Tracepoint for waking up a new task:
115 * 119 *
116 * (NOTE: the 'rq' argument is not used by generic trace events, 120 * (NOTE: the 'rq' argument is not used by generic trace events,
117 * but used by the latency tracer plugin. ) 121 * but used by the latency tracer plugin. )
118 */ 122 */
119TRACE_EVENT(sched_wakeup_new, 123DEFINE_EVENT(sched_wakeup_template, sched_wakeup_new,
120 124 TP_PROTO(struct rq *rq, struct task_struct *p, int success),
121 TP_PROTO(struct rq *rq, struct task_struct *p, int success), 125 TP_ARGS(rq, p, success));
122
123 TP_ARGS(rq, p, success),
124
125 TP_STRUCT__entry(
126 __array( char, comm, TASK_COMM_LEN )
127 __field( pid_t, pid )
128 __field( int, prio )
129 __field( int, success )
130 __field( int, cpu )
131 ),
132
133 TP_fast_assign(
134 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
135 __entry->pid = p->pid;
136 __entry->prio = p->prio;
137 __entry->success = success;
138 __entry->cpu = task_cpu(p);
139 ),
140
141 TP_printk("task %s:%d [%d] success=%d [%03d]",
142 __entry->comm, __entry->pid, __entry->prio,
143 __entry->success, __entry->cpu)
144);
145 126
146/* 127/*
147 * Tracepoint for task switches, performed by the scheduler: 128 * Tracepoint for task switches, performed by the scheduler:
@@ -176,7 +157,7 @@ TRACE_EVENT(sched_switch,
176 __entry->next_prio = next->prio; 157 __entry->next_prio = next->prio;
177 ), 158 ),
178 159
179 TP_printk("task %s:%d [%d] (%s) ==> %s:%d [%d]", 160 TP_printk("prev_comm=%s prev_pid=%d prev_prio=%d prev_state=%s ==> next_comm=%s next_pid=%d next_prio=%d",
180 __entry->prev_comm, __entry->prev_pid, __entry->prev_prio, 161 __entry->prev_comm, __entry->prev_pid, __entry->prev_prio,
181 __entry->prev_state ? 162 __entry->prev_state ?
182 __print_flags(__entry->prev_state, "|", 163 __print_flags(__entry->prev_state, "|",
@@ -211,15 +192,12 @@ TRACE_EVENT(sched_migrate_task,
211 __entry->dest_cpu = dest_cpu; 192 __entry->dest_cpu = dest_cpu;
212 ), 193 ),
213 194
214 TP_printk("task %s:%d [%d] from: %d to: %d", 195 TP_printk("comm=%s pid=%d prio=%d orig_cpu=%d dest_cpu=%d",
215 __entry->comm, __entry->pid, __entry->prio, 196 __entry->comm, __entry->pid, __entry->prio,
216 __entry->orig_cpu, __entry->dest_cpu) 197 __entry->orig_cpu, __entry->dest_cpu)
217); 198);
218 199
219/* 200DECLARE_EVENT_CLASS(sched_process_template,
220 * Tracepoint for freeing a task:
221 */
222TRACE_EVENT(sched_process_free,
223 201
224 TP_PROTO(struct task_struct *p), 202 TP_PROTO(struct task_struct *p),
225 203
@@ -237,34 +215,24 @@ TRACE_EVENT(sched_process_free,
237 __entry->prio = p->prio; 215 __entry->prio = p->prio;
238 ), 216 ),
239 217
240 TP_printk("task %s:%d [%d]", 218 TP_printk("comm=%s pid=%d prio=%d",
241 __entry->comm, __entry->pid, __entry->prio) 219 __entry->comm, __entry->pid, __entry->prio)
242); 220);
243 221
244/* 222/*
245 * Tracepoint for a task exiting: 223 * Tracepoint for freeing a task:
246 */ 224 */
247TRACE_EVENT(sched_process_exit, 225DEFINE_EVENT(sched_process_template, sched_process_free,
226 TP_PROTO(struct task_struct *p),
227 TP_ARGS(p));
228
248 229
249 TP_PROTO(struct task_struct *p), 230/*
250 231 * Tracepoint for a task exiting:
251 TP_ARGS(p), 232 */
252 233DEFINE_EVENT(sched_process_template, sched_process_exit,
253 TP_STRUCT__entry( 234 TP_PROTO(struct task_struct *p),
254 __array( char, comm, TASK_COMM_LEN ) 235 TP_ARGS(p));
255 __field( pid_t, pid )
256 __field( int, prio )
257 ),
258
259 TP_fast_assign(
260 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
261 __entry->pid = p->pid;
262 __entry->prio = p->prio;
263 ),
264
265 TP_printk("task %s:%d [%d]",
266 __entry->comm, __entry->pid, __entry->prio)
267);
268 236
269/* 237/*
270 * Tracepoint for a waiting task: 238 * Tracepoint for a waiting task:
@@ -287,7 +255,7 @@ TRACE_EVENT(sched_process_wait,
287 __entry->prio = current->prio; 255 __entry->prio = current->prio;
288 ), 256 ),
289 257
290 TP_printk("task %s:%d [%d]", 258 TP_printk("comm=%s pid=%d prio=%d",
291 __entry->comm, __entry->pid, __entry->prio) 259 __entry->comm, __entry->pid, __entry->prio)
292); 260);
293 261
@@ -314,46 +282,16 @@ TRACE_EVENT(sched_process_fork,
314 __entry->child_pid = child->pid; 282 __entry->child_pid = child->pid;
315 ), 283 ),
316 284
317 TP_printk("parent %s:%d child %s:%d", 285 TP_printk("comm=%s pid=%d child_comm=%s child_pid=%d",
318 __entry->parent_comm, __entry->parent_pid, 286 __entry->parent_comm, __entry->parent_pid,
319 __entry->child_comm, __entry->child_pid) 287 __entry->child_comm, __entry->child_pid)
320); 288);
321 289
322/* 290/*
323 * Tracepoint for sending a signal:
324 */
325TRACE_EVENT(sched_signal_send,
326
327 TP_PROTO(int sig, struct task_struct *p),
328
329 TP_ARGS(sig, p),
330
331 TP_STRUCT__entry(
332 __field( int, sig )
333 __array( char, comm, TASK_COMM_LEN )
334 __field( pid_t, pid )
335 ),
336
337 TP_fast_assign(
338 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
339 __entry->pid = p->pid;
340 __entry->sig = sig;
341 ),
342
343 TP_printk("sig: %d task %s:%d",
344 __entry->sig, __entry->comm, __entry->pid)
345);
346
347/*
348 * XXX the below sched_stat tracepoints only apply to SCHED_OTHER/BATCH/IDLE 291 * XXX the below sched_stat tracepoints only apply to SCHED_OTHER/BATCH/IDLE
349 * adding sched_stat support to SCHED_FIFO/RR would be welcome. 292 * adding sched_stat support to SCHED_FIFO/RR would be welcome.
350 */ 293 */
351 294DECLARE_EVENT_CLASS(sched_stat_template,
352/*
353 * Tracepoint for accounting wait time (time the task is runnable
354 * but not actually running due to scheduler contention).
355 */
356TRACE_EVENT(sched_stat_wait,
357 295
358 TP_PROTO(struct task_struct *tsk, u64 delay), 296 TP_PROTO(struct task_struct *tsk, u64 delay),
359 297
@@ -374,11 +312,36 @@ TRACE_EVENT(sched_stat_wait,
374 __perf_count(delay); 312 __perf_count(delay);
375 ), 313 ),
376 314
377 TP_printk("task: %s:%d wait: %Lu [ns]", 315 TP_printk("comm=%s pid=%d delay=%Lu [ns]",
378 __entry->comm, __entry->pid, 316 __entry->comm, __entry->pid,
379 (unsigned long long)__entry->delay) 317 (unsigned long long)__entry->delay)
380); 318);
381 319
320
321/*
322 * Tracepoint for accounting wait time (time the task is runnable
323 * but not actually running due to scheduler contention).
324 */
325DEFINE_EVENT(sched_stat_template, sched_stat_wait,
326 TP_PROTO(struct task_struct *tsk, u64 delay),
327 TP_ARGS(tsk, delay));
328
329/*
330 * Tracepoint for accounting sleep time (time the task is not runnable,
331 * including iowait, see below).
332 */
333DEFINE_EVENT(sched_stat_template, sched_stat_sleep,
334 TP_PROTO(struct task_struct *tsk, u64 delay),
335 TP_ARGS(tsk, delay));
336
337/*
338 * Tracepoint for accounting iowait time (time the task is not runnable
339 * due to waiting on IO to complete).
340 */
341DEFINE_EVENT(sched_stat_template, sched_stat_iowait,
342 TP_PROTO(struct task_struct *tsk, u64 delay),
343 TP_ARGS(tsk, delay));
344
382/* 345/*
383 * Tracepoint for accounting runtime (time the task is executing 346 * Tracepoint for accounting runtime (time the task is executing
384 * on a CPU). 347 * on a CPU).
@@ -406,72 +369,12 @@ TRACE_EVENT(sched_stat_runtime,
406 __perf_count(runtime); 369 __perf_count(runtime);
407 ), 370 ),
408 371
409 TP_printk("task: %s:%d runtime: %Lu [ns], vruntime: %Lu [ns]", 372 TP_printk("comm=%s pid=%d runtime=%Lu [ns] vruntime=%Lu [ns]",
410 __entry->comm, __entry->pid, 373 __entry->comm, __entry->pid,
411 (unsigned long long)__entry->runtime, 374 (unsigned long long)__entry->runtime,
412 (unsigned long long)__entry->vruntime) 375 (unsigned long long)__entry->vruntime)
413); 376);
414 377
415/*
416 * Tracepoint for accounting sleep time (time the task is not runnable,
417 * including iowait, see below).
418 */
419TRACE_EVENT(sched_stat_sleep,
420
421 TP_PROTO(struct task_struct *tsk, u64 delay),
422
423 TP_ARGS(tsk, delay),
424
425 TP_STRUCT__entry(
426 __array( char, comm, TASK_COMM_LEN )
427 __field( pid_t, pid )
428 __field( u64, delay )
429 ),
430
431 TP_fast_assign(
432 memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
433 __entry->pid = tsk->pid;
434 __entry->delay = delay;
435 )
436 TP_perf_assign(
437 __perf_count(delay);
438 ),
439
440 TP_printk("task: %s:%d sleep: %Lu [ns]",
441 __entry->comm, __entry->pid,
442 (unsigned long long)__entry->delay)
443);
444
445/*
446 * Tracepoint for accounting iowait time (time the task is not runnable
447 * due to waiting on IO to complete).
448 */
449TRACE_EVENT(sched_stat_iowait,
450
451 TP_PROTO(struct task_struct *tsk, u64 delay),
452
453 TP_ARGS(tsk, delay),
454
455 TP_STRUCT__entry(
456 __array( char, comm, TASK_COMM_LEN )
457 __field( pid_t, pid )
458 __field( u64, delay )
459 ),
460
461 TP_fast_assign(
462 memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
463 __entry->pid = tsk->pid;
464 __entry->delay = delay;
465 )
466 TP_perf_assign(
467 __perf_count(delay);
468 ),
469
470 TP_printk("task: %s:%d iowait: %Lu [ns]",
471 __entry->comm, __entry->pid,
472 (unsigned long long)__entry->delay)
473);
474
475#endif /* _TRACE_SCHED_H */ 378#endif /* _TRACE_SCHED_H */
476 379
477/* This part must be outside protection */ 380/* This part must be outside protection */
diff --git a/include/trace/events/signal.h b/include/trace/events/signal.h
new file mode 100644
index 000000000000..a510b75ac304
--- /dev/null
+++ b/include/trace/events/signal.h
@@ -0,0 +1,173 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM signal
3
4#if !defined(_TRACE_SIGNAL_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_SIGNAL_H
6
7#include <linux/signal.h>
8#include <linux/sched.h>
9#include <linux/tracepoint.h>
10
11#define TP_STORE_SIGINFO(__entry, info) \
12 do { \
13 if (info == SEND_SIG_NOINFO) { \
14 __entry->errno = 0; \
15 __entry->code = SI_USER; \
16 } else if (info == SEND_SIG_PRIV) { \
17 __entry->errno = 0; \
18 __entry->code = SI_KERNEL; \
19 } else { \
20 __entry->errno = info->si_errno; \
21 __entry->code = info->si_code; \
22 } \
23 } while (0)
24
25/**
26 * signal_generate - called when a signal is generated
27 * @sig: signal number
28 * @info: pointer to struct siginfo
29 * @task: pointer to struct task_struct
30 *
31 * Current process sends a 'sig' signal to 'task' process with
32 * 'info' siginfo. If 'info' is SEND_SIG_NOINFO or SEND_SIG_PRIV,
33 * 'info' is not a pointer and you can't access its field. Instead,
34 * SEND_SIG_NOINFO means that si_code is SI_USER, and SEND_SIG_PRIV
35 * means that si_code is SI_KERNEL.
36 */
37TRACE_EVENT(signal_generate,
38
39 TP_PROTO(int sig, struct siginfo *info, struct task_struct *task),
40
41 TP_ARGS(sig, info, task),
42
43 TP_STRUCT__entry(
44 __field( int, sig )
45 __field( int, errno )
46 __field( int, code )
47 __array( char, comm, TASK_COMM_LEN )
48 __field( pid_t, pid )
49 ),
50
51 TP_fast_assign(
52 __entry->sig = sig;
53 TP_STORE_SIGINFO(__entry, info);
54 memcpy(__entry->comm, task->comm, TASK_COMM_LEN);
55 __entry->pid = task->pid;
56 ),
57
58 TP_printk("sig=%d errno=%d code=%d comm=%s pid=%d",
59 __entry->sig, __entry->errno, __entry->code,
60 __entry->comm, __entry->pid)
61);
62
63/**
64 * signal_deliver - called when a signal is delivered
65 * @sig: signal number
66 * @info: pointer to struct siginfo
67 * @ka: pointer to struct k_sigaction
68 *
69 * A 'sig' signal is delivered to current process with 'info' siginfo,
70 * and it will be handled by 'ka'. ka->sa.sa_handler can be SIG_IGN or
71 * SIG_DFL.
72 * Note that some signals reported by signal_generate tracepoint can be
73 * lost, ignored or modified (by debugger) before hitting this tracepoint.
74 * This means, this can show which signals are actually delivered, but
75 * matching generated signals and delivered signals may not be correct.
76 */
77TRACE_EVENT(signal_deliver,
78
79 TP_PROTO(int sig, struct siginfo *info, struct k_sigaction *ka),
80
81 TP_ARGS(sig, info, ka),
82
83 TP_STRUCT__entry(
84 __field( int, sig )
85 __field( int, errno )
86 __field( int, code )
87 __field( unsigned long, sa_handler )
88 __field( unsigned long, sa_flags )
89 ),
90
91 TP_fast_assign(
92 __entry->sig = sig;
93 TP_STORE_SIGINFO(__entry, info);
94 __entry->sa_handler = (unsigned long)ka->sa.sa_handler;
95 __entry->sa_flags = ka->sa.sa_flags;
96 ),
97
98 TP_printk("sig=%d errno=%d code=%d sa_handler=%lx sa_flags=%lx",
99 __entry->sig, __entry->errno, __entry->code,
100 __entry->sa_handler, __entry->sa_flags)
101);
102
103/**
104 * signal_overflow_fail - called when signal queue is overflow
105 * @sig: signal number
106 * @group: signal to process group or not (bool)
107 * @info: pointer to struct siginfo
108 *
109 * Kernel fails to generate 'sig' signal with 'info' siginfo, because
110 * siginfo queue is overflow, and the signal is dropped.
111 * 'group' is not 0 if the signal will be sent to a process group.
112 * 'sig' is always one of RT signals.
113 */
114TRACE_EVENT(signal_overflow_fail,
115
116 TP_PROTO(int sig, int group, struct siginfo *info),
117
118 TP_ARGS(sig, group, info),
119
120 TP_STRUCT__entry(
121 __field( int, sig )
122 __field( int, group )
123 __field( int, errno )
124 __field( int, code )
125 ),
126
127 TP_fast_assign(
128 __entry->sig = sig;
129 __entry->group = group;
130 TP_STORE_SIGINFO(__entry, info);
131 ),
132
133 TP_printk("sig=%d group=%d errno=%d code=%d",
134 __entry->sig, __entry->group, __entry->errno, __entry->code)
135);
136
137/**
138 * signal_lose_info - called when siginfo is lost
139 * @sig: signal number
140 * @group: signal to process group or not (bool)
141 * @info: pointer to struct siginfo
142 *
143 * Kernel generates 'sig' signal but loses 'info' siginfo, because siginfo
144 * queue is overflow.
145 * 'group' is not 0 if the signal will be sent to a process group.
146 * 'sig' is always one of non-RT signals.
147 */
148TRACE_EVENT(signal_lose_info,
149
150 TP_PROTO(int sig, int group, struct siginfo *info),
151
152 TP_ARGS(sig, group, info),
153
154 TP_STRUCT__entry(
155 __field( int, sig )
156 __field( int, group )
157 __field( int, errno )
158 __field( int, code )
159 ),
160
161 TP_fast_assign(
162 __entry->sig = sig;
163 __entry->group = group;
164 TP_STORE_SIGINFO(__entry, info);
165 ),
166
167 TP_printk("sig=%d group=%d errno=%d code=%d",
168 __entry->sig, __entry->group, __entry->errno, __entry->code)
169);
170#endif /* _TRACE_SIGNAL_H */
171
172/* This part must be outside protection */
173#include <trace/define_trace.h>
diff --git a/include/trace/events/timer.h b/include/trace/events/timer.h
index 1844c48d640e..e5ce87a0498d 100644
--- a/include/trace/events/timer.h
+++ b/include/trace/events/timer.h
@@ -26,7 +26,7 @@ TRACE_EVENT(timer_init,
26 __entry->timer = timer; 26 __entry->timer = timer;
27 ), 27 ),
28 28
29 TP_printk("timer %p", __entry->timer) 29 TP_printk("timer=%p", __entry->timer)
30); 30);
31 31
32/** 32/**
@@ -54,7 +54,7 @@ TRACE_EVENT(timer_start,
54 __entry->now = jiffies; 54 __entry->now = jiffies;
55 ), 55 ),
56 56
57 TP_printk("timer %p: func %pf, expires %lu, timeout %ld", 57 TP_printk("timer=%p function=%pf expires=%lu [timeout=%ld]",
58 __entry->timer, __entry->function, __entry->expires, 58 __entry->timer, __entry->function, __entry->expires,
59 (long)__entry->expires - __entry->now) 59 (long)__entry->expires - __entry->now)
60); 60);
@@ -81,7 +81,7 @@ TRACE_EVENT(timer_expire_entry,
81 __entry->now = jiffies; 81 __entry->now = jiffies;
82 ), 82 ),
83 83
84 TP_printk("timer %p: now %lu", __entry->timer, __entry->now) 84 TP_printk("timer=%p now=%lu", __entry->timer, __entry->now)
85); 85);
86 86
87/** 87/**
@@ -108,7 +108,7 @@ TRACE_EVENT(timer_expire_exit,
108 __entry->timer = timer; 108 __entry->timer = timer;
109 ), 109 ),
110 110
111 TP_printk("timer %p", __entry->timer) 111 TP_printk("timer=%p", __entry->timer)
112); 112);
113 113
114/** 114/**
@@ -129,7 +129,7 @@ TRACE_EVENT(timer_cancel,
129 __entry->timer = timer; 129 __entry->timer = timer;
130 ), 130 ),
131 131
132 TP_printk("timer %p", __entry->timer) 132 TP_printk("timer=%p", __entry->timer)
133); 133);
134 134
135/** 135/**
@@ -140,24 +140,24 @@ TRACE_EVENT(timer_cancel,
140 */ 140 */
141TRACE_EVENT(hrtimer_init, 141TRACE_EVENT(hrtimer_init,
142 142
143 TP_PROTO(struct hrtimer *timer, clockid_t clockid, 143 TP_PROTO(struct hrtimer *hrtimer, clockid_t clockid,
144 enum hrtimer_mode mode), 144 enum hrtimer_mode mode),
145 145
146 TP_ARGS(timer, clockid, mode), 146 TP_ARGS(hrtimer, clockid, mode),
147 147
148 TP_STRUCT__entry( 148 TP_STRUCT__entry(
149 __field( void *, timer ) 149 __field( void *, hrtimer )
150 __field( clockid_t, clockid ) 150 __field( clockid_t, clockid )
151 __field( enum hrtimer_mode, mode ) 151 __field( enum hrtimer_mode, mode )
152 ), 152 ),
153 153
154 TP_fast_assign( 154 TP_fast_assign(
155 __entry->timer = timer; 155 __entry->hrtimer = hrtimer;
156 __entry->clockid = clockid; 156 __entry->clockid = clockid;
157 __entry->mode = mode; 157 __entry->mode = mode;
158 ), 158 ),
159 159
160 TP_printk("hrtimer %p, clockid %s, mode %s", __entry->timer, 160 TP_printk("hrtimer=%p clockid=%s mode=%s", __entry->hrtimer,
161 __entry->clockid == CLOCK_REALTIME ? 161 __entry->clockid == CLOCK_REALTIME ?
162 "CLOCK_REALTIME" : "CLOCK_MONOTONIC", 162 "CLOCK_REALTIME" : "CLOCK_MONOTONIC",
163 __entry->mode == HRTIMER_MODE_ABS ? 163 __entry->mode == HRTIMER_MODE_ABS ?
@@ -170,26 +170,26 @@ TRACE_EVENT(hrtimer_init,
170 */ 170 */
171TRACE_EVENT(hrtimer_start, 171TRACE_EVENT(hrtimer_start,
172 172
173 TP_PROTO(struct hrtimer *timer), 173 TP_PROTO(struct hrtimer *hrtimer),
174 174
175 TP_ARGS(timer), 175 TP_ARGS(hrtimer),
176 176
177 TP_STRUCT__entry( 177 TP_STRUCT__entry(
178 __field( void *, timer ) 178 __field( void *, hrtimer )
179 __field( void *, function ) 179 __field( void *, function )
180 __field( s64, expires ) 180 __field( s64, expires )
181 __field( s64, softexpires ) 181 __field( s64, softexpires )
182 ), 182 ),
183 183
184 TP_fast_assign( 184 TP_fast_assign(
185 __entry->timer = timer; 185 __entry->hrtimer = hrtimer;
186 __entry->function = timer->function; 186 __entry->function = hrtimer->function;
187 __entry->expires = hrtimer_get_expires(timer).tv64; 187 __entry->expires = hrtimer_get_expires(hrtimer).tv64;
188 __entry->softexpires = hrtimer_get_softexpires(timer).tv64; 188 __entry->softexpires = hrtimer_get_softexpires(hrtimer).tv64;
189 ), 189 ),
190 190
191 TP_printk("hrtimer %p, func %pf, expires %llu, softexpires %llu", 191 TP_printk("hrtimer=%p function=%pf expires=%llu softexpires=%llu",
192 __entry->timer, __entry->function, 192 __entry->hrtimer, __entry->function,
193 (unsigned long long)ktime_to_ns((ktime_t) { 193 (unsigned long long)ktime_to_ns((ktime_t) {
194 .tv64 = __entry->expires }), 194 .tv64 = __entry->expires }),
195 (unsigned long long)ktime_to_ns((ktime_t) { 195 (unsigned long long)ktime_to_ns((ktime_t) {
@@ -206,23 +206,22 @@ TRACE_EVENT(hrtimer_start,
206 */ 206 */
207TRACE_EVENT(hrtimer_expire_entry, 207TRACE_EVENT(hrtimer_expire_entry,
208 208
209 TP_PROTO(struct hrtimer *timer, ktime_t *now), 209 TP_PROTO(struct hrtimer *hrtimer, ktime_t *now),
210 210
211 TP_ARGS(timer, now), 211 TP_ARGS(hrtimer, now),
212 212
213 TP_STRUCT__entry( 213 TP_STRUCT__entry(
214 __field( void *, timer ) 214 __field( void *, hrtimer )
215 __field( s64, now ) 215 __field( s64, now )
216 ), 216 ),
217 217
218 TP_fast_assign( 218 TP_fast_assign(
219 __entry->timer = timer; 219 __entry->hrtimer = hrtimer;
220 __entry->now = now->tv64; 220 __entry->now = now->tv64;
221 ), 221 ),
222 222
223 TP_printk("hrtimer %p, now %llu", __entry->timer, 223 TP_printk("hrtimer=%p now=%llu", __entry->hrtimer,
224 (unsigned long long)ktime_to_ns((ktime_t) { 224 (unsigned long long)ktime_to_ns((ktime_t) { .tv64 = __entry->now }))
225 .tv64 = __entry->now }))
226 ); 225 );
227 226
228/** 227/**
@@ -234,40 +233,40 @@ TRACE_EVENT(hrtimer_expire_entry,
234 */ 233 */
235TRACE_EVENT(hrtimer_expire_exit, 234TRACE_EVENT(hrtimer_expire_exit,
236 235
237 TP_PROTO(struct hrtimer *timer), 236 TP_PROTO(struct hrtimer *hrtimer),
238 237
239 TP_ARGS(timer), 238 TP_ARGS(hrtimer),
240 239
241 TP_STRUCT__entry( 240 TP_STRUCT__entry(
242 __field( void *, timer ) 241 __field( void *, hrtimer )
243 ), 242 ),
244 243
245 TP_fast_assign( 244 TP_fast_assign(
246 __entry->timer = timer; 245 __entry->hrtimer = hrtimer;
247 ), 246 ),
248 247
249 TP_printk("hrtimer %p", __entry->timer) 248 TP_printk("hrtimer=%p", __entry->hrtimer)
250); 249);
251 250
252/** 251/**
253 * hrtimer_cancel - called when the hrtimer is canceled 252 * hrtimer_cancel - called when the hrtimer is canceled
254 * @timer: pointer to struct hrtimer 253 * @hrtimer: pointer to struct hrtimer
255 */ 254 */
256TRACE_EVENT(hrtimer_cancel, 255TRACE_EVENT(hrtimer_cancel,
257 256
258 TP_PROTO(struct hrtimer *timer), 257 TP_PROTO(struct hrtimer *hrtimer),
259 258
260 TP_ARGS(timer), 259 TP_ARGS(hrtimer),
261 260
262 TP_STRUCT__entry( 261 TP_STRUCT__entry(
263 __field( void *, timer ) 262 __field( void *, hrtimer )
264 ), 263 ),
265 264
266 TP_fast_assign( 265 TP_fast_assign(
267 __entry->timer = timer; 266 __entry->hrtimer = hrtimer;
268 ), 267 ),
269 268
270 TP_printk("hrtimer %p", __entry->timer) 269 TP_printk("hrtimer=%p", __entry->hrtimer)
271); 270);
272 271
273/** 272/**
@@ -302,7 +301,7 @@ TRACE_EVENT(itimer_state,
302 __entry->interval_usec = value->it_interval.tv_usec; 301 __entry->interval_usec = value->it_interval.tv_usec;
303 ), 302 ),
304 303
305 TP_printk("which %d, expires %lu, it_value %lu.%lu, it_interval %lu.%lu", 304 TP_printk("which=%d expires=%lu it_value=%lu.%lu it_interval=%lu.%lu",
306 __entry->which, __entry->expires, 305 __entry->which, __entry->expires,
307 __entry->value_sec, __entry->value_usec, 306 __entry->value_sec, __entry->value_usec,
308 __entry->interval_sec, __entry->interval_usec) 307 __entry->interval_sec, __entry->interval_usec)
@@ -332,7 +331,7 @@ TRACE_EVENT(itimer_expire,
332 __entry->pid = pid_nr(pid); 331 __entry->pid = pid_nr(pid);
333 ), 332 ),
334 333
335 TP_printk("which %d, pid %d, now %lu", __entry->which, 334 TP_printk("which=%d pid=%d now=%lu", __entry->which,
336 (int) __entry->pid, __entry->now) 335 (int) __entry->pid, __entry->now)
337); 336);
338 337
diff --git a/include/trace/events/workqueue.h b/include/trace/events/workqueue.h
index e4612dbd7ba6..d6c974474e70 100644
--- a/include/trace/events/workqueue.h
+++ b/include/trace/events/workqueue.h
@@ -8,7 +8,7 @@
8#include <linux/sched.h> 8#include <linux/sched.h>
9#include <linux/tracepoint.h> 9#include <linux/tracepoint.h>
10 10
11TRACE_EVENT(workqueue_insertion, 11DECLARE_EVENT_CLASS(workqueue,
12 12
13 TP_PROTO(struct task_struct *wq_thread, struct work_struct *work), 13 TP_PROTO(struct task_struct *wq_thread, struct work_struct *work),
14 14
@@ -30,26 +30,18 @@ TRACE_EVENT(workqueue_insertion,
30 __entry->thread_pid, __entry->func) 30 __entry->thread_pid, __entry->func)
31); 31);
32 32
33TRACE_EVENT(workqueue_execution, 33DEFINE_EVENT(workqueue, workqueue_insertion,
34 34
35 TP_PROTO(struct task_struct *wq_thread, struct work_struct *work), 35 TP_PROTO(struct task_struct *wq_thread, struct work_struct *work),
36 36
37 TP_ARGS(wq_thread, work), 37 TP_ARGS(wq_thread, work)
38);
38 39
39 TP_STRUCT__entry( 40DEFINE_EVENT(workqueue, workqueue_execution,
40 __array(char, thread_comm, TASK_COMM_LEN)
41 __field(pid_t, thread_pid)
42 __field(work_func_t, func)
43 ),
44 41
45 TP_fast_assign( 42 TP_PROTO(struct task_struct *wq_thread, struct work_struct *work),
46 memcpy(__entry->thread_comm, wq_thread->comm, TASK_COMM_LEN);
47 __entry->thread_pid = wq_thread->pid;
48 __entry->func = work->func;
49 ),
50 43
51 TP_printk("thread=%s:%d func=%pf", __entry->thread_comm, 44 TP_ARGS(wq_thread, work)
52 __entry->thread_pid, __entry->func)
53); 45);
54 46
55/* Trace the creation of one workqueue thread on a cpu */ 47/* Trace the creation of one workqueue thread on a cpu */
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index c9bbcab95fbe..2c9c073e45ad 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -18,6 +18,26 @@
18 18
19#include <linux/ftrace_event.h> 19#include <linux/ftrace_event.h>
20 20
21/*
22 * DECLARE_EVENT_CLASS can be used to add a generic function
23 * handlers for events. That is, if all events have the same
24 * parameters and just have distinct trace points.
25 * Each tracepoint can be defined with DEFINE_EVENT and that
26 * will map the DECLARE_EVENT_CLASS to the tracepoint.
27 *
28 * TRACE_EVENT is a one to one mapping between tracepoint and template.
29 */
30#undef TRACE_EVENT
31#define TRACE_EVENT(name, proto, args, tstruct, assign, print) \
32 DECLARE_EVENT_CLASS(name, \
33 PARAMS(proto), \
34 PARAMS(args), \
35 PARAMS(tstruct), \
36 PARAMS(assign), \
37 PARAMS(print)); \
38 DEFINE_EVENT(name, name, PARAMS(proto), PARAMS(args));
39
40
21#undef __field 41#undef __field
22#define __field(type, item) type item; 42#define __field(type, item) type item;
23 43
@@ -36,15 +56,21 @@
36#undef TP_STRUCT__entry 56#undef TP_STRUCT__entry
37#define TP_STRUCT__entry(args...) args 57#define TP_STRUCT__entry(args...) args
38 58
39#undef TRACE_EVENT 59#undef DECLARE_EVENT_CLASS
40#define TRACE_EVENT(name, proto, args, tstruct, assign, print) \ 60#define DECLARE_EVENT_CLASS(name, proto, args, tstruct, assign, print) \
41 struct ftrace_raw_##name { \ 61 struct ftrace_raw_##name { \
42 struct trace_entry ent; \ 62 struct trace_entry ent; \
43 tstruct \ 63 tstruct \
44 char __data[0]; \ 64 char __data[0]; \
45 }; \ 65 };
66#undef DEFINE_EVENT
67#define DEFINE_EVENT(template, name, proto, args) \
46 static struct ftrace_event_call event_##name 68 static struct ftrace_event_call event_##name
47 69
70#undef DEFINE_EVENT_PRINT
71#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
72 DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
73
48#undef __cpparg 74#undef __cpparg
49#define __cpparg(arg...) arg 75#define __cpparg(arg...) arg
50 76
@@ -89,12 +115,19 @@
89#undef __string 115#undef __string
90#define __string(item, src) __dynamic_array(char, item, -1) 116#define __string(item, src) __dynamic_array(char, item, -1)
91 117
92#undef TRACE_EVENT 118#undef DECLARE_EVENT_CLASS
93#define TRACE_EVENT(call, proto, args, tstruct, assign, print) \ 119#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
94 struct ftrace_data_offsets_##call { \ 120 struct ftrace_data_offsets_##call { \
95 tstruct; \ 121 tstruct; \
96 }; 122 };
97 123
124#undef DEFINE_EVENT
125#define DEFINE_EVENT(template, name, proto, args)
126
127#undef DEFINE_EVENT_PRINT
128#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
129 DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
130
98#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) 131#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
99 132
100/* 133/*
@@ -170,17 +203,50 @@
170#undef TP_perf_assign 203#undef TP_perf_assign
171#define TP_perf_assign(args...) 204#define TP_perf_assign(args...)
172 205
173#undef TRACE_EVENT 206#undef DECLARE_EVENT_CLASS
174#define TRACE_EVENT(call, proto, args, tstruct, func, print) \ 207#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, func, print) \
175static int \ 208static int \
176ftrace_format_##call(struct ftrace_event_call *unused, \ 209ftrace_format_setup_##call(struct ftrace_event_call *unused, \
177 struct trace_seq *s) \ 210 struct trace_seq *s) \
178{ \ 211{ \
179 struct ftrace_raw_##call field __attribute__((unused)); \ 212 struct ftrace_raw_##call field __attribute__((unused)); \
180 int ret = 0; \ 213 int ret = 0; \
181 \ 214 \
182 tstruct; \ 215 tstruct; \
183 \ 216 \
217 return ret; \
218} \
219 \
220static int \
221ftrace_format_##call(struct ftrace_event_call *unused, \
222 struct trace_seq *s) \
223{ \
224 int ret = 0; \
225 \
226 ret = ftrace_format_setup_##call(unused, s); \
227 if (!ret) \
228 return ret; \
229 \
230 ret = trace_seq_printf(s, "\nprint fmt: " print); \
231 \
232 return ret; \
233}
234
235#undef DEFINE_EVENT
236#define DEFINE_EVENT(template, name, proto, args)
237
238#undef DEFINE_EVENT_PRINT
239#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
240static int \
241ftrace_format_##name(struct ftrace_event_call *unused, \
242 struct trace_seq *s) \
243{ \
244 int ret = 0; \
245 \
246 ret = ftrace_format_setup_##template(unused, s); \
247 if (!ret) \
248 return ret; \
249 \
184 trace_seq_printf(s, "\nprint fmt: " print); \ 250 trace_seq_printf(s, "\nprint fmt: " print); \
185 \ 251 \
186 return ret; \ 252 return ret; \
@@ -255,10 +321,11 @@ ftrace_format_##call(struct ftrace_event_call *unused, \
255 ftrace_print_symbols_seq(p, value, symbols); \ 321 ftrace_print_symbols_seq(p, value, symbols); \
256 }) 322 })
257 323
258#undef TRACE_EVENT 324#undef DECLARE_EVENT_CLASS
259#define TRACE_EVENT(call, proto, args, tstruct, assign, print) \ 325#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
260static enum print_line_t \ 326static enum print_line_t \
261ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \ 327ftrace_raw_output_id_##call(int event_id, const char *name, \
328 struct trace_iterator *iter, int flags) \
262{ \ 329{ \
263 struct trace_seq *s = &iter->seq; \ 330 struct trace_seq *s = &iter->seq; \
264 struct ftrace_raw_##call *field; \ 331 struct ftrace_raw_##call *field; \
@@ -268,6 +335,47 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \
268 \ 335 \
269 entry = iter->ent; \ 336 entry = iter->ent; \
270 \ 337 \
338 if (entry->type != event_id) { \
339 WARN_ON_ONCE(1); \
340 return TRACE_TYPE_UNHANDLED; \
341 } \
342 \
343 field = (typeof(field))entry; \
344 \
345 p = &get_cpu_var(ftrace_event_seq); \
346 trace_seq_init(p); \
347 ret = trace_seq_printf(s, "%s: ", name); \
348 if (ret) \
349 ret = trace_seq_printf(s, print); \
350 put_cpu(); \
351 if (!ret) \
352 return TRACE_TYPE_PARTIAL_LINE; \
353 \
354 return TRACE_TYPE_HANDLED; \
355}
356
357#undef DEFINE_EVENT
358#define DEFINE_EVENT(template, name, proto, args) \
359static enum print_line_t \
360ftrace_raw_output_##name(struct trace_iterator *iter, int flags) \
361{ \
362 return ftrace_raw_output_id_##template(event_##name.id, \
363 #name, iter, flags); \
364}
365
366#undef DEFINE_EVENT_PRINT
367#define DEFINE_EVENT_PRINT(template, call, proto, args, print) \
368static enum print_line_t \
369ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \
370{ \
371 struct trace_seq *s = &iter->seq; \
372 struct ftrace_raw_##template *field; \
373 struct trace_entry *entry; \
374 struct trace_seq *p; \
375 int ret; \
376 \
377 entry = iter->ent; \
378 \
271 if (entry->type != event_##call.id) { \ 379 if (entry->type != event_##call.id) { \
272 WARN_ON_ONCE(1); \ 380 WARN_ON_ONCE(1); \
273 return TRACE_TYPE_UNHANDLED; \ 381 return TRACE_TYPE_UNHANDLED; \
@@ -277,14 +385,16 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \
277 \ 385 \
278 p = &get_cpu_var(ftrace_event_seq); \ 386 p = &get_cpu_var(ftrace_event_seq); \
279 trace_seq_init(p); \ 387 trace_seq_init(p); \
280 ret = trace_seq_printf(s, #call ": " print); \ 388 ret = trace_seq_printf(s, "%s: ", #call); \
389 if (ret) \
390 ret = trace_seq_printf(s, print); \
281 put_cpu(); \ 391 put_cpu(); \
282 if (!ret) \ 392 if (!ret) \
283 return TRACE_TYPE_PARTIAL_LINE; \ 393 return TRACE_TYPE_PARTIAL_LINE; \
284 \ 394 \
285 return TRACE_TYPE_HANDLED; \ 395 return TRACE_TYPE_HANDLED; \
286} 396}
287 397
288#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) 398#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
289 399
290#undef __field_ext 400#undef __field_ext
@@ -318,8 +428,8 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \
318#undef __string 428#undef __string
319#define __string(item, src) __dynamic_array(char, item, -1) 429#define __string(item, src) __dynamic_array(char, item, -1)
320 430
321#undef TRACE_EVENT 431#undef DECLARE_EVENT_CLASS
322#define TRACE_EVENT(call, proto, args, tstruct, func, print) \ 432#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, func, print) \
323static int \ 433static int \
324ftrace_define_fields_##call(struct ftrace_event_call *event_call) \ 434ftrace_define_fields_##call(struct ftrace_event_call *event_call) \
325{ \ 435{ \
@@ -335,6 +445,13 @@ ftrace_define_fields_##call(struct ftrace_event_call *event_call) \
335 return ret; \ 445 return ret; \
336} 446}
337 447
448#undef DEFINE_EVENT
449#define DEFINE_EVENT(template, name, proto, args)
450
451#undef DEFINE_EVENT_PRINT
452#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
453 DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
454
338#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) 455#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
339 456
340/* 457/*
@@ -361,10 +478,10 @@ ftrace_define_fields_##call(struct ftrace_event_call *event_call) \
361 __data_size += (len) * sizeof(type); 478 __data_size += (len) * sizeof(type);
362 479
363#undef __string 480#undef __string
364#define __string(item, src) __dynamic_array(char, item, strlen(src) + 1) \ 481#define __string(item, src) __dynamic_array(char, item, strlen(src) + 1)
365 482
366#undef TRACE_EVENT 483#undef DECLARE_EVENT_CLASS
367#define TRACE_EVENT(call, proto, args, tstruct, assign, print) \ 484#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
368static inline int ftrace_get_offsets_##call( \ 485static inline int ftrace_get_offsets_##call( \
369 struct ftrace_data_offsets_##call *__data_offsets, proto) \ 486 struct ftrace_data_offsets_##call *__data_offsets, proto) \
370{ \ 487{ \
@@ -376,6 +493,13 @@ static inline int ftrace_get_offsets_##call( \
376 return __data_size; \ 493 return __data_size; \
377} 494}
378 495
496#undef DEFINE_EVENT
497#define DEFINE_EVENT(template, name, proto, args)
498
499#undef DEFINE_EVENT_PRINT
500#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
501 DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
502
379#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) 503#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
380 504
381#ifdef CONFIG_EVENT_PROFILE 505#ifdef CONFIG_EVENT_PROFILE
@@ -397,21 +521,28 @@ static inline int ftrace_get_offsets_##call( \
397 * 521 *
398 */ 522 */
399 523
400#undef TRACE_EVENT 524#undef DECLARE_EVENT_CLASS
401#define TRACE_EVENT(call, proto, args, tstruct, assign, print) \ 525#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print)
526
527#undef DEFINE_EVENT
528#define DEFINE_EVENT(template, name, proto, args) \
402 \ 529 \
403static void ftrace_profile_##call(proto); \ 530static void ftrace_profile_##name(proto); \
404 \ 531 \
405static int ftrace_profile_enable_##call(void) \ 532static int ftrace_profile_enable_##name(struct ftrace_event_call *unused)\
406{ \ 533{ \
407 return register_trace_##call(ftrace_profile_##call); \ 534 return register_trace_##name(ftrace_profile_##name); \
408} \ 535} \
409 \ 536 \
410static void ftrace_profile_disable_##call(void) \ 537static void ftrace_profile_disable_##name(struct ftrace_event_call *unused)\
411{ \ 538{ \
412 unregister_trace_##call(ftrace_profile_##call); \ 539 unregister_trace_##name(ftrace_profile_##name); \
413} 540}
414 541
542#undef DEFINE_EVENT_PRINT
543#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
544 DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
545
415#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) 546#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
416 547
417#endif 548#endif
@@ -426,7 +557,7 @@ static void ftrace_profile_disable_##call(void) \
426 * event_trace_printk(_RET_IP_, "<call>: " <fmt>); 557 * event_trace_printk(_RET_IP_, "<call>: " <fmt>);
427 * } 558 * }
428 * 559 *
429 * static int ftrace_reg_event_<call>(void) 560 * static int ftrace_reg_event_<call>(struct ftrace_event_call *unused)
430 * { 561 * {
431 * int ret; 562 * int ret;
432 * 563 *
@@ -437,7 +568,7 @@ static void ftrace_profile_disable_##call(void) \
437 * return ret; 568 * return ret;
438 * } 569 * }
439 * 570 *
440 * static void ftrace_unreg_event_<call>(void) 571 * static void ftrace_unreg_event_<call>(struct ftrace_event_call *unused)
441 * { 572 * {
442 * unregister_trace_<call>(ftrace_event_<call>); 573 * unregister_trace_<call>(ftrace_event_<call>);
443 * } 574 * }
@@ -472,7 +603,7 @@ static void ftrace_profile_disable_##call(void) \
472 * trace_current_buffer_unlock_commit(buffer, event, irq_flags, pc); 603 * trace_current_buffer_unlock_commit(buffer, event, irq_flags, pc);
473 * } 604 * }
474 * 605 *
475 * static int ftrace_raw_reg_event_<call>(void) 606 * static int ftrace_raw_reg_event_<call>(struct ftrace_event_call *unused)
476 * { 607 * {
477 * int ret; 608 * int ret;
478 * 609 *
@@ -483,7 +614,7 @@ static void ftrace_profile_disable_##call(void) \
483 * return ret; 614 * return ret;
484 * } 615 * }
485 * 616 *
486 * static void ftrace_unreg_event_<call>(void) 617 * static void ftrace_unreg_event_<call>(struct ftrace_event_call *unused)
487 * { 618 * {
488 * unregister_trace_<call>(ftrace_raw_event_<call>); 619 * unregister_trace_<call>(ftrace_raw_event_<call>);
489 * } 620 * }
@@ -492,7 +623,7 @@ static void ftrace_profile_disable_##call(void) \
492 * .trace = ftrace_raw_output_<call>, <-- stage 2 623 * .trace = ftrace_raw_output_<call>, <-- stage 2
493 * }; 624 * };
494 * 625 *
495 * static int ftrace_raw_init_event_<call>(void) 626 * static int ftrace_raw_init_event_<call>(struct ftrace_event_call *unused)
496 * { 627 * {
497 * int id; 628 * int id;
498 * 629 *
@@ -550,15 +681,13 @@ static void ftrace_profile_disable_##call(void) \
550#define __assign_str(dst, src) \ 681#define __assign_str(dst, src) \
551 strcpy(__get_str(dst), src); 682 strcpy(__get_str(dst), src);
552 683
553#undef TRACE_EVENT 684#undef DECLARE_EVENT_CLASS
554#define TRACE_EVENT(call, proto, args, tstruct, assign, print) \ 685#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
555 \ 686 \
556static struct ftrace_event_call event_##call; \ 687static void ftrace_raw_event_id_##call(struct ftrace_event_call *event_call, \
557 \ 688 proto) \
558static void ftrace_raw_event_##call(proto) \
559{ \ 689{ \
560 struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\ 690 struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\
561 struct ftrace_event_call *event_call = &event_##call; \
562 struct ring_buffer_event *event; \ 691 struct ring_buffer_event *event; \
563 struct ftrace_raw_##call *entry; \ 692 struct ftrace_raw_##call *entry; \
564 struct ring_buffer *buffer; \ 693 struct ring_buffer *buffer; \
@@ -572,7 +701,7 @@ static void ftrace_raw_event_##call(proto) \
572 __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \ 701 __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \
573 \ 702 \
574 event = trace_current_buffer_lock_reserve(&buffer, \ 703 event = trace_current_buffer_lock_reserve(&buffer, \
575 event_##call.id, \ 704 event_call->id, \
576 sizeof(*entry) + __data_size, \ 705 sizeof(*entry) + __data_size, \
577 irq_flags, pc); \ 706 irq_flags, pc); \
578 if (!event) \ 707 if (!event) \
@@ -587,9 +716,17 @@ static void ftrace_raw_event_##call(proto) \
587 if (!filter_current_check_discard(buffer, event_call, entry, event)) \ 716 if (!filter_current_check_discard(buffer, event_call, entry, event)) \
588 trace_nowake_buffer_unlock_commit(buffer, \ 717 trace_nowake_buffer_unlock_commit(buffer, \
589 event, irq_flags, pc); \ 718 event, irq_flags, pc); \
719}
720
721#undef DEFINE_EVENT
722#define DEFINE_EVENT(template, call, proto, args) \
723 \
724static void ftrace_raw_event_##call(proto) \
725{ \
726 ftrace_raw_event_id_##template(&event_##call, args); \
590} \ 727} \
591 \ 728 \
592static int ftrace_raw_reg_event_##call(void *ptr) \ 729static int ftrace_raw_reg_event_##call(struct ftrace_event_call *unused)\
593{ \ 730{ \
594 int ret; \ 731 int ret; \
595 \ 732 \
@@ -600,7 +737,7 @@ static int ftrace_raw_reg_event_##call(void *ptr) \
600 return ret; \ 737 return ret; \
601} \ 738} \
602 \ 739 \
603static void ftrace_raw_unreg_event_##call(void *ptr) \ 740static void ftrace_raw_unreg_event_##call(struct ftrace_event_call *unused)\
604{ \ 741{ \
605 unregister_trace_##call(ftrace_raw_event_##call); \ 742 unregister_trace_##call(ftrace_raw_event_##call); \
606} \ 743} \
@@ -609,7 +746,7 @@ static struct trace_event ftrace_event_type_##call = { \
609 .trace = ftrace_raw_output_##call, \ 746 .trace = ftrace_raw_output_##call, \
610}; \ 747}; \
611 \ 748 \
612static int ftrace_raw_init_event_##call(void) \ 749static int ftrace_raw_init_event_##call(struct ftrace_event_call *unused)\
613{ \ 750{ \
614 int id; \ 751 int id; \
615 \ 752 \
@@ -619,7 +756,36 @@ static int ftrace_raw_init_event_##call(void) \
619 event_##call.id = id; \ 756 event_##call.id = id; \
620 INIT_LIST_HEAD(&event_##call.fields); \ 757 INIT_LIST_HEAD(&event_##call.fields); \
621 return 0; \ 758 return 0; \
622} \ 759}
760
761#undef DEFINE_EVENT_PRINT
762#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
763 DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
764
765#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
766
767#undef DECLARE_EVENT_CLASS
768#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print)
769
770#undef DEFINE_EVENT
771#define DEFINE_EVENT(template, call, proto, args) \
772 \
773static struct ftrace_event_call __used \
774__attribute__((__aligned__(4))) \
775__attribute__((section("_ftrace_events"))) event_##call = { \
776 .name = #call, \
777 .system = __stringify(TRACE_SYSTEM), \
778 .event = &ftrace_event_type_##call, \
779 .raw_init = ftrace_raw_init_event_##call, \
780 .regfunc = ftrace_raw_reg_event_##call, \
781 .unregfunc = ftrace_raw_unreg_event_##call, \
782 .show_format = ftrace_format_##template, \
783 .define_fields = ftrace_define_fields_##template, \
784 _TRACE_PROFILE_INIT(call) \
785}
786
787#undef DEFINE_EVENT_PRINT
788#define DEFINE_EVENT_PRINT(template, call, proto, args, print) \
623 \ 789 \
624static struct ftrace_event_call __used \ 790static struct ftrace_event_call __used \
625__attribute__((__aligned__(4))) \ 791__attribute__((__aligned__(4))) \
@@ -631,7 +797,7 @@ __attribute__((section("_ftrace_events"))) event_##call = { \
631 .regfunc = ftrace_raw_reg_event_##call, \ 797 .regfunc = ftrace_raw_reg_event_##call, \
632 .unregfunc = ftrace_raw_unreg_event_##call, \ 798 .unregfunc = ftrace_raw_unreg_event_##call, \
633 .show_format = ftrace_format_##call, \ 799 .show_format = ftrace_format_##call, \
634 .define_fields = ftrace_define_fields_##call, \ 800 .define_fields = ftrace_define_fields_##template, \
635 _TRACE_PROFILE_INIT(call) \ 801 _TRACE_PROFILE_INIT(call) \
636} 802}
637 803
@@ -649,6 +815,7 @@ __attribute__((section("_ftrace_events"))) event_##call = { \
649 * struct ftrace_event_call *event_call = &event_<call>; 815 * struct ftrace_event_call *event_call = &event_<call>;
650 * extern void perf_tp_event(int, u64, u64, void *, int); 816 * extern void perf_tp_event(int, u64, u64, void *, int);
651 * struct ftrace_raw_##call *entry; 817 * struct ftrace_raw_##call *entry;
818 * struct perf_trace_buf *trace_buf;
652 * u64 __addr = 0, __count = 1; 819 * u64 __addr = 0, __count = 1;
653 * unsigned long irq_flags; 820 * unsigned long irq_flags;
654 * struct trace_entry *ent; 821 * struct trace_entry *ent;
@@ -673,14 +840,25 @@ __attribute__((section("_ftrace_events"))) event_##call = { \
673 * __cpu = smp_processor_id(); 840 * __cpu = smp_processor_id();
674 * 841 *
675 * if (in_nmi()) 842 * if (in_nmi())
676 * raw_data = rcu_dereference(trace_profile_buf_nmi); 843 * trace_buf = rcu_dereference(perf_trace_buf_nmi);
677 * else 844 * else
678 * raw_data = rcu_dereference(trace_profile_buf); 845 * trace_buf = rcu_dereference(perf_trace_buf);
679 * 846 *
680 * if (!raw_data) 847 * if (!trace_buf)
681 * goto end; 848 * goto end;
682 * 849 *
683 * raw_data = per_cpu_ptr(raw_data, __cpu); 850 * trace_buf = per_cpu_ptr(trace_buf, __cpu);
851 *
852 * // Avoid recursion from perf that could mess up the buffer
853 * if (trace_buf->recursion++)
854 * goto end_recursion;
855 *
856 * raw_data = trace_buf->buf;
857 *
858 * // Make recursion update visible before entering perf_tp_event
859 * // so that we protect from perf recursions.
860 *
861 * barrier();
684 * 862 *
685 * //zero dead bytes from alignment to avoid stack leak to userspace: 863 * //zero dead bytes from alignment to avoid stack leak to userspace:
686 * *(u64 *)(&raw_data[__entry_size - sizeof(u64)]) = 0ULL; 864 * *(u64 *)(&raw_data[__entry_size - sizeof(u64)]) = 0ULL;
@@ -707,21 +885,26 @@ __attribute__((section("_ftrace_events"))) event_##call = { \
707#undef __perf_count 885#undef __perf_count
708#define __perf_count(c) __count = (c) 886#define __perf_count(c) __count = (c)
709 887
710#undef TRACE_EVENT 888#undef DECLARE_EVENT_CLASS
711#define TRACE_EVENT(call, proto, args, tstruct, assign, print) \ 889#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
712static void ftrace_profile_##call(proto) \ 890static void \
891ftrace_profile_templ_##call(struct ftrace_event_call *event_call, \
892 proto) \
713{ \ 893{ \
714 struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\ 894 struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\
715 struct ftrace_event_call *event_call = &event_##call; \ 895 extern int perf_swevent_get_recursion_context(void); \
716 extern void perf_tp_event(int, u64, u64, void *, int); \ 896 extern void perf_swevent_put_recursion_context(int rctx); \
897 extern void perf_tp_event(int, u64, u64, void *, int); \
717 struct ftrace_raw_##call *entry; \ 898 struct ftrace_raw_##call *entry; \
718 u64 __addr = 0, __count = 1; \ 899 u64 __addr = 0, __count = 1; \
719 unsigned long irq_flags; \ 900 unsigned long irq_flags; \
720 struct trace_entry *ent; \ 901 struct trace_entry *ent; \
721 int __entry_size; \ 902 int __entry_size; \
722 int __data_size; \ 903 int __data_size; \
904 char *trace_buf; \
723 char *raw_data; \ 905 char *raw_data; \
724 int __cpu; \ 906 int __cpu; \
907 int rctx; \
725 int pc; \ 908 int pc; \
726 \ 909 \
727 pc = preempt_count(); \ 910 pc = preempt_count(); \
@@ -736,17 +919,22 @@ static void ftrace_profile_##call(proto) \
736 return; \ 919 return; \
737 \ 920 \
738 local_irq_save(irq_flags); \ 921 local_irq_save(irq_flags); \
922 \
923 rctx = perf_swevent_get_recursion_context(); \
924 if (rctx < 0) \
925 goto end_recursion; \
926 \
739 __cpu = smp_processor_id(); \ 927 __cpu = smp_processor_id(); \
740 \ 928 \
741 if (in_nmi()) \ 929 if (in_nmi()) \
742 raw_data = rcu_dereference(trace_profile_buf_nmi); \ 930 trace_buf = rcu_dereference(perf_trace_buf_nmi); \
743 else \ 931 else \
744 raw_data = rcu_dereference(trace_profile_buf); \ 932 trace_buf = rcu_dereference(perf_trace_buf); \
745 \ 933 \
746 if (!raw_data) \ 934 if (!trace_buf) \
747 goto end; \ 935 goto end; \
748 \ 936 \
749 raw_data = per_cpu_ptr(raw_data, __cpu); \ 937 raw_data = per_cpu_ptr(trace_buf, __cpu); \
750 \ 938 \
751 *(u64 *)(&raw_data[__entry_size - sizeof(u64)]) = 0ULL; \ 939 *(u64 *)(&raw_data[__entry_size - sizeof(u64)]) = 0ULL; \
752 entry = (struct ftrace_raw_##call *)raw_data; \ 940 entry = (struct ftrace_raw_##call *)raw_data; \
@@ -762,10 +950,25 @@ static void ftrace_profile_##call(proto) \
762 __entry_size); \ 950 __entry_size); \
763 \ 951 \
764end: \ 952end: \
953 perf_swevent_put_recursion_context(rctx); \
954end_recursion: \
765 local_irq_restore(irq_flags); \ 955 local_irq_restore(irq_flags); \
766 \ 956 \
767} 957}
768 958
959#undef DEFINE_EVENT
960#define DEFINE_EVENT(template, call, proto, args) \
961static void ftrace_profile_##call(proto) \
962{ \
963 struct ftrace_event_call *event_call = &event_##call; \
964 \
965 ftrace_profile_templ_##template(event_call, args); \
966}
967
968#undef DEFINE_EVENT_PRINT
969#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
970 DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
971
769#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) 972#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
770#endif /* CONFIG_EVENT_PROFILE */ 973#endif /* CONFIG_EVENT_PROFILE */
771 974
diff --git a/include/trace/syscall.h b/include/trace/syscall.h
index 5dc283ba5ae0..961fda3556bb 100644
--- a/include/trace/syscall.h
+++ b/include/trace/syscall.h
@@ -12,51 +12,48 @@
12 * A syscall entry in the ftrace syscalls array. 12 * A syscall entry in the ftrace syscalls array.
13 * 13 *
14 * @name: name of the syscall 14 * @name: name of the syscall
15 * @syscall_nr: number of the syscall
15 * @nb_args: number of parameters it takes 16 * @nb_args: number of parameters it takes
16 * @types: list of types as strings 17 * @types: list of types as strings
17 * @args: list of args as strings (args[i] matches types[i]) 18 * @args: list of args as strings (args[i] matches types[i])
18 * @enter_id: associated ftrace enter event id
19 * @exit_id: associated ftrace exit event id
20 * @enter_event: associated syscall_enter trace event 19 * @enter_event: associated syscall_enter trace event
21 * @exit_event: associated syscall_exit trace event 20 * @exit_event: associated syscall_exit trace event
22 */ 21 */
23struct syscall_metadata { 22struct syscall_metadata {
24 const char *name; 23 const char *name;
24 int syscall_nr;
25 int nb_args; 25 int nb_args;
26 const char **types; 26 const char **types;
27 const char **args; 27 const char **args;
28 int enter_id;
29 int exit_id;
30 28
31 struct ftrace_event_call *enter_event; 29 struct ftrace_event_call *enter_event;
32 struct ftrace_event_call *exit_event; 30 struct ftrace_event_call *exit_event;
33}; 31};
34 32
35#ifdef CONFIG_FTRACE_SYSCALLS 33#ifdef CONFIG_FTRACE_SYSCALLS
36extern struct syscall_metadata *syscall_nr_to_meta(int nr); 34extern unsigned long arch_syscall_addr(int nr);
37extern int syscall_name_to_nr(char *name); 35extern int init_syscall_trace(struct ftrace_event_call *call);
38void set_syscall_enter_id(int num, int id); 36
39void set_syscall_exit_id(int num, int id);
40extern struct trace_event event_syscall_enter;
41extern struct trace_event event_syscall_exit;
42extern int reg_event_syscall_enter(void *ptr);
43extern void unreg_event_syscall_enter(void *ptr);
44extern int reg_event_syscall_exit(void *ptr);
45extern void unreg_event_syscall_exit(void *ptr);
46extern int syscall_enter_format(struct ftrace_event_call *call, 37extern int syscall_enter_format(struct ftrace_event_call *call,
47 struct trace_seq *s); 38 struct trace_seq *s);
48extern int syscall_exit_format(struct ftrace_event_call *call, 39extern int syscall_exit_format(struct ftrace_event_call *call,
49 struct trace_seq *s); 40 struct trace_seq *s);
50extern int syscall_enter_define_fields(struct ftrace_event_call *call); 41extern int syscall_enter_define_fields(struct ftrace_event_call *call);
51extern int syscall_exit_define_fields(struct ftrace_event_call *call); 42extern int syscall_exit_define_fields(struct ftrace_event_call *call);
43extern int reg_event_syscall_enter(struct ftrace_event_call *call);
44extern void unreg_event_syscall_enter(struct ftrace_event_call *call);
45extern int reg_event_syscall_exit(struct ftrace_event_call *call);
46extern void unreg_event_syscall_exit(struct ftrace_event_call *call);
47extern int
48ftrace_format_syscall(struct ftrace_event_call *call, struct trace_seq *s);
52enum print_line_t print_syscall_enter(struct trace_iterator *iter, int flags); 49enum print_line_t print_syscall_enter(struct trace_iterator *iter, int flags);
53enum print_line_t print_syscall_exit(struct trace_iterator *iter, int flags); 50enum print_line_t print_syscall_exit(struct trace_iterator *iter, int flags);
54#endif 51#endif
55#ifdef CONFIG_EVENT_PROFILE 52#ifdef CONFIG_EVENT_PROFILE
56int reg_prof_syscall_enter(char *name); 53int prof_sysenter_enable(struct ftrace_event_call *call);
57void unreg_prof_syscall_enter(char *name); 54void prof_sysenter_disable(struct ftrace_event_call *call);
58int reg_prof_syscall_exit(char *name); 55int prof_sysexit_enable(struct ftrace_event_call *call);
59void unreg_prof_syscall_exit(char *name); 56void prof_sysexit_disable(struct ftrace_event_call *call);
60 57
61#endif 58#endif
62 59