aboutsummaryrefslogtreecommitdiffstats
path: root/include/trace
diff options
context:
space:
mode:
Diffstat (limited to 'include/trace')
-rw-r--r--include/trace/events/bkl.h61
-rw-r--r--include/trace/events/block.h37
-rw-r--r--include/trace/events/ext4.h320
-rw-r--r--include/trace/events/irq.h29
-rw-r--r--include/trace/events/jbd2.h80
-rw-r--r--include/trace/events/kmem.h163
-rw-r--r--include/trace/events/power.h79
-rw-r--r--include/trace/events/sched.h75
-rw-r--r--include/trace/events/timer.h341
-rw-r--r--include/trace/events/workqueue.h4
-rw-r--r--include/trace/ftrace.h140
-rw-r--r--include/trace/syscall.h2
12 files changed, 1188 insertions, 143 deletions
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 9a74b468a229..00405b5f624a 100644
--- a/include/trace/events/block.h
+++ b/include/trace/events/block.h
@@ -171,6 +171,7 @@ TRACE_EVENT(block_rq_complete,
171 (unsigned long long)__entry->sector, 171 (unsigned long long)__entry->sector,
172 __entry->nr_sector, __entry->errors) 172 __entry->nr_sector, __entry->errors)
173); 173);
174
174TRACE_EVENT(block_bio_bounce, 175TRACE_EVENT(block_bio_bounce,
175 176
176 TP_PROTO(struct request_queue *q, struct bio *bio), 177 TP_PROTO(struct request_queue *q, struct bio *bio),
@@ -186,7 +187,8 @@ TRACE_EVENT(block_bio_bounce,
186 ), 187 ),
187 188
188 TP_fast_assign( 189 TP_fast_assign(
189 __entry->dev = bio->bi_bdev->bd_dev; 190 __entry->dev = bio->bi_bdev ?
191 bio->bi_bdev->bd_dev : 0;
190 __entry->sector = bio->bi_sector; 192 __entry->sector = bio->bi_sector;
191 __entry->nr_sector = bio->bi_size >> 9; 193 __entry->nr_sector = bio->bi_size >> 9;
192 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size); 194 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
@@ -486,6 +488,39 @@ TRACE_EVENT(block_remap,
486 (unsigned long long)__entry->old_sector) 488 (unsigned long long)__entry->old_sector)
487); 489);
488 490
491TRACE_EVENT(block_rq_remap,
492
493 TP_PROTO(struct request_queue *q, struct request *rq, dev_t dev,
494 sector_t from),
495
496 TP_ARGS(q, rq, dev, from),
497
498 TP_STRUCT__entry(
499 __field( dev_t, dev )
500 __field( sector_t, sector )
501 __field( unsigned int, nr_sector )
502 __field( dev_t, old_dev )
503 __field( sector_t, old_sector )
504 __array( char, rwbs, 6 )
505 ),
506
507 TP_fast_assign(
508 __entry->dev = disk_devt(rq->rq_disk);
509 __entry->sector = blk_rq_pos(rq);
510 __entry->nr_sector = blk_rq_sectors(rq);
511 __entry->old_dev = dev;
512 __entry->old_sector = from;
513 blk_fill_rwbs_rq(__entry->rwbs, rq);
514 ),
515
516 TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu",
517 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
518 (unsigned long long)__entry->sector,
519 __entry->nr_sector,
520 MAJOR(__entry->old_dev), MINOR(__entry->old_dev),
521 (unsigned long long)__entry->old_sector)
522);
523
489#endif /* _TRACE_BLOCK_H */ 524#endif /* _TRACE_BLOCK_H */
490 525
491/* This part must be outside protection */ 526/* This part must be outside protection */
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index 7d8b5bc74185..d09550bf3f95 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -5,10 +5,16 @@
5#define _TRACE_EXT4_H 5#define _TRACE_EXT4_H
6 6
7#include <linux/writeback.h> 7#include <linux/writeback.h>
8#include "../../../fs/ext4/ext4.h"
9#include "../../../fs/ext4/mballoc.h"
10#include <linux/tracepoint.h> 8#include <linux/tracepoint.h>
11 9
10struct ext4_allocation_context;
11struct ext4_allocation_request;
12struct ext4_prealloc_space;
13struct ext4_inode_info;
14struct mpage_da_data;
15
16#define EXT4_I(inode) (container_of(inode, struct ext4_inode_info, vfs_inode))
17
12TRACE_EVENT(ext4_free_inode, 18TRACE_EVENT(ext4_free_inode,
13 TP_PROTO(struct inode *inode), 19 TP_PROTO(struct inode *inode),
14 20
@@ -33,8 +39,8 @@ TRACE_EVENT(ext4_free_inode,
33 ), 39 ),
34 40
35 TP_printk("dev %s ino %lu mode %d uid %u gid %u blocks %llu", 41 TP_printk("dev %s ino %lu mode %d uid %u gid %u blocks %llu",
36 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->mode, 42 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
37 __entry->uid, __entry->gid, 43 __entry->mode, __entry->uid, __entry->gid,
38 (unsigned long long) __entry->blocks) 44 (unsigned long long) __entry->blocks)
39); 45);
40 46
@@ -56,7 +62,8 @@ TRACE_EVENT(ext4_request_inode,
56 ), 62 ),
57 63
58 TP_printk("dev %s dir %lu mode %d", 64 TP_printk("dev %s dir %lu mode %d",
59 jbd2_dev_to_name(__entry->dev), __entry->dir, __entry->mode) 65 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->dir,
66 __entry->mode)
60); 67);
61 68
62TRACE_EVENT(ext4_allocate_inode, 69TRACE_EVENT(ext4_allocate_inode,
@@ -79,7 +86,8 @@ TRACE_EVENT(ext4_allocate_inode,
79 ), 86 ),
80 87
81 TP_printk("dev %s ino %lu dir %lu mode %d", 88 TP_printk("dev %s ino %lu dir %lu mode %d",
82 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->dir, __entry->mode) 89 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
90 (unsigned long) __entry->dir, __entry->mode)
83); 91);
84 92
85TRACE_EVENT(ext4_write_begin, 93TRACE_EVENT(ext4_write_begin,
@@ -106,8 +114,8 @@ TRACE_EVENT(ext4_write_begin,
106 ), 114 ),
107 115
108 TP_printk("dev %s ino %lu pos %llu len %u flags %u", 116 TP_printk("dev %s ino %lu pos %llu len %u flags %u",
109 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->pos, __entry->len, 117 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
110 __entry->flags) 118 __entry->pos, __entry->len, __entry->flags)
111); 119);
112 120
113TRACE_EVENT(ext4_ordered_write_end, 121TRACE_EVENT(ext4_ordered_write_end,
@@ -133,8 +141,8 @@ TRACE_EVENT(ext4_ordered_write_end,
133 ), 141 ),
134 142
135 TP_printk("dev %s ino %lu pos %llu len %u copied %u", 143 TP_printk("dev %s ino %lu pos %llu len %u copied %u",
136 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->pos, __entry->len, 144 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
137 __entry->copied) 145 __entry->pos, __entry->len, __entry->copied)
138); 146);
139 147
140TRACE_EVENT(ext4_writeback_write_end, 148TRACE_EVENT(ext4_writeback_write_end,
@@ -160,8 +168,8 @@ TRACE_EVENT(ext4_writeback_write_end,
160 ), 168 ),
161 169
162 TP_printk("dev %s ino %lu pos %llu len %u copied %u", 170 TP_printk("dev %s ino %lu pos %llu len %u copied %u",
163 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->pos, __entry->len, 171 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
164 __entry->copied) 172 __entry->pos, __entry->len, __entry->copied)
165); 173);
166 174
167TRACE_EVENT(ext4_journalled_write_end, 175TRACE_EVENT(ext4_journalled_write_end,
@@ -186,8 +194,8 @@ TRACE_EVENT(ext4_journalled_write_end,
186 ), 194 ),
187 195
188 TP_printk("dev %s ino %lu pos %llu len %u copied %u", 196 TP_printk("dev %s ino %lu pos %llu len %u copied %u",
189 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->pos, __entry->len, 197 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
190 __entry->copied) 198 __entry->pos, __entry->len, __entry->copied)
191); 199);
192 200
193TRACE_EVENT(ext4_writepage, 201TRACE_EVENT(ext4_writepage,
@@ -209,7 +217,8 @@ TRACE_EVENT(ext4_writepage,
209 ), 217 ),
210 218
211 TP_printk("dev %s ino %lu page_index %lu", 219 TP_printk("dev %s ino %lu page_index %lu",
212 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->index) 220 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
221 __entry->index)
213); 222);
214 223
215TRACE_EVENT(ext4_da_writepages, 224TRACE_EVENT(ext4_da_writepages,
@@ -227,8 +236,8 @@ TRACE_EVENT(ext4_da_writepages,
227 __field( char, nonblocking ) 236 __field( char, nonblocking )
228 __field( char, for_kupdate ) 237 __field( char, for_kupdate )
229 __field( char, for_reclaim ) 238 __field( char, for_reclaim )
230 __field( char, for_writepages )
231 __field( char, range_cyclic ) 239 __field( char, range_cyclic )
240 __field( pgoff_t, writeback_index )
232 ), 241 ),
233 242
234 TP_fast_assign( 243 TP_fast_assign(
@@ -241,16 +250,52 @@ TRACE_EVENT(ext4_da_writepages,
241 __entry->nonblocking = wbc->nonblocking; 250 __entry->nonblocking = wbc->nonblocking;
242 __entry->for_kupdate = wbc->for_kupdate; 251 __entry->for_kupdate = wbc->for_kupdate;
243 __entry->for_reclaim = wbc->for_reclaim; 252 __entry->for_reclaim = wbc->for_reclaim;
244 __entry->for_writepages = wbc->for_writepages;
245 __entry->range_cyclic = wbc->range_cyclic; 253 __entry->range_cyclic = wbc->range_cyclic;
254 __entry->writeback_index = inode->i_mapping->writeback_index;
246 ), 255 ),
247 256
248 TP_printk("dev %s ino %lu nr_t_write %ld pages_skipped %ld range_start %llu range_end %llu nonblocking %d for_kupdate %d for_reclaim %d for_writepages %d range_cyclic %d", 257 TP_printk("dev %s ino %lu nr_to_write %ld pages_skipped %ld range_start %llu range_end %llu nonblocking %d for_kupdate %d for_reclaim %d range_cyclic %d writeback_index %lu",
249 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->nr_to_write, 258 jbd2_dev_to_name(__entry->dev),
259 (unsigned long) __entry->ino, __entry->nr_to_write,
250 __entry->pages_skipped, __entry->range_start, 260 __entry->pages_skipped, __entry->range_start,
251 __entry->range_end, __entry->nonblocking, 261 __entry->range_end, __entry->nonblocking,
252 __entry->for_kupdate, __entry->for_reclaim, 262 __entry->for_kupdate, __entry->for_reclaim,
253 __entry->for_writepages, __entry->range_cyclic) 263 __entry->range_cyclic,
264 (unsigned long) __entry->writeback_index)
265);
266
267TRACE_EVENT(ext4_da_write_pages,
268 TP_PROTO(struct inode *inode, struct mpage_da_data *mpd),
269
270 TP_ARGS(inode, mpd),
271
272 TP_STRUCT__entry(
273 __field( dev_t, dev )
274 __field( ino_t, ino )
275 __field( __u64, b_blocknr )
276 __field( __u32, b_size )
277 __field( __u32, b_state )
278 __field( unsigned long, first_page )
279 __field( int, io_done )
280 __field( int, pages_written )
281 ),
282
283 TP_fast_assign(
284 __entry->dev = inode->i_sb->s_dev;
285 __entry->ino = inode->i_ino;
286 __entry->b_blocknr = mpd->b_blocknr;
287 __entry->b_size = mpd->b_size;
288 __entry->b_state = mpd->b_state;
289 __entry->first_page = mpd->first_page;
290 __entry->io_done = mpd->io_done;
291 __entry->pages_written = mpd->pages_written;
292 ),
293
294 TP_printk("dev %s ino %lu b_blocknr %llu b_size %u b_state 0x%04x first_page %lu io_done %d pages_written %d",
295 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
296 __entry->b_blocknr, __entry->b_size,
297 __entry->b_state, __entry->first_page,
298 __entry->io_done, __entry->pages_written)
254); 299);
255 300
256TRACE_EVENT(ext4_da_writepages_result, 301TRACE_EVENT(ext4_da_writepages_result,
@@ -268,6 +313,7 @@ TRACE_EVENT(ext4_da_writepages_result,
268 __field( char, encountered_congestion ) 313 __field( char, encountered_congestion )
269 __field( char, more_io ) 314 __field( char, more_io )
270 __field( char, no_nrwrite_index_update ) 315 __field( char, no_nrwrite_index_update )
316 __field( pgoff_t, writeback_index )
271 ), 317 ),
272 318
273 TP_fast_assign( 319 TP_fast_assign(
@@ -279,13 +325,16 @@ TRACE_EVENT(ext4_da_writepages_result,
279 __entry->encountered_congestion = wbc->encountered_congestion; 325 __entry->encountered_congestion = wbc->encountered_congestion;
280 __entry->more_io = wbc->more_io; 326 __entry->more_io = wbc->more_io;
281 __entry->no_nrwrite_index_update = wbc->no_nrwrite_index_update; 327 __entry->no_nrwrite_index_update = wbc->no_nrwrite_index_update;
328 __entry->writeback_index = inode->i_mapping->writeback_index;
282 ), 329 ),
283 330
284 TP_printk("dev %s ino %lu ret %d pages_written %d pages_skipped %ld congestion %d more_io %d no_nrwrite_index_update %d", 331 TP_printk("dev %s ino %lu ret %d pages_written %d pages_skipped %ld congestion %d more_io %d no_nrwrite_index_update %d writeback_index %lu",
285 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->ret, 332 jbd2_dev_to_name(__entry->dev),
333 (unsigned long) __entry->ino, __entry->ret,
286 __entry->pages_written, __entry->pages_skipped, 334 __entry->pages_written, __entry->pages_skipped,
287 __entry->encountered_congestion, __entry->more_io, 335 __entry->encountered_congestion, __entry->more_io,
288 __entry->no_nrwrite_index_update) 336 __entry->no_nrwrite_index_update,
337 (unsigned long) __entry->writeback_index)
289); 338);
290 339
291TRACE_EVENT(ext4_da_write_begin, 340TRACE_EVENT(ext4_da_write_begin,
@@ -311,8 +360,8 @@ TRACE_EVENT(ext4_da_write_begin,
311 ), 360 ),
312 361
313 TP_printk("dev %s ino %lu pos %llu len %u flags %u", 362 TP_printk("dev %s ino %lu pos %llu len %u flags %u",
314 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->pos, __entry->len, 363 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
315 __entry->flags) 364 __entry->pos, __entry->len, __entry->flags)
316); 365);
317 366
318TRACE_EVENT(ext4_da_write_end, 367TRACE_EVENT(ext4_da_write_end,
@@ -338,8 +387,8 @@ TRACE_EVENT(ext4_da_write_end,
338 ), 387 ),
339 388
340 TP_printk("dev %s ino %lu pos %llu len %u copied %u", 389 TP_printk("dev %s ino %lu pos %llu len %u copied %u",
341 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->pos, __entry->len, 390 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
342 __entry->copied) 391 __entry->pos, __entry->len, __entry->copied)
343); 392);
344 393
345TRACE_EVENT(ext4_discard_blocks, 394TRACE_EVENT(ext4_discard_blocks,
@@ -389,8 +438,8 @@ TRACE_EVENT(ext4_mb_new_inode_pa,
389 ), 438 ),
390 439
391 TP_printk("dev %s ino %lu pstart %llu len %u lstart %llu", 440 TP_printk("dev %s ino %lu pstart %llu len %u lstart %llu",
392 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->pa_pstart, 441 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
393 __entry->pa_len, __entry->pa_lstart) 442 __entry->pa_pstart, __entry->pa_len, __entry->pa_lstart)
394); 443);
395 444
396TRACE_EVENT(ext4_mb_new_group_pa, 445TRACE_EVENT(ext4_mb_new_group_pa,
@@ -417,8 +466,8 @@ TRACE_EVENT(ext4_mb_new_group_pa,
417 ), 466 ),
418 467
419 TP_printk("dev %s ino %lu pstart %llu len %u lstart %llu", 468 TP_printk("dev %s ino %lu pstart %llu len %u lstart %llu",
420 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->pa_pstart, 469 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
421 __entry->pa_len, __entry->pa_lstart) 470 __entry->pa_pstart, __entry->pa_len, __entry->pa_lstart)
422); 471);
423 472
424TRACE_EVENT(ext4_mb_release_inode_pa, 473TRACE_EVENT(ext4_mb_release_inode_pa,
@@ -444,8 +493,8 @@ TRACE_EVENT(ext4_mb_release_inode_pa,
444 ), 493 ),
445 494
446 TP_printk("dev %s ino %lu block %llu count %u", 495 TP_printk("dev %s ino %lu block %llu count %u",
447 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->block, 496 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
448 __entry->count) 497 __entry->block, __entry->count)
449); 498);
450 499
451TRACE_EVENT(ext4_mb_release_group_pa, 500TRACE_EVENT(ext4_mb_release_group_pa,
@@ -490,7 +539,7 @@ TRACE_EVENT(ext4_discard_preallocations,
490 ), 539 ),
491 540
492 TP_printk("dev %s ino %lu", 541 TP_printk("dev %s ino %lu",
493 jbd2_dev_to_name(__entry->dev), __entry->ino) 542 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino)
494); 543);
495 544
496TRACE_EVENT(ext4_mb_discard_preallocations, 545TRACE_EVENT(ext4_mb_discard_preallocations,
@@ -545,8 +594,8 @@ TRACE_EVENT(ext4_request_blocks,
545 ), 594 ),
546 595
547 TP_printk("dev %s ino %lu flags %u len %u lblk %llu goal %llu lleft %llu lright %llu pleft %llu pright %llu ", 596 TP_printk("dev %s ino %lu flags %u len %u lblk %llu goal %llu lleft %llu lright %llu pleft %llu pright %llu ",
548 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->flags, 597 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
549 __entry->len, 598 __entry->flags, __entry->len,
550 (unsigned long long) __entry->logical, 599 (unsigned long long) __entry->logical,
551 (unsigned long long) __entry->goal, 600 (unsigned long long) __entry->goal,
552 (unsigned long long) __entry->lleft, 601 (unsigned long long) __entry->lleft,
@@ -589,8 +638,8 @@ TRACE_EVENT(ext4_allocate_blocks,
589 ), 638 ),
590 639
591 TP_printk("dev %s ino %lu flags %u len %u block %llu lblk %llu goal %llu lleft %llu lright %llu pleft %llu pright %llu ", 640 TP_printk("dev %s ino %lu flags %u len %u block %llu lblk %llu goal %llu lleft %llu lright %llu pleft %llu pright %llu ",
592 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->flags, 641 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
593 __entry->len, __entry->block, 642 __entry->flags, __entry->len, __entry->block,
594 (unsigned long long) __entry->logical, 643 (unsigned long long) __entry->logical,
595 (unsigned long long) __entry->goal, 644 (unsigned long long) __entry->goal,
596 (unsigned long long) __entry->lleft, 645 (unsigned long long) __entry->lleft,
@@ -623,8 +672,8 @@ TRACE_EVENT(ext4_free_blocks,
623 ), 672 ),
624 673
625 TP_printk("dev %s ino %lu block %llu count %lu metadata %d", 674 TP_printk("dev %s ino %lu block %llu count %lu metadata %d",
626 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->block, 675 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
627 __entry->count, __entry->metadata) 676 __entry->block, __entry->count, __entry->metadata)
628); 677);
629 678
630TRACE_EVENT(ext4_sync_file, 679TRACE_EVENT(ext4_sync_file,
@@ -647,8 +696,8 @@ TRACE_EVENT(ext4_sync_file,
647 ), 696 ),
648 697
649 TP_printk("dev %s ino %ld parent %ld datasync %d ", 698 TP_printk("dev %s ino %ld parent %ld datasync %d ",
650 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->parent, 699 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
651 __entry->datasync) 700 (unsigned long) __entry->parent, __entry->datasync)
652); 701);
653 702
654TRACE_EVENT(ext4_sync_fs, 703TRACE_EVENT(ext4_sync_fs,
@@ -671,6 +720,193 @@ TRACE_EVENT(ext4_sync_fs,
671 __entry->wait) 720 __entry->wait)
672); 721);
673 722
723TRACE_EVENT(ext4_alloc_da_blocks,
724 TP_PROTO(struct inode *inode),
725
726 TP_ARGS(inode),
727
728 TP_STRUCT__entry(
729 __field( dev_t, dev )
730 __field( ino_t, ino )
731 __field( unsigned int, data_blocks )
732 __field( unsigned int, meta_blocks )
733 ),
734
735 TP_fast_assign(
736 __entry->dev = inode->i_sb->s_dev;
737 __entry->ino = inode->i_ino;
738 __entry->data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
739 __entry->meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
740 ),
741
742 TP_printk("dev %s ino %lu data_blocks %u meta_blocks %u",
743 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
744 __entry->data_blocks, __entry->meta_blocks)
745);
746
747TRACE_EVENT(ext4_mballoc_alloc,
748 TP_PROTO(struct ext4_allocation_context *ac),
749
750 TP_ARGS(ac),
751
752 TP_STRUCT__entry(
753 __field( dev_t, dev )
754 __field( ino_t, ino )
755 __field( __u16, found )
756 __field( __u16, groups )
757 __field( __u16, buddy )
758 __field( __u16, flags )
759 __field( __u16, tail )
760 __field( __u8, cr )
761 __field( __u32, orig_logical )
762 __field( int, orig_start )
763 __field( __u32, orig_group )
764 __field( int, orig_len )
765 __field( __u32, goal_logical )
766 __field( int, goal_start )
767 __field( __u32, goal_group )
768 __field( int, goal_len )
769 __field( __u32, result_logical )
770 __field( int, result_start )
771 __field( __u32, result_group )
772 __field( int, result_len )
773 ),
774
775 TP_fast_assign(
776 __entry->dev = ac->ac_inode->i_sb->s_dev;
777 __entry->ino = ac->ac_inode->i_ino;
778 __entry->found = ac->ac_found;
779 __entry->flags = ac->ac_flags;
780 __entry->groups = ac->ac_groups_scanned;
781 __entry->buddy = ac->ac_buddy;
782 __entry->tail = ac->ac_tail;
783 __entry->cr = ac->ac_criteria;
784 __entry->orig_logical = ac->ac_o_ex.fe_logical;
785 __entry->orig_start = ac->ac_o_ex.fe_start;
786 __entry->orig_group = ac->ac_o_ex.fe_group;
787 __entry->orig_len = ac->ac_o_ex.fe_len;
788 __entry->goal_logical = ac->ac_g_ex.fe_logical;
789 __entry->goal_start = ac->ac_g_ex.fe_start;
790 __entry->goal_group = ac->ac_g_ex.fe_group;
791 __entry->goal_len = ac->ac_g_ex.fe_len;
792 __entry->result_logical = ac->ac_f_ex.fe_logical;
793 __entry->result_start = ac->ac_f_ex.fe_start;
794 __entry->result_group = ac->ac_f_ex.fe_group;
795 __entry->result_len = ac->ac_f_ex.fe_len;
796 ),
797
798 TP_printk("dev %s inode %lu orig %u/%d/%u@%u goal %u/%d/%u@%u "
799 "result %u/%d/%u@%u blks %u grps %u cr %u flags 0x%04x "
800 "tail %u broken %u",
801 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
802 __entry->orig_group, __entry->orig_start,
803 __entry->orig_len, __entry->orig_logical,
804 __entry->goal_group, __entry->goal_start,
805 __entry->goal_len, __entry->goal_logical,
806 __entry->result_group, __entry->result_start,
807 __entry->result_len, __entry->result_logical,
808 __entry->found, __entry->groups, __entry->cr,
809 __entry->flags, __entry->tail,
810 __entry->buddy ? 1 << __entry->buddy : 0)
811);
812
813TRACE_EVENT(ext4_mballoc_prealloc,
814 TP_PROTO(struct ext4_allocation_context *ac),
815
816 TP_ARGS(ac),
817
818 TP_STRUCT__entry(
819 __field( dev_t, dev )
820 __field( ino_t, ino )
821 __field( __u32, orig_logical )
822 __field( int, orig_start )
823 __field( __u32, orig_group )
824 __field( int, orig_len )
825 __field( __u32, result_logical )
826 __field( int, result_start )
827 __field( __u32, result_group )
828 __field( int, result_len )
829 ),
830
831 TP_fast_assign(
832 __entry->dev = ac->ac_inode->i_sb->s_dev;
833 __entry->ino = ac->ac_inode->i_ino;
834 __entry->orig_logical = ac->ac_o_ex.fe_logical;
835 __entry->orig_start = ac->ac_o_ex.fe_start;
836 __entry->orig_group = ac->ac_o_ex.fe_group;
837 __entry->orig_len = ac->ac_o_ex.fe_len;
838 __entry->result_logical = ac->ac_b_ex.fe_logical;
839 __entry->result_start = ac->ac_b_ex.fe_start;
840 __entry->result_group = ac->ac_b_ex.fe_group;
841 __entry->result_len = ac->ac_b_ex.fe_len;
842 ),
843
844 TP_printk("dev %s inode %lu orig %u/%d/%u@%u result %u/%d/%u@%u",
845 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
846 __entry->orig_group, __entry->orig_start,
847 __entry->orig_len, __entry->orig_logical,
848 __entry->result_group, __entry->result_start,
849 __entry->result_len, __entry->result_logical)
850);
851
852TRACE_EVENT(ext4_mballoc_discard,
853 TP_PROTO(struct ext4_allocation_context *ac),
854
855 TP_ARGS(ac),
856
857 TP_STRUCT__entry(
858 __field( dev_t, dev )
859 __field( ino_t, ino )
860 __field( __u32, result_logical )
861 __field( int, result_start )
862 __field( __u32, result_group )
863 __field( int, result_len )
864 ),
865
866 TP_fast_assign(
867 __entry->dev = ac->ac_inode->i_sb->s_dev;
868 __entry->ino = ac->ac_inode->i_ino;
869 __entry->result_logical = ac->ac_b_ex.fe_logical;
870 __entry->result_start = ac->ac_b_ex.fe_start;
871 __entry->result_group = ac->ac_b_ex.fe_group;
872 __entry->result_len = ac->ac_b_ex.fe_len;
873 ),
874
875 TP_printk("dev %s inode %lu extent %u/%d/%u@%u ",
876 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
877 __entry->result_group, __entry->result_start,
878 __entry->result_len, __entry->result_logical)
879);
880
881TRACE_EVENT(ext4_mballoc_free,
882 TP_PROTO(struct ext4_allocation_context *ac),
883
884 TP_ARGS(ac),
885
886 TP_STRUCT__entry(
887 __field( dev_t, dev )
888 __field( ino_t, ino )
889 __field( __u32, result_logical )
890 __field( int, result_start )
891 __field( __u32, result_group )
892 __field( int, result_len )
893 ),
894
895 TP_fast_assign(
896 __entry->dev = ac->ac_inode->i_sb->s_dev;
897 __entry->ino = ac->ac_inode->i_ino;
898 __entry->result_logical = ac->ac_b_ex.fe_logical;
899 __entry->result_start = ac->ac_b_ex.fe_start;
900 __entry->result_group = ac->ac_b_ex.fe_group;
901 __entry->result_len = ac->ac_b_ex.fe_len;
902 ),
903
904 TP_printk("dev %s inode %lu extent %u/%d/%u@%u ",
905 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
906 __entry->result_group, __entry->result_start,
907 __entry->result_len, __entry->result_logical)
908);
909
674#endif /* _TRACE_EXT4_H */ 910#endif /* _TRACE_EXT4_H */
675 911
676/* This part must be outside protection */ 912/* This part must be outside protection */
diff --git a/include/trace/events/irq.h b/include/trace/events/irq.h
index 1cb0c3aa11e6..dcfcd4407623 100644
--- a/include/trace/events/irq.h
+++ b/include/trace/events/irq.h
@@ -8,16 +8,17 @@
8#include <linux/interrupt.h> 8#include <linux/interrupt.h>
9 9
10#define softirq_name(sirq) { sirq##_SOFTIRQ, #sirq } 10#define softirq_name(sirq) { sirq##_SOFTIRQ, #sirq }
11#define show_softirq_name(val) \ 11#define show_softirq_name(val) \
12 __print_symbolic(val, \ 12 __print_symbolic(val, \
13 softirq_name(HI), \ 13 softirq_name(HI), \
14 softirq_name(TIMER), \ 14 softirq_name(TIMER), \
15 softirq_name(NET_TX), \ 15 softirq_name(NET_TX), \
16 softirq_name(NET_RX), \ 16 softirq_name(NET_RX), \
17 softirq_name(BLOCK), \ 17 softirq_name(BLOCK), \
18 softirq_name(TASKLET), \ 18 softirq_name(BLOCK_IOPOLL), \
19 softirq_name(SCHED), \ 19 softirq_name(TASKLET), \
20 softirq_name(HRTIMER), \ 20 softirq_name(SCHED), \
21 softirq_name(HRTIMER), \
21 softirq_name(RCU)) 22 softirq_name(RCU))
22 23
23/** 24/**
@@ -47,7 +48,7 @@ TRACE_EVENT(irq_handler_entry,
47 __assign_str(name, action->name); 48 __assign_str(name, action->name);
48 ), 49 ),
49 50
50 TP_printk("irq=%d handler=%s", __entry->irq, __get_str(name)) 51 TP_printk("irq=%d name=%s", __entry->irq, __get_str(name))
51); 52);
52 53
53/** 54/**
@@ -77,7 +78,7 @@ TRACE_EVENT(irq_handler_exit,
77 __entry->ret = ret; 78 __entry->ret = ret;
78 ), 79 ),
79 80
80 TP_printk("irq=%d return=%s", 81 TP_printk("irq=%d ret=%s",
81 __entry->irq, __entry->ret ? "handled" : "unhandled") 82 __entry->irq, __entry->ret ? "handled" : "unhandled")
82); 83);
83 84
@@ -106,7 +107,7 @@ TRACE_EVENT(softirq_entry,
106 __entry->vec = (int)(h - vec); 107 __entry->vec = (int)(h - vec);
107 ), 108 ),
108 109
109 TP_printk("softirq=%d action=%s", __entry->vec, 110 TP_printk("vec=%d [action=%s]", __entry->vec,
110 show_softirq_name(__entry->vec)) 111 show_softirq_name(__entry->vec))
111); 112);
112 113
@@ -135,7 +136,7 @@ TRACE_EVENT(softirq_exit,
135 __entry->vec = (int)(h - vec); 136 __entry->vec = (int)(h - vec);
136 ), 137 ),
137 138
138 TP_printk("softirq=%d action=%s", __entry->vec, 139 TP_printk("vec=%d [action=%s]", __entry->vec,
139 show_softirq_name(__entry->vec)) 140 show_softirq_name(__entry->vec))
140); 141);
141 142
diff --git a/include/trace/events/jbd2.h b/include/trace/events/jbd2.h
index 10813fa0c8d0..3c60b75adb9e 100644
--- a/include/trace/events/jbd2.h
+++ b/include/trace/events/jbd2.h
@@ -7,6 +7,9 @@
7#include <linux/jbd2.h> 7#include <linux/jbd2.h>
8#include <linux/tracepoint.h> 8#include <linux/tracepoint.h>
9 9
10struct transaction_chp_stats_s;
11struct transaction_run_stats_s;
12
10TRACE_EVENT(jbd2_checkpoint, 13TRACE_EVENT(jbd2_checkpoint,
11 14
12 TP_PROTO(journal_t *journal, int result), 15 TP_PROTO(journal_t *journal, int result),
@@ -159,7 +162,82 @@ TRACE_EVENT(jbd2_submit_inode_data,
159 ), 162 ),
160 163
161 TP_printk("dev %s ino %lu", 164 TP_printk("dev %s ino %lu",
162 jbd2_dev_to_name(__entry->dev), __entry->ino) 165 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino)
166);
167
168TRACE_EVENT(jbd2_run_stats,
169 TP_PROTO(dev_t dev, unsigned long tid,
170 struct transaction_run_stats_s *stats),
171
172 TP_ARGS(dev, tid, stats),
173
174 TP_STRUCT__entry(
175 __field( dev_t, dev )
176 __field( unsigned long, tid )
177 __field( unsigned long, wait )
178 __field( unsigned long, running )
179 __field( unsigned long, locked )
180 __field( unsigned long, flushing )
181 __field( unsigned long, logging )
182 __field( __u32, handle_count )
183 __field( __u32, blocks )
184 __field( __u32, blocks_logged )
185 ),
186
187 TP_fast_assign(
188 __entry->dev = dev;
189 __entry->tid = tid;
190 __entry->wait = stats->rs_wait;
191 __entry->running = stats->rs_running;
192 __entry->locked = stats->rs_locked;
193 __entry->flushing = stats->rs_flushing;
194 __entry->logging = stats->rs_logging;
195 __entry->handle_count = stats->rs_handle_count;
196 __entry->blocks = stats->rs_blocks;
197 __entry->blocks_logged = stats->rs_blocks_logged;
198 ),
199
200 TP_printk("dev %s tid %lu wait %u running %u locked %u flushing %u "
201 "logging %u handle_count %u blocks %u blocks_logged %u",
202 jbd2_dev_to_name(__entry->dev), __entry->tid,
203 jiffies_to_msecs(__entry->wait),
204 jiffies_to_msecs(__entry->running),
205 jiffies_to_msecs(__entry->locked),
206 jiffies_to_msecs(__entry->flushing),
207 jiffies_to_msecs(__entry->logging),
208 __entry->handle_count, __entry->blocks,
209 __entry->blocks_logged)
210);
211
212TRACE_EVENT(jbd2_checkpoint_stats,
213 TP_PROTO(dev_t dev, unsigned long tid,
214 struct transaction_chp_stats_s *stats),
215
216 TP_ARGS(dev, tid, stats),
217
218 TP_STRUCT__entry(
219 __field( dev_t, dev )
220 __field( unsigned long, tid )
221 __field( unsigned long, chp_time )
222 __field( __u32, forced_to_close )
223 __field( __u32, written )
224 __field( __u32, dropped )
225 ),
226
227 TP_fast_assign(
228 __entry->dev = dev;
229 __entry->tid = tid;
230 __entry->chp_time = stats->cs_chp_time;
231 __entry->forced_to_close= stats->cs_forced_to_close;
232 __entry->written = stats->cs_written;
233 __entry->dropped = stats->cs_dropped;
234 ),
235
236 TP_printk("dev %s tid %lu chp_time %u forced_to_close %u "
237 "written %u dropped %u",
238 jbd2_dev_to_name(__entry->dev), __entry->tid,
239 jiffies_to_msecs(__entry->chp_time),
240 __entry->forced_to_close, __entry->written, __entry->dropped)
163); 241);
164 242
165#endif /* _TRACE_JBD2_H */ 243#endif /* _TRACE_JBD2_H */
diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h
index 1493c541f9c4..eaf46bdd18a5 100644
--- a/include/trace/events/kmem.h
+++ b/include/trace/events/kmem.h
@@ -225,6 +225,169 @@ TRACE_EVENT(kmem_cache_free,
225 225
226 TP_printk("call_site=%lx ptr=%p", __entry->call_site, __entry->ptr) 226 TP_printk("call_site=%lx ptr=%p", __entry->call_site, __entry->ptr)
227); 227);
228
229TRACE_EVENT(mm_page_free_direct,
230
231 TP_PROTO(struct page *page, unsigned int order),
232
233 TP_ARGS(page, order),
234
235 TP_STRUCT__entry(
236 __field( struct page *, page )
237 __field( unsigned int, order )
238 ),
239
240 TP_fast_assign(
241 __entry->page = page;
242 __entry->order = order;
243 ),
244
245 TP_printk("page=%p pfn=%lu order=%d",
246 __entry->page,
247 page_to_pfn(__entry->page),
248 __entry->order)
249);
250
251TRACE_EVENT(mm_pagevec_free,
252
253 TP_PROTO(struct page *page, int cold),
254
255 TP_ARGS(page, cold),
256
257 TP_STRUCT__entry(
258 __field( struct page *, page )
259 __field( int, cold )
260 ),
261
262 TP_fast_assign(
263 __entry->page = page;
264 __entry->cold = cold;
265 ),
266
267 TP_printk("page=%p pfn=%lu order=0 cold=%d",
268 __entry->page,
269 page_to_pfn(__entry->page),
270 __entry->cold)
271);
272
273TRACE_EVENT(mm_page_alloc,
274
275 TP_PROTO(struct page *page, unsigned int order,
276 gfp_t gfp_flags, int migratetype),
277
278 TP_ARGS(page, order, gfp_flags, migratetype),
279
280 TP_STRUCT__entry(
281 __field( struct page *, page )
282 __field( unsigned int, order )
283 __field( gfp_t, gfp_flags )
284 __field( int, migratetype )
285 ),
286
287 TP_fast_assign(
288 __entry->page = page;
289 __entry->order = order;
290 __entry->gfp_flags = gfp_flags;
291 __entry->migratetype = migratetype;
292 ),
293
294 TP_printk("page=%p pfn=%lu order=%d migratetype=%d gfp_flags=%s",
295 __entry->page,
296 page_to_pfn(__entry->page),
297 __entry->order,
298 __entry->migratetype,
299 show_gfp_flags(__entry->gfp_flags))
300);
301
302TRACE_EVENT(mm_page_alloc_zone_locked,
303
304 TP_PROTO(struct page *page, unsigned int order, int migratetype),
305
306 TP_ARGS(page, order, migratetype),
307
308 TP_STRUCT__entry(
309 __field( struct page *, page )
310 __field( unsigned int, order )
311 __field( int, migratetype )
312 ),
313
314 TP_fast_assign(
315 __entry->page = page;
316 __entry->order = order;
317 __entry->migratetype = migratetype;
318 ),
319
320 TP_printk("page=%p pfn=%lu order=%u migratetype=%d percpu_refill=%d",
321 __entry->page,
322 page_to_pfn(__entry->page),
323 __entry->order,
324 __entry->migratetype,
325 __entry->order == 0)
326);
327
328TRACE_EVENT(mm_page_pcpu_drain,
329
330 TP_PROTO(struct page *page, int order, int migratetype),
331
332 TP_ARGS(page, order, migratetype),
333
334 TP_STRUCT__entry(
335 __field( struct page *, page )
336 __field( int, order )
337 __field( int, migratetype )
338 ),
339
340 TP_fast_assign(
341 __entry->page = page;
342 __entry->order = order;
343 __entry->migratetype = migratetype;
344 ),
345
346 TP_printk("page=%p pfn=%lu order=%d migratetype=%d",
347 __entry->page,
348 page_to_pfn(__entry->page),
349 __entry->order,
350 __entry->migratetype)
351);
352
353TRACE_EVENT(mm_page_alloc_extfrag,
354
355 TP_PROTO(struct page *page,
356 int alloc_order, int fallback_order,
357 int alloc_migratetype, int fallback_migratetype),
358
359 TP_ARGS(page,
360 alloc_order, fallback_order,
361 alloc_migratetype, fallback_migratetype),
362
363 TP_STRUCT__entry(
364 __field( struct page *, page )
365 __field( int, alloc_order )
366 __field( int, fallback_order )
367 __field( int, alloc_migratetype )
368 __field( int, fallback_migratetype )
369 ),
370
371 TP_fast_assign(
372 __entry->page = page;
373 __entry->alloc_order = alloc_order;
374 __entry->fallback_order = fallback_order;
375 __entry->alloc_migratetype = alloc_migratetype;
376 __entry->fallback_migratetype = fallback_migratetype;
377 ),
378
379 TP_printk("page=%p pfn=%lu alloc_order=%d fallback_order=%d pageblock_order=%d alloc_migratetype=%d fallback_migratetype=%d fragmenting=%d change_ownership=%d",
380 __entry->page,
381 page_to_pfn(__entry->page),
382 __entry->alloc_order,
383 __entry->fallback_order,
384 pageblock_order,
385 __entry->alloc_migratetype,
386 __entry->fallback_migratetype,
387 __entry->fallback_order < pageblock_order,
388 __entry->alloc_migratetype == __entry->fallback_migratetype)
389);
390
228#endif /* _TRACE_KMEM_H */ 391#endif /* _TRACE_KMEM_H */
229 392
230/* This part must be outside protection */ 393/* This part must be outside protection */
diff --git a/include/trace/events/power.h b/include/trace/events/power.h
new file mode 100644
index 000000000000..9bb96e5a2848
--- /dev/null
+++ b/include/trace/events/power.h
@@ -0,0 +1,79 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM power
3
4#if !defined(_TRACE_POWER_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_POWER_H
6
7#include <linux/ktime.h>
8#include <linux/tracepoint.h>
9
10#ifndef _TRACE_POWER_ENUM_
11#define _TRACE_POWER_ENUM_
12enum {
13 POWER_NONE = 0,
14 POWER_CSTATE = 1,
15 POWER_PSTATE = 2,
16};
17#endif
18
19TRACE_EVENT(power_start,
20
21 TP_PROTO(unsigned int type, unsigned int state),
22
23 TP_ARGS(type, state),
24
25 TP_STRUCT__entry(
26 __field( u64, type )
27 __field( u64, state )
28 ),
29
30 TP_fast_assign(
31 __entry->type = type;
32 __entry->state = state;
33 ),
34
35 TP_printk("type=%lu state=%lu", (unsigned long)__entry->type, (unsigned long)__entry->state)
36);
37
38TRACE_EVENT(power_end,
39
40 TP_PROTO(int dummy),
41
42 TP_ARGS(dummy),
43
44 TP_STRUCT__entry(
45 __field( u64, dummy )
46 ),
47
48 TP_fast_assign(
49 __entry->dummy = 0xffff;
50 ),
51
52 TP_printk("dummy=%lu", (unsigned long)__entry->dummy)
53
54);
55
56
57TRACE_EVENT(power_frequency,
58
59 TP_PROTO(unsigned int type, unsigned int state),
60
61 TP_ARGS(type, state),
62
63 TP_STRUCT__entry(
64 __field( u64, type )
65 __field( u64, state )
66 ),
67
68 TP_fast_assign(
69 __entry->type = type;
70 __entry->state = state;
71 ),
72
73 TP_printk("type=%lu state=%lu", (unsigned long)__entry->type, (unsigned long) __entry->state)
74);
75
76#endif /* _TRACE_POWER_H */
77
78/* This part must be outside protection */
79#include <trace/define_trace.h>
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index b48f1ad7c946..b50b9856c59f 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
@@ -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,12 +102,12 @@ 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
113/* 113/*
@@ -127,7 +127,7 @@ TRACE_EVENT(sched_wakeup_new,
127 __field( pid_t, pid ) 127 __field( pid_t, pid )
128 __field( int, prio ) 128 __field( int, prio )
129 __field( int, success ) 129 __field( int, success )
130 __field( int, cpu ) 130 __field( int, target_cpu )
131 ), 131 ),
132 132
133 TP_fast_assign( 133 TP_fast_assign(
@@ -135,12 +135,12 @@ TRACE_EVENT(sched_wakeup_new,
135 __entry->pid = p->pid; 135 __entry->pid = p->pid;
136 __entry->prio = p->prio; 136 __entry->prio = p->prio;
137 __entry->success = success; 137 __entry->success = success;
138 __entry->cpu = task_cpu(p); 138 __entry->target_cpu = task_cpu(p);
139 ), 139 ),
140 140
141 TP_printk("task %s:%d [%d] success=%d [%03d]", 141 TP_printk("comm=%s pid=%d prio=%d success=%d target_cpu=%03d",
142 __entry->comm, __entry->pid, __entry->prio, 142 __entry->comm, __entry->pid, __entry->prio,
143 __entry->success, __entry->cpu) 143 __entry->success, __entry->target_cpu)
144); 144);
145 145
146/* 146/*
@@ -176,7 +176,7 @@ TRACE_EVENT(sched_switch,
176 __entry->next_prio = next->prio; 176 __entry->next_prio = next->prio;
177 ), 177 ),
178 178
179 TP_printk("task %s:%d [%d] (%s) ==> %s:%d [%d]", 179 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, 180 __entry->prev_comm, __entry->prev_pid, __entry->prev_prio,
181 __entry->prev_state ? 181 __entry->prev_state ?
182 __print_flags(__entry->prev_state, "|", 182 __print_flags(__entry->prev_state, "|",
@@ -211,7 +211,7 @@ TRACE_EVENT(sched_migrate_task,
211 __entry->dest_cpu = dest_cpu; 211 __entry->dest_cpu = dest_cpu;
212 ), 212 ),
213 213
214 TP_printk("task %s:%d [%d] from: %d to: %d", 214 TP_printk("comm=%s pid=%d prio=%d orig_cpu=%d dest_cpu=%d",
215 __entry->comm, __entry->pid, __entry->prio, 215 __entry->comm, __entry->pid, __entry->prio,
216 __entry->orig_cpu, __entry->dest_cpu) 216 __entry->orig_cpu, __entry->dest_cpu)
217); 217);
@@ -237,7 +237,7 @@ TRACE_EVENT(sched_process_free,
237 __entry->prio = p->prio; 237 __entry->prio = p->prio;
238 ), 238 ),
239 239
240 TP_printk("task %s:%d [%d]", 240 TP_printk("comm=%s pid=%d prio=%d",
241 __entry->comm, __entry->pid, __entry->prio) 241 __entry->comm, __entry->pid, __entry->prio)
242); 242);
243 243
@@ -262,7 +262,7 @@ TRACE_EVENT(sched_process_exit,
262 __entry->prio = p->prio; 262 __entry->prio = p->prio;
263 ), 263 ),
264 264
265 TP_printk("task %s:%d [%d]", 265 TP_printk("comm=%s pid=%d prio=%d",
266 __entry->comm, __entry->pid, __entry->prio) 266 __entry->comm, __entry->pid, __entry->prio)
267); 267);
268 268
@@ -287,7 +287,7 @@ TRACE_EVENT(sched_process_wait,
287 __entry->prio = current->prio; 287 __entry->prio = current->prio;
288 ), 288 ),
289 289
290 TP_printk("task %s:%d [%d]", 290 TP_printk("comm=%s pid=%d prio=%d",
291 __entry->comm, __entry->pid, __entry->prio) 291 __entry->comm, __entry->pid, __entry->prio)
292); 292);
293 293
@@ -314,7 +314,7 @@ TRACE_EVENT(sched_process_fork,
314 __entry->child_pid = child->pid; 314 __entry->child_pid = child->pid;
315 ), 315 ),
316 316
317 TP_printk("parent %s:%d child %s:%d", 317 TP_printk("comm=%s pid=%d child_comm=%s child_pid=%d",
318 __entry->parent_comm, __entry->parent_pid, 318 __entry->parent_comm, __entry->parent_pid,
319 __entry->child_comm, __entry->child_pid) 319 __entry->child_comm, __entry->child_pid)
320); 320);
@@ -340,7 +340,7 @@ TRACE_EVENT(sched_signal_send,
340 __entry->sig = sig; 340 __entry->sig = sig;
341 ), 341 ),
342 342
343 TP_printk("sig: %d task %s:%d", 343 TP_printk("sig=%d comm=%s pid=%d",
344 __entry->sig, __entry->comm, __entry->pid) 344 __entry->sig, __entry->comm, __entry->pid)
345); 345);
346 346
@@ -374,12 +374,45 @@ TRACE_EVENT(sched_stat_wait,
374 __perf_count(delay); 374 __perf_count(delay);
375 ), 375 ),
376 376
377 TP_printk("task: %s:%d wait: %Lu [ns]", 377 TP_printk("comm=%s pid=%d delay=%Lu [ns]",
378 __entry->comm, __entry->pid, 378 __entry->comm, __entry->pid,
379 (unsigned long long)__entry->delay) 379 (unsigned long long)__entry->delay)
380); 380);
381 381
382/* 382/*
383 * Tracepoint for accounting runtime (time the task is executing
384 * on a CPU).
385 */
386TRACE_EVENT(sched_stat_runtime,
387
388 TP_PROTO(struct task_struct *tsk, u64 runtime, u64 vruntime),
389
390 TP_ARGS(tsk, runtime, vruntime),
391
392 TP_STRUCT__entry(
393 __array( char, comm, TASK_COMM_LEN )
394 __field( pid_t, pid )
395 __field( u64, runtime )
396 __field( u64, vruntime )
397 ),
398
399 TP_fast_assign(
400 memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
401 __entry->pid = tsk->pid;
402 __entry->runtime = runtime;
403 __entry->vruntime = vruntime;
404 )
405 TP_perf_assign(
406 __perf_count(runtime);
407 ),
408
409 TP_printk("comm=%s pid=%d runtime=%Lu [ns] vruntime=%Lu [ns]",
410 __entry->comm, __entry->pid,
411 (unsigned long long)__entry->runtime,
412 (unsigned long long)__entry->vruntime)
413);
414
415/*
383 * Tracepoint for accounting sleep time (time the task is not runnable, 416 * Tracepoint for accounting sleep time (time the task is not runnable,
384 * including iowait, see below). 417 * including iowait, see below).
385 */ 418 */
@@ -404,7 +437,7 @@ TRACE_EVENT(sched_stat_sleep,
404 __perf_count(delay); 437 __perf_count(delay);
405 ), 438 ),
406 439
407 TP_printk("task: %s:%d sleep: %Lu [ns]", 440 TP_printk("comm=%s pid=%d delay=%Lu [ns]",
408 __entry->comm, __entry->pid, 441 __entry->comm, __entry->pid,
409 (unsigned long long)__entry->delay) 442 (unsigned long long)__entry->delay)
410); 443);
@@ -434,7 +467,7 @@ TRACE_EVENT(sched_stat_iowait,
434 __perf_count(delay); 467 __perf_count(delay);
435 ), 468 ),
436 469
437 TP_printk("task: %s:%d iowait: %Lu [ns]", 470 TP_printk("comm=%s pid=%d delay=%Lu [ns]",
438 __entry->comm, __entry->pid, 471 __entry->comm, __entry->pid,
439 (unsigned long long)__entry->delay) 472 (unsigned long long)__entry->delay)
440); 473);
diff --git a/include/trace/events/timer.h b/include/trace/events/timer.h
new file mode 100644
index 000000000000..e5ce87a0498d
--- /dev/null
+++ b/include/trace/events/timer.h
@@ -0,0 +1,341 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM timer
3
4#if !defined(_TRACE_TIMER_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_TIMER_H
6
7#include <linux/tracepoint.h>
8#include <linux/hrtimer.h>
9#include <linux/timer.h>
10
11/**
12 * timer_init - called when the timer is initialized
13 * @timer: pointer to struct timer_list
14 */
15TRACE_EVENT(timer_init,
16
17 TP_PROTO(struct timer_list *timer),
18
19 TP_ARGS(timer),
20
21 TP_STRUCT__entry(
22 __field( void *, timer )
23 ),
24
25 TP_fast_assign(
26 __entry->timer = timer;
27 ),
28
29 TP_printk("timer=%p", __entry->timer)
30);
31
32/**
33 * timer_start - called when the timer is started
34 * @timer: pointer to struct timer_list
35 * @expires: the timers expiry time
36 */
37TRACE_EVENT(timer_start,
38
39 TP_PROTO(struct timer_list *timer, unsigned long expires),
40
41 TP_ARGS(timer, expires),
42
43 TP_STRUCT__entry(
44 __field( void *, timer )
45 __field( void *, function )
46 __field( unsigned long, expires )
47 __field( unsigned long, now )
48 ),
49
50 TP_fast_assign(
51 __entry->timer = timer;
52 __entry->function = timer->function;
53 __entry->expires = expires;
54 __entry->now = jiffies;
55 ),
56
57 TP_printk("timer=%p function=%pf expires=%lu [timeout=%ld]",
58 __entry->timer, __entry->function, __entry->expires,
59 (long)__entry->expires - __entry->now)
60);
61
62/**
63 * timer_expire_entry - called immediately before the timer callback
64 * @timer: pointer to struct timer_list
65 *
66 * Allows to determine the timer latency.
67 */
68TRACE_EVENT(timer_expire_entry,
69
70 TP_PROTO(struct timer_list *timer),
71
72 TP_ARGS(timer),
73
74 TP_STRUCT__entry(
75 __field( void *, timer )
76 __field( unsigned long, now )
77 ),
78
79 TP_fast_assign(
80 __entry->timer = timer;
81 __entry->now = jiffies;
82 ),
83
84 TP_printk("timer=%p now=%lu", __entry->timer, __entry->now)
85);
86
87/**
88 * timer_expire_exit - called immediately after the timer callback returns
89 * @timer: pointer to struct timer_list
90 *
91 * When used in combination with the timer_expire_entry tracepoint we can
92 * determine the runtime of the timer callback function.
93 *
94 * NOTE: Do NOT derefernce timer in TP_fast_assign. The pointer might
95 * be invalid. We solely track the pointer.
96 */
97TRACE_EVENT(timer_expire_exit,
98
99 TP_PROTO(struct timer_list *timer),
100
101 TP_ARGS(timer),
102
103 TP_STRUCT__entry(
104 __field(void *, timer )
105 ),
106
107 TP_fast_assign(
108 __entry->timer = timer;
109 ),
110
111 TP_printk("timer=%p", __entry->timer)
112);
113
114/**
115 * timer_cancel - called when the timer is canceled
116 * @timer: pointer to struct timer_list
117 */
118TRACE_EVENT(timer_cancel,
119
120 TP_PROTO(struct timer_list *timer),
121
122 TP_ARGS(timer),
123
124 TP_STRUCT__entry(
125 __field( void *, timer )
126 ),
127
128 TP_fast_assign(
129 __entry->timer = timer;
130 ),
131
132 TP_printk("timer=%p", __entry->timer)
133);
134
135/**
136 * hrtimer_init - called when the hrtimer is initialized
137 * @timer: pointer to struct hrtimer
138 * @clockid: the hrtimers clock
139 * @mode: the hrtimers mode
140 */
141TRACE_EVENT(hrtimer_init,
142
143 TP_PROTO(struct hrtimer *hrtimer, clockid_t clockid,
144 enum hrtimer_mode mode),
145
146 TP_ARGS(hrtimer, clockid, mode),
147
148 TP_STRUCT__entry(
149 __field( void *, hrtimer )
150 __field( clockid_t, clockid )
151 __field( enum hrtimer_mode, mode )
152 ),
153
154 TP_fast_assign(
155 __entry->hrtimer = hrtimer;
156 __entry->clockid = clockid;
157 __entry->mode = mode;
158 ),
159
160 TP_printk("hrtimer=%p clockid=%s mode=%s", __entry->hrtimer,
161 __entry->clockid == CLOCK_REALTIME ?
162 "CLOCK_REALTIME" : "CLOCK_MONOTONIC",
163 __entry->mode == HRTIMER_MODE_ABS ?
164 "HRTIMER_MODE_ABS" : "HRTIMER_MODE_REL")
165);
166
167/**
168 * hrtimer_start - called when the hrtimer is started
169 * @timer: pointer to struct hrtimer
170 */
171TRACE_EVENT(hrtimer_start,
172
173 TP_PROTO(struct hrtimer *hrtimer),
174
175 TP_ARGS(hrtimer),
176
177 TP_STRUCT__entry(
178 __field( void *, hrtimer )
179 __field( void *, function )
180 __field( s64, expires )
181 __field( s64, softexpires )
182 ),
183
184 TP_fast_assign(
185 __entry->hrtimer = hrtimer;
186 __entry->function = hrtimer->function;
187 __entry->expires = hrtimer_get_expires(hrtimer).tv64;
188 __entry->softexpires = hrtimer_get_softexpires(hrtimer).tv64;
189 ),
190
191 TP_printk("hrtimer=%p function=%pf expires=%llu softexpires=%llu",
192 __entry->hrtimer, __entry->function,
193 (unsigned long long)ktime_to_ns((ktime_t) {
194 .tv64 = __entry->expires }),
195 (unsigned long long)ktime_to_ns((ktime_t) {
196 .tv64 = __entry->softexpires }))
197);
198
199/**
200 * htimmer_expire_entry - called immediately before the hrtimer callback
201 * @timer: pointer to struct hrtimer
202 * @now: pointer to variable which contains current time of the
203 * timers base.
204 *
205 * Allows to determine the timer latency.
206 */
207TRACE_EVENT(hrtimer_expire_entry,
208
209 TP_PROTO(struct hrtimer *hrtimer, ktime_t *now),
210
211 TP_ARGS(hrtimer, now),
212
213 TP_STRUCT__entry(
214 __field( void *, hrtimer )
215 __field( s64, now )
216 ),
217
218 TP_fast_assign(
219 __entry->hrtimer = hrtimer;
220 __entry->now = now->tv64;
221 ),
222
223 TP_printk("hrtimer=%p now=%llu", __entry->hrtimer,
224 (unsigned long long)ktime_to_ns((ktime_t) { .tv64 = __entry->now }))
225 );
226
227/**
228 * hrtimer_expire_exit - called immediately after the hrtimer callback returns
229 * @timer: pointer to struct hrtimer
230 *
231 * When used in combination with the hrtimer_expire_entry tracepoint we can
232 * determine the runtime of the callback function.
233 */
234TRACE_EVENT(hrtimer_expire_exit,
235
236 TP_PROTO(struct hrtimer *hrtimer),
237
238 TP_ARGS(hrtimer),
239
240 TP_STRUCT__entry(
241 __field( void *, hrtimer )
242 ),
243
244 TP_fast_assign(
245 __entry->hrtimer = hrtimer;
246 ),
247
248 TP_printk("hrtimer=%p", __entry->hrtimer)
249);
250
251/**
252 * hrtimer_cancel - called when the hrtimer is canceled
253 * @hrtimer: pointer to struct hrtimer
254 */
255TRACE_EVENT(hrtimer_cancel,
256
257 TP_PROTO(struct hrtimer *hrtimer),
258
259 TP_ARGS(hrtimer),
260
261 TP_STRUCT__entry(
262 __field( void *, hrtimer )
263 ),
264
265 TP_fast_assign(
266 __entry->hrtimer = hrtimer;
267 ),
268
269 TP_printk("hrtimer=%p", __entry->hrtimer)
270);
271
272/**
273 * itimer_state - called when itimer is started or canceled
274 * @which: name of the interval timer
275 * @value: the itimers value, itimer is canceled if value->it_value is
276 * zero, otherwise it is started
277 * @expires: the itimers expiry time
278 */
279TRACE_EVENT(itimer_state,
280
281 TP_PROTO(int which, const struct itimerval *const value,
282 cputime_t expires),
283
284 TP_ARGS(which, value, expires),
285
286 TP_STRUCT__entry(
287 __field( int, which )
288 __field( cputime_t, expires )
289 __field( long, value_sec )
290 __field( long, value_usec )
291 __field( long, interval_sec )
292 __field( long, interval_usec )
293 ),
294
295 TP_fast_assign(
296 __entry->which = which;
297 __entry->expires = expires;
298 __entry->value_sec = value->it_value.tv_sec;
299 __entry->value_usec = value->it_value.tv_usec;
300 __entry->interval_sec = value->it_interval.tv_sec;
301 __entry->interval_usec = value->it_interval.tv_usec;
302 ),
303
304 TP_printk("which=%d expires=%lu it_value=%lu.%lu it_interval=%lu.%lu",
305 __entry->which, __entry->expires,
306 __entry->value_sec, __entry->value_usec,
307 __entry->interval_sec, __entry->interval_usec)
308);
309
310/**
311 * itimer_expire - called when itimer expires
312 * @which: type of the interval timer
313 * @pid: pid of the process which owns the timer
314 * @now: current time, used to calculate the latency of itimer
315 */
316TRACE_EVENT(itimer_expire,
317
318 TP_PROTO(int which, struct pid *pid, cputime_t now),
319
320 TP_ARGS(which, pid, now),
321
322 TP_STRUCT__entry(
323 __field( int , which )
324 __field( pid_t, pid )
325 __field( cputime_t, now )
326 ),
327
328 TP_fast_assign(
329 __entry->which = which;
330 __entry->now = now;
331 __entry->pid = pid_nr(pid);
332 ),
333
334 TP_printk("which=%d pid=%d now=%lu", __entry->which,
335 (int) __entry->pid, __entry->now)
336);
337
338#endif /* _TRACE_TIMER_H */
339
340/* This part must be outside protection */
341#include <trace/define_trace.h>
diff --git a/include/trace/events/workqueue.h b/include/trace/events/workqueue.h
index fcfd9a1e4b96..e4612dbd7ba6 100644
--- a/include/trace/events/workqueue.h
+++ b/include/trace/events/workqueue.h
@@ -26,7 +26,7 @@ TRACE_EVENT(workqueue_insertion,
26 __entry->func = work->func; 26 __entry->func = work->func;
27 ), 27 ),
28 28
29 TP_printk("thread=%s:%d func=%pF", __entry->thread_comm, 29 TP_printk("thread=%s:%d func=%pf", __entry->thread_comm,
30 __entry->thread_pid, __entry->func) 30 __entry->thread_pid, __entry->func)
31); 31);
32 32
@@ -48,7 +48,7 @@ TRACE_EVENT(workqueue_execution,
48 __entry->func = work->func; 48 __entry->func = work->func;
49 ), 49 ),
50 50
51 TP_printk("thread=%s:%d func=%pF", __entry->thread_comm, 51 TP_printk("thread=%s:%d func=%pf", __entry->thread_comm,
52 __entry->thread_pid, __entry->func) 52 __entry->thread_pid, __entry->func)
53); 53);
54 54
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index 308bafd93325..c9bbcab95fbe 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -120,9 +120,10 @@
120#undef __field 120#undef __field
121#define __field(type, item) \ 121#define __field(type, item) \
122 ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \ 122 ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \
123 "offset:%u;\tsize:%u;\n", \ 123 "offset:%u;\tsize:%u;\tsigned:%u;\n", \
124 (unsigned int)offsetof(typeof(field), item), \ 124 (unsigned int)offsetof(typeof(field), item), \
125 (unsigned int)sizeof(field.item)); \ 125 (unsigned int)sizeof(field.item), \
126 (unsigned int)is_signed_type(type)); \
126 if (!ret) \ 127 if (!ret) \
127 return 0; 128 return 0;
128 129
@@ -132,19 +133,21 @@
132#undef __array 133#undef __array
133#define __array(type, item, len) \ 134#define __array(type, item, len) \
134 ret = trace_seq_printf(s, "\tfield:" #type " " #item "[" #len "];\t" \ 135 ret = trace_seq_printf(s, "\tfield:" #type " " #item "[" #len "];\t" \
135 "offset:%u;\tsize:%u;\n", \ 136 "offset:%u;\tsize:%u;\tsigned:%u;\n", \
136 (unsigned int)offsetof(typeof(field), item), \ 137 (unsigned int)offsetof(typeof(field), item), \
137 (unsigned int)sizeof(field.item)); \ 138 (unsigned int)sizeof(field.item), \
139 (unsigned int)is_signed_type(type)); \
138 if (!ret) \ 140 if (!ret) \
139 return 0; 141 return 0;
140 142
141#undef __dynamic_array 143#undef __dynamic_array
142#define __dynamic_array(type, item, len) \ 144#define __dynamic_array(type, item, len) \
143 ret = trace_seq_printf(s, "\tfield:__data_loc " #type "[] " #item ";\t"\ 145 ret = trace_seq_printf(s, "\tfield:__data_loc " #type "[] " #item ";\t"\
144 "offset:%u;\tsize:%u;\n", \ 146 "offset:%u;\tsize:%u;\tsigned:%u;\n", \
145 (unsigned int)offsetof(typeof(field), \ 147 (unsigned int)offsetof(typeof(field), \
146 __data_loc_##item), \ 148 __data_loc_##item), \
147 (unsigned int)sizeof(field.__data_loc_##item)); \ 149 (unsigned int)sizeof(field.__data_loc_##item), \
150 (unsigned int)is_signed_type(type)); \
148 if (!ret) \ 151 if (!ret) \
149 return 0; 152 return 0;
150 153
@@ -239,9 +242,9 @@ ftrace_format_##call(struct ftrace_event_call *unused, \
239#undef __print_flags 242#undef __print_flags
240#define __print_flags(flag, delim, flag_array...) \ 243#define __print_flags(flag, delim, flag_array...) \
241 ({ \ 244 ({ \
242 static const struct trace_print_flags flags[] = \ 245 static const struct trace_print_flags __flags[] = \
243 { flag_array, { -1, NULL }}; \ 246 { flag_array, { -1, NULL }}; \
244 ftrace_print_flags_seq(p, delim, flag, flags); \ 247 ftrace_print_flags_seq(p, delim, flag, __flags); \
245 }) 248 })
246 249
247#undef __print_symbolic 250#undef __print_symbolic
@@ -254,7 +257,7 @@ ftrace_format_##call(struct ftrace_event_call *unused, \
254 257
255#undef TRACE_EVENT 258#undef TRACE_EVENT
256#define TRACE_EVENT(call, proto, args, tstruct, assign, print) \ 259#define TRACE_EVENT(call, proto, args, tstruct, assign, print) \
257enum print_line_t \ 260static enum print_line_t \
258ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \ 261ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \
259{ \ 262{ \
260 struct trace_seq *s = &iter->seq; \ 263 struct trace_seq *s = &iter->seq; \
@@ -317,7 +320,7 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \
317 320
318#undef TRACE_EVENT 321#undef TRACE_EVENT
319#define TRACE_EVENT(call, proto, args, tstruct, func, print) \ 322#define TRACE_EVENT(call, proto, args, tstruct, func, print) \
320int \ 323static int \
321ftrace_define_fields_##call(struct ftrace_event_call *event_call) \ 324ftrace_define_fields_##call(struct ftrace_event_call *event_call) \
322{ \ 325{ \
323 struct ftrace_raw_##call field; \ 326 struct ftrace_raw_##call field; \
@@ -378,24 +381,18 @@ static inline int ftrace_get_offsets_##call( \
378#ifdef CONFIG_EVENT_PROFILE 381#ifdef CONFIG_EVENT_PROFILE
379 382
380/* 383/*
381 * Generate the functions needed for tracepoint perf_counter support. 384 * Generate the functions needed for tracepoint perf_event support.
382 * 385 *
383 * NOTE: The insertion profile callback (ftrace_profile_<call>) is defined later 386 * NOTE: The insertion profile callback (ftrace_profile_<call>) is defined later
384 * 387 *
385 * static int ftrace_profile_enable_<call>(struct ftrace_event_call *event_call) 388 * static int ftrace_profile_enable_<call>(void)
386 * { 389 * {
387 * int ret = 0; 390 * return register_trace_<call>(ftrace_profile_<call>);
388 *
389 * if (!atomic_inc_return(&event_call->profile_count))
390 * ret = register_trace_<call>(ftrace_profile_<call>);
391 *
392 * return ret;
393 * } 391 * }
394 * 392 *
395 * static void ftrace_profile_disable_<call>(struct ftrace_event_call *event_call) 393 * static void ftrace_profile_disable_<call>(void)
396 * { 394 * {
397 * if (atomic_add_negative(-1, &event->call->profile_count)) 395 * unregister_trace_<call>(ftrace_profile_<call>);
398 * unregister_trace_<call>(ftrace_profile_<call>);
399 * } 396 * }
400 * 397 *
401 */ 398 */
@@ -405,20 +402,14 @@ static inline int ftrace_get_offsets_##call( \
405 \ 402 \
406static void ftrace_profile_##call(proto); \ 403static void ftrace_profile_##call(proto); \
407 \ 404 \
408static int ftrace_profile_enable_##call(struct ftrace_event_call *event_call) \ 405static int ftrace_profile_enable_##call(void) \
409{ \ 406{ \
410 int ret = 0; \ 407 return register_trace_##call(ftrace_profile_##call); \
411 \
412 if (!atomic_inc_return(&event_call->profile_count)) \
413 ret = register_trace_##call(ftrace_profile_##call); \
414 \
415 return ret; \
416} \ 408} \
417 \ 409 \
418static void ftrace_profile_disable_##call(struct ftrace_event_call *event_call)\ 410static void ftrace_profile_disable_##call(void) \
419{ \ 411{ \
420 if (atomic_add_negative(-1, &event_call->profile_count)) \ 412 unregister_trace_##call(ftrace_profile_##call); \
421 unregister_trace_##call(ftrace_profile_##call); \
422} 413}
423 414
424#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) 415#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
@@ -656,15 +647,16 @@ __attribute__((section("_ftrace_events"))) event_##call = { \
656 * { 647 * {
657 * struct ftrace_data_offsets_<call> __maybe_unused __data_offsets; 648 * struct ftrace_data_offsets_<call> __maybe_unused __data_offsets;
658 * struct ftrace_event_call *event_call = &event_<call>; 649 * struct ftrace_event_call *event_call = &event_<call>;
659 * extern void perf_tpcounter_event(int, u64, u64, void *, int); 650 * extern void perf_tp_event(int, u64, u64, void *, int);
660 * struct ftrace_raw_##call *entry; 651 * struct ftrace_raw_##call *entry;
661 * u64 __addr = 0, __count = 1; 652 * u64 __addr = 0, __count = 1;
662 * unsigned long irq_flags; 653 * unsigned long irq_flags;
654 * struct trace_entry *ent;
663 * int __entry_size; 655 * int __entry_size;
664 * int __data_size; 656 * int __data_size;
657 * int __cpu
665 * int pc; 658 * int pc;
666 * 659 *
667 * local_save_flags(irq_flags);
668 * pc = preempt_count(); 660 * pc = preempt_count();
669 * 661 *
670 * __data_size = ftrace_get_offsets_<call>(&__data_offsets, args); 662 * __data_size = ftrace_get_offsets_<call>(&__data_offsets, args);
@@ -675,25 +667,34 @@ __attribute__((section("_ftrace_events"))) event_##call = { \
675 * sizeof(u64)); 667 * sizeof(u64));
676 * __entry_size -= sizeof(u32); 668 * __entry_size -= sizeof(u32);
677 * 669 *
678 * do { 670 * // Protect the non nmi buffer
679 * char raw_data[__entry_size]; <- allocate our sample in the stack 671 * // This also protects the rcu read side
680 * struct trace_entry *ent; 672 * local_irq_save(irq_flags);
673 * __cpu = smp_processor_id();
674 *
675 * if (in_nmi())
676 * raw_data = rcu_dereference(trace_profile_buf_nmi);
677 * else
678 * raw_data = rcu_dereference(trace_profile_buf);
679 *
680 * if (!raw_data)
681 * goto end;
681 * 682 *
682 * zero dead bytes from alignment to avoid stack leak to userspace: 683 * raw_data = per_cpu_ptr(raw_data, __cpu);
683 * 684 *
684 * *(u64 *)(&raw_data[__entry_size - sizeof(u64)]) = 0ULL; 685 * //zero dead bytes from alignment to avoid stack leak to userspace:
685 * entry = (struct ftrace_raw_<call> *)raw_data; 686 * *(u64 *)(&raw_data[__entry_size - sizeof(u64)]) = 0ULL;
686 * ent = &entry->ent; 687 * entry = (struct ftrace_raw_<call> *)raw_data;
687 * tracing_generic_entry_update(ent, irq_flags, pc); 688 * ent = &entry->ent;
688 * ent->type = event_call->id; 689 * tracing_generic_entry_update(ent, irq_flags, pc);
690 * ent->type = event_call->id;
689 * 691 *
690 * <tstruct> <- do some jobs with dynamic arrays 692 * <tstruct> <- do some jobs with dynamic arrays
691 * 693 *
692 * <assign> <- affect our values 694 * <assign> <- affect our values
693 * 695 *
694 * perf_tpcounter_event(event_call->id, __addr, __count, entry, 696 * perf_tp_event(event_call->id, __addr, __count, entry,
695 * __entry_size); <- submit them to perf counter 697 * __entry_size); <- submit them to perf counter
696 * } while (0);
697 * 698 *
698 * } 699 * }
699 */ 700 */
@@ -712,15 +713,17 @@ static void ftrace_profile_##call(proto) \
712{ \ 713{ \
713 struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\ 714 struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\
714 struct ftrace_event_call *event_call = &event_##call; \ 715 struct ftrace_event_call *event_call = &event_##call; \
715 extern void perf_tpcounter_event(int, u64, u64, void *, int); \ 716 extern void perf_tp_event(int, u64, u64, void *, int); \
716 struct ftrace_raw_##call *entry; \ 717 struct ftrace_raw_##call *entry; \
717 u64 __addr = 0, __count = 1; \ 718 u64 __addr = 0, __count = 1; \
718 unsigned long irq_flags; \ 719 unsigned long irq_flags; \
720 struct trace_entry *ent; \
719 int __entry_size; \ 721 int __entry_size; \
720 int __data_size; \ 722 int __data_size; \
723 char *raw_data; \
724 int __cpu; \
721 int pc; \ 725 int pc; \
722 \ 726 \
723 local_save_flags(irq_flags); \
724 pc = preempt_count(); \ 727 pc = preempt_count(); \
725 \ 728 \
726 __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \ 729 __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \
@@ -728,23 +731,38 @@ static void ftrace_profile_##call(proto) \
728 sizeof(u64)); \ 731 sizeof(u64)); \
729 __entry_size -= sizeof(u32); \ 732 __entry_size -= sizeof(u32); \
730 \ 733 \
731 do { \ 734 if (WARN_ONCE(__entry_size > FTRACE_MAX_PROFILE_SIZE, \
732 char raw_data[__entry_size]; \ 735 "profile buffer not large enough")) \
733 struct trace_entry *ent; \ 736 return; \
737 \
738 local_irq_save(irq_flags); \
739 __cpu = smp_processor_id(); \
734 \ 740 \
735 *(u64 *)(&raw_data[__entry_size - sizeof(u64)]) = 0ULL; \ 741 if (in_nmi()) \
736 entry = (struct ftrace_raw_##call *)raw_data; \ 742 raw_data = rcu_dereference(trace_profile_buf_nmi); \
737 ent = &entry->ent; \ 743 else \
738 tracing_generic_entry_update(ent, irq_flags, pc); \ 744 raw_data = rcu_dereference(trace_profile_buf); \
739 ent->type = event_call->id; \
740 \ 745 \
741 tstruct \ 746 if (!raw_data) \
747 goto end; \
742 \ 748 \
743 { assign; } \ 749 raw_data = per_cpu_ptr(raw_data, __cpu); \
744 \ 750 \
745 perf_tpcounter_event(event_call->id, __addr, __count, entry,\ 751 *(u64 *)(&raw_data[__entry_size - sizeof(u64)]) = 0ULL; \
752 entry = (struct ftrace_raw_##call *)raw_data; \
753 ent = &entry->ent; \
754 tracing_generic_entry_update(ent, irq_flags, pc); \
755 ent->type = event_call->id; \
756 \
757 tstruct \
758 \
759 { assign; } \
760 \
761 perf_tp_event(event_call->id, __addr, __count, entry, \
746 __entry_size); \ 762 __entry_size); \
747 } while (0); \ 763 \
764end: \
765 local_irq_restore(irq_flags); \
748 \ 766 \
749} 767}
750 768
diff --git a/include/trace/syscall.h b/include/trace/syscall.h
index 5dc283ba5ae0..e972f0a40f8d 100644
--- a/include/trace/syscall.h
+++ b/include/trace/syscall.h
@@ -33,7 +33,7 @@ struct syscall_metadata {
33}; 33};
34 34
35#ifdef CONFIG_FTRACE_SYSCALLS 35#ifdef CONFIG_FTRACE_SYSCALLS
36extern struct syscall_metadata *syscall_nr_to_meta(int nr); 36extern unsigned long arch_syscall_addr(int nr);
37extern int syscall_name_to_nr(char *name); 37extern int syscall_name_to_nr(char *name);
38void set_syscall_enter_id(int num, int id); 38void set_syscall_enter_id(int num, int id);
39void set_syscall_exit_id(int num, int id); 39void set_syscall_exit_id(int num, int id);