diff options
Diffstat (limited to 'include/trace')
| -rw-r--r-- | include/trace/events/ext4.h | 142 | ||||
| -rw-r--r-- | include/trace/events/jbd2.h | 2 | ||||
| -rw-r--r-- | include/trace/events/kmem.h | 163 | ||||
| -rw-r--r-- | include/trace/events/power.h | 81 | ||||
| -rw-r--r-- | include/trace/events/sched.h | 33 | ||||
| -rw-r--r-- | include/trace/events/timer.h | 342 | ||||
| -rw-r--r-- | include/trace/ftrace.h | 117 |
7 files changed, 791 insertions, 89 deletions
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h index 8d433c4e3709..c1bd8f1e8b94 100644 --- a/include/trace/events/ext4.h +++ b/include/trace/events/ext4.h | |||
| @@ -5,10 +5,15 @@ | |||
| 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 | ||
| 10 | struct ext4_allocation_context; | ||
| 11 | struct ext4_allocation_request; | ||
| 12 | struct ext4_prealloc_space; | ||
| 13 | struct ext4_inode_info; | ||
| 14 | |||
| 15 | #define EXT4_I(inode) (container_of(inode, struct ext4_inode_info, vfs_inode)) | ||
| 16 | |||
| 12 | TRACE_EVENT(ext4_free_inode, | 17 | TRACE_EVENT(ext4_free_inode, |
| 13 | TP_PROTO(struct inode *inode), | 18 | TP_PROTO(struct inode *inode), |
| 14 | 19 | ||
| @@ -33,8 +38,8 @@ TRACE_EVENT(ext4_free_inode, | |||
| 33 | ), | 38 | ), |
| 34 | 39 | ||
| 35 | TP_printk("dev %s ino %lu mode %d uid %u gid %u blocks %llu", | 40 | 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, | 41 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, |
| 37 | __entry->uid, __entry->gid, | 42 | __entry->mode, __entry->uid, __entry->gid, |
| 38 | (unsigned long long) __entry->blocks) | 43 | (unsigned long long) __entry->blocks) |
| 39 | ); | 44 | ); |
| 40 | 45 | ||
| @@ -56,7 +61,8 @@ TRACE_EVENT(ext4_request_inode, | |||
| 56 | ), | 61 | ), |
| 57 | 62 | ||
| 58 | TP_printk("dev %s dir %lu mode %d", | 63 | TP_printk("dev %s dir %lu mode %d", |
| 59 | jbd2_dev_to_name(__entry->dev), __entry->dir, __entry->mode) | 64 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->dir, |
| 65 | __entry->mode) | ||
| 60 | ); | 66 | ); |
| 61 | 67 | ||
| 62 | TRACE_EVENT(ext4_allocate_inode, | 68 | TRACE_EVENT(ext4_allocate_inode, |
| @@ -79,7 +85,8 @@ TRACE_EVENT(ext4_allocate_inode, | |||
| 79 | ), | 85 | ), |
| 80 | 86 | ||
| 81 | TP_printk("dev %s ino %lu dir %lu mode %d", | 87 | TP_printk("dev %s ino %lu dir %lu mode %d", |
| 82 | jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->dir, __entry->mode) | 88 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, |
| 89 | (unsigned long) __entry->dir, __entry->mode) | ||
| 83 | ); | 90 | ); |
| 84 | 91 | ||
| 85 | TRACE_EVENT(ext4_write_begin, | 92 | TRACE_EVENT(ext4_write_begin, |
| @@ -106,8 +113,8 @@ TRACE_EVENT(ext4_write_begin, | |||
| 106 | ), | 113 | ), |
| 107 | 114 | ||
| 108 | TP_printk("dev %s ino %lu pos %llu len %u flags %u", | 115 | 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, | 116 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, |
| 110 | __entry->flags) | 117 | __entry->pos, __entry->len, __entry->flags) |
| 111 | ); | 118 | ); |
| 112 | 119 | ||
| 113 | TRACE_EVENT(ext4_ordered_write_end, | 120 | TRACE_EVENT(ext4_ordered_write_end, |
| @@ -133,8 +140,8 @@ TRACE_EVENT(ext4_ordered_write_end, | |||
| 133 | ), | 140 | ), |
| 134 | 141 | ||
| 135 | TP_printk("dev %s ino %lu pos %llu len %u copied %u", | 142 | 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, | 143 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, |
| 137 | __entry->copied) | 144 | __entry->pos, __entry->len, __entry->copied) |
| 138 | ); | 145 | ); |
| 139 | 146 | ||
| 140 | TRACE_EVENT(ext4_writeback_write_end, | 147 | TRACE_EVENT(ext4_writeback_write_end, |
| @@ -160,8 +167,8 @@ TRACE_EVENT(ext4_writeback_write_end, | |||
| 160 | ), | 167 | ), |
| 161 | 168 | ||
| 162 | TP_printk("dev %s ino %lu pos %llu len %u copied %u", | 169 | 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, | 170 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, |
| 164 | __entry->copied) | 171 | __entry->pos, __entry->len, __entry->copied) |
| 165 | ); | 172 | ); |
| 166 | 173 | ||
| 167 | TRACE_EVENT(ext4_journalled_write_end, | 174 | TRACE_EVENT(ext4_journalled_write_end, |
| @@ -186,8 +193,8 @@ TRACE_EVENT(ext4_journalled_write_end, | |||
| 186 | ), | 193 | ), |
| 187 | 194 | ||
| 188 | TP_printk("dev %s ino %lu pos %llu len %u copied %u", | 195 | 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, | 196 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, |
| 190 | __entry->copied) | 197 | __entry->pos, __entry->len, __entry->copied) |
| 191 | ); | 198 | ); |
| 192 | 199 | ||
| 193 | TRACE_EVENT(ext4_writepage, | 200 | TRACE_EVENT(ext4_writepage, |
| @@ -209,7 +216,8 @@ TRACE_EVENT(ext4_writepage, | |||
| 209 | ), | 216 | ), |
| 210 | 217 | ||
| 211 | TP_printk("dev %s ino %lu page_index %lu", | 218 | TP_printk("dev %s ino %lu page_index %lu", |
| 212 | jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->index) | 219 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, |
| 220 | __entry->index) | ||
| 213 | ); | 221 | ); |
| 214 | 222 | ||
| 215 | TRACE_EVENT(ext4_da_writepages, | 223 | TRACE_EVENT(ext4_da_writepages, |
| @@ -243,14 +251,49 @@ TRACE_EVENT(ext4_da_writepages, | |||
| 243 | __entry->range_cyclic = wbc->range_cyclic; | 251 | __entry->range_cyclic = wbc->range_cyclic; |
| 244 | ), | 252 | ), |
| 245 | 253 | ||
| 246 | 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 range_cyclic %d", | 254 | 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", |
| 247 | jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->nr_to_write, | 255 | jbd2_dev_to_name(__entry->dev), |
| 256 | (unsigned long) __entry->ino, __entry->nr_to_write, | ||
| 248 | __entry->pages_skipped, __entry->range_start, | 257 | __entry->pages_skipped, __entry->range_start, |
| 249 | __entry->range_end, __entry->nonblocking, | 258 | __entry->range_end, __entry->nonblocking, |
| 250 | __entry->for_kupdate, __entry->for_reclaim, | 259 | __entry->for_kupdate, __entry->for_reclaim, |
| 251 | __entry->range_cyclic) | 260 | __entry->range_cyclic) |
| 252 | ); | 261 | ); |
| 253 | 262 | ||
| 263 | TRACE_EVENT(ext4_da_write_pages, | ||
| 264 | TP_PROTO(struct inode *inode, struct mpage_da_data *mpd), | ||
| 265 | |||
| 266 | TP_ARGS(inode, mpd), | ||
| 267 | |||
| 268 | TP_STRUCT__entry( | ||
| 269 | __field( dev_t, dev ) | ||
| 270 | __field( ino_t, ino ) | ||
| 271 | __field( __u64, b_blocknr ) | ||
| 272 | __field( __u32, b_size ) | ||
| 273 | __field( __u32, b_state ) | ||
| 274 | __field( unsigned long, first_page ) | ||
| 275 | __field( int, io_done ) | ||
| 276 | __field( int, pages_written ) | ||
| 277 | ), | ||
| 278 | |||
| 279 | TP_fast_assign( | ||
| 280 | __entry->dev = inode->i_sb->s_dev; | ||
| 281 | __entry->ino = inode->i_ino; | ||
| 282 | __entry->b_blocknr = mpd->b_blocknr; | ||
| 283 | __entry->b_size = mpd->b_size; | ||
| 284 | __entry->b_state = mpd->b_state; | ||
| 285 | __entry->first_page = mpd->first_page; | ||
| 286 | __entry->io_done = mpd->io_done; | ||
| 287 | __entry->pages_written = mpd->pages_written; | ||
| 288 | ), | ||
| 289 | |||
| 290 | 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", | ||
| 291 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, | ||
| 292 | __entry->b_blocknr, __entry->b_size, | ||
| 293 | __entry->b_state, __entry->first_page, | ||
| 294 | __entry->io_done, __entry->pages_written) | ||
| 295 | ); | ||
| 296 | |||
| 254 | TRACE_EVENT(ext4_da_writepages_result, | 297 | TRACE_EVENT(ext4_da_writepages_result, |
| 255 | TP_PROTO(struct inode *inode, struct writeback_control *wbc, | 298 | TP_PROTO(struct inode *inode, struct writeback_control *wbc, |
| 256 | int ret, int pages_written), | 299 | int ret, int pages_written), |
| @@ -280,7 +323,8 @@ TRACE_EVENT(ext4_da_writepages_result, | |||
| 280 | ), | 323 | ), |
| 281 | 324 | ||
| 282 | TP_printk("dev %s ino %lu ret %d pages_written %d pages_skipped %ld congestion %d more_io %d no_nrwrite_index_update %d", | 325 | TP_printk("dev %s ino %lu ret %d pages_written %d pages_skipped %ld congestion %d more_io %d no_nrwrite_index_update %d", |
| 283 | jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->ret, | 326 | jbd2_dev_to_name(__entry->dev), |
| 327 | (unsigned long) __entry->ino, __entry->ret, | ||
| 284 | __entry->pages_written, __entry->pages_skipped, | 328 | __entry->pages_written, __entry->pages_skipped, |
| 285 | __entry->encountered_congestion, __entry->more_io, | 329 | __entry->encountered_congestion, __entry->more_io, |
| 286 | __entry->no_nrwrite_index_update) | 330 | __entry->no_nrwrite_index_update) |
| @@ -309,8 +353,8 @@ TRACE_EVENT(ext4_da_write_begin, | |||
| 309 | ), | 353 | ), |
| 310 | 354 | ||
| 311 | TP_printk("dev %s ino %lu pos %llu len %u flags %u", | 355 | TP_printk("dev %s ino %lu pos %llu len %u flags %u", |
| 312 | jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->pos, __entry->len, | 356 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, |
| 313 | __entry->flags) | 357 | __entry->pos, __entry->len, __entry->flags) |
| 314 | ); | 358 | ); |
| 315 | 359 | ||
| 316 | TRACE_EVENT(ext4_da_write_end, | 360 | TRACE_EVENT(ext4_da_write_end, |
| @@ -336,8 +380,8 @@ TRACE_EVENT(ext4_da_write_end, | |||
| 336 | ), | 380 | ), |
| 337 | 381 | ||
| 338 | TP_printk("dev %s ino %lu pos %llu len %u copied %u", | 382 | TP_printk("dev %s ino %lu pos %llu len %u copied %u", |
| 339 | jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->pos, __entry->len, | 383 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, |
| 340 | __entry->copied) | 384 | __entry->pos, __entry->len, __entry->copied) |
| 341 | ); | 385 | ); |
| 342 | 386 | ||
| 343 | TRACE_EVENT(ext4_discard_blocks, | 387 | TRACE_EVENT(ext4_discard_blocks, |
| @@ -387,8 +431,8 @@ TRACE_EVENT(ext4_mb_new_inode_pa, | |||
| 387 | ), | 431 | ), |
| 388 | 432 | ||
| 389 | TP_printk("dev %s ino %lu pstart %llu len %u lstart %llu", | 433 | TP_printk("dev %s ino %lu pstart %llu len %u lstart %llu", |
| 390 | jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->pa_pstart, | 434 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, |
| 391 | __entry->pa_len, __entry->pa_lstart) | 435 | __entry->pa_pstart, __entry->pa_len, __entry->pa_lstart) |
| 392 | ); | 436 | ); |
| 393 | 437 | ||
| 394 | TRACE_EVENT(ext4_mb_new_group_pa, | 438 | TRACE_EVENT(ext4_mb_new_group_pa, |
| @@ -415,8 +459,8 @@ TRACE_EVENT(ext4_mb_new_group_pa, | |||
| 415 | ), | 459 | ), |
| 416 | 460 | ||
| 417 | TP_printk("dev %s ino %lu pstart %llu len %u lstart %llu", | 461 | TP_printk("dev %s ino %lu pstart %llu len %u lstart %llu", |
| 418 | jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->pa_pstart, | 462 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, |
| 419 | __entry->pa_len, __entry->pa_lstart) | 463 | __entry->pa_pstart, __entry->pa_len, __entry->pa_lstart) |
| 420 | ); | 464 | ); |
| 421 | 465 | ||
| 422 | TRACE_EVENT(ext4_mb_release_inode_pa, | 466 | TRACE_EVENT(ext4_mb_release_inode_pa, |
| @@ -442,8 +486,8 @@ TRACE_EVENT(ext4_mb_release_inode_pa, | |||
| 442 | ), | 486 | ), |
| 443 | 487 | ||
| 444 | TP_printk("dev %s ino %lu block %llu count %u", | 488 | TP_printk("dev %s ino %lu block %llu count %u", |
| 445 | jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->block, | 489 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, |
| 446 | __entry->count) | 490 | __entry->block, __entry->count) |
| 447 | ); | 491 | ); |
| 448 | 492 | ||
| 449 | TRACE_EVENT(ext4_mb_release_group_pa, | 493 | TRACE_EVENT(ext4_mb_release_group_pa, |
| @@ -488,7 +532,7 @@ TRACE_EVENT(ext4_discard_preallocations, | |||
| 488 | ), | 532 | ), |
| 489 | 533 | ||
| 490 | TP_printk("dev %s ino %lu", | 534 | TP_printk("dev %s ino %lu", |
| 491 | jbd2_dev_to_name(__entry->dev), __entry->ino) | 535 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino) |
| 492 | ); | 536 | ); |
| 493 | 537 | ||
| 494 | TRACE_EVENT(ext4_mb_discard_preallocations, | 538 | TRACE_EVENT(ext4_mb_discard_preallocations, |
| @@ -543,8 +587,8 @@ TRACE_EVENT(ext4_request_blocks, | |||
| 543 | ), | 587 | ), |
| 544 | 588 | ||
| 545 | TP_printk("dev %s ino %lu flags %u len %u lblk %llu goal %llu lleft %llu lright %llu pleft %llu pright %llu ", | 589 | TP_printk("dev %s ino %lu flags %u len %u lblk %llu goal %llu lleft %llu lright %llu pleft %llu pright %llu ", |
| 546 | jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->flags, | 590 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, |
| 547 | __entry->len, | 591 | __entry->flags, __entry->len, |
| 548 | (unsigned long long) __entry->logical, | 592 | (unsigned long long) __entry->logical, |
| 549 | (unsigned long long) __entry->goal, | 593 | (unsigned long long) __entry->goal, |
| 550 | (unsigned long long) __entry->lleft, | 594 | (unsigned long long) __entry->lleft, |
| @@ -587,8 +631,8 @@ TRACE_EVENT(ext4_allocate_blocks, | |||
| 587 | ), | 631 | ), |
| 588 | 632 | ||
| 589 | TP_printk("dev %s ino %lu flags %u len %u block %llu lblk %llu goal %llu lleft %llu lright %llu pleft %llu pright %llu ", | 633 | TP_printk("dev %s ino %lu flags %u len %u block %llu lblk %llu goal %llu lleft %llu lright %llu pleft %llu pright %llu ", |
| 590 | jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->flags, | 634 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, |
| 591 | __entry->len, __entry->block, | 635 | __entry->flags, __entry->len, __entry->block, |
| 592 | (unsigned long long) __entry->logical, | 636 | (unsigned long long) __entry->logical, |
| 593 | (unsigned long long) __entry->goal, | 637 | (unsigned long long) __entry->goal, |
| 594 | (unsigned long long) __entry->lleft, | 638 | (unsigned long long) __entry->lleft, |
| @@ -621,8 +665,8 @@ TRACE_EVENT(ext4_free_blocks, | |||
| 621 | ), | 665 | ), |
| 622 | 666 | ||
| 623 | TP_printk("dev %s ino %lu block %llu count %lu metadata %d", | 667 | TP_printk("dev %s ino %lu block %llu count %lu metadata %d", |
| 624 | jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->block, | 668 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, |
| 625 | __entry->count, __entry->metadata) | 669 | __entry->block, __entry->count, __entry->metadata) |
| 626 | ); | 670 | ); |
| 627 | 671 | ||
| 628 | TRACE_EVENT(ext4_sync_file, | 672 | TRACE_EVENT(ext4_sync_file, |
| @@ -645,8 +689,8 @@ TRACE_EVENT(ext4_sync_file, | |||
| 645 | ), | 689 | ), |
| 646 | 690 | ||
| 647 | TP_printk("dev %s ino %ld parent %ld datasync %d ", | 691 | TP_printk("dev %s ino %ld parent %ld datasync %d ", |
| 648 | jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->parent, | 692 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, |
| 649 | __entry->datasync) | 693 | (unsigned long) __entry->parent, __entry->datasync) |
| 650 | ); | 694 | ); |
| 651 | 695 | ||
| 652 | TRACE_EVENT(ext4_sync_fs, | 696 | TRACE_EVENT(ext4_sync_fs, |
| @@ -669,6 +713,30 @@ TRACE_EVENT(ext4_sync_fs, | |||
| 669 | __entry->wait) | 713 | __entry->wait) |
| 670 | ); | 714 | ); |
| 671 | 715 | ||
| 716 | TRACE_EVENT(ext4_alloc_da_blocks, | ||
| 717 | TP_PROTO(struct inode *inode), | ||
| 718 | |||
| 719 | TP_ARGS(inode), | ||
| 720 | |||
| 721 | TP_STRUCT__entry( | ||
| 722 | __field( dev_t, dev ) | ||
| 723 | __field( ino_t, ino ) | ||
| 724 | __field( unsigned int, data_blocks ) | ||
| 725 | __field( unsigned int, meta_blocks ) | ||
| 726 | ), | ||
| 727 | |||
| 728 | TP_fast_assign( | ||
| 729 | __entry->dev = inode->i_sb->s_dev; | ||
| 730 | __entry->ino = inode->i_ino; | ||
| 731 | __entry->data_blocks = EXT4_I(inode)->i_reserved_data_blocks; | ||
| 732 | __entry->meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks; | ||
| 733 | ), | ||
| 734 | |||
| 735 | TP_printk("dev %s ino %lu data_blocks %u meta_blocks %u", | ||
| 736 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino, | ||
| 737 | __entry->data_blocks, __entry->meta_blocks) | ||
| 738 | ); | ||
| 739 | |||
| 672 | #endif /* _TRACE_EXT4_H */ | 740 | #endif /* _TRACE_EXT4_H */ |
| 673 | 741 | ||
| 674 | /* This part must be outside protection */ | 742 | /* This part must be outside protection */ |
diff --git a/include/trace/events/jbd2.h b/include/trace/events/jbd2.h index 10813fa0c8d0..b851f0b4701c 100644 --- a/include/trace/events/jbd2.h +++ b/include/trace/events/jbd2.h | |||
| @@ -159,7 +159,7 @@ TRACE_EVENT(jbd2_submit_inode_data, | |||
| 159 | ), | 159 | ), |
| 160 | 160 | ||
| 161 | TP_printk("dev %s ino %lu", | 161 | TP_printk("dev %s ino %lu", |
| 162 | jbd2_dev_to_name(__entry->dev), __entry->ino) | 162 | jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino) |
| 163 | ); | 163 | ); |
| 164 | 164 | ||
| 165 | #endif /* _TRACE_JBD2_H */ | 165 | #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 | |||
| 229 | TRACE_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 | |||
| 251 | TRACE_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 | |||
| 273 | TRACE_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 | |||
| 302 | TRACE_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 | |||
| 328 | TRACE_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 | |||
| 353 | TRACE_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..ea6d579261ad --- /dev/null +++ b/include/trace/events/power.h | |||
| @@ -0,0 +1,81 @@ | |||
| 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_ | ||
| 12 | enum { | ||
| 13 | POWER_NONE = 0, | ||
| 14 | POWER_CSTATE = 1, | ||
| 15 | POWER_PSTATE = 2, | ||
| 16 | }; | ||
| 17 | #endif | ||
| 18 | |||
| 19 | |||
| 20 | |||
| 21 | TRACE_EVENT(power_start, | ||
| 22 | |||
| 23 | TP_PROTO(unsigned int type, unsigned int state), | ||
| 24 | |||
| 25 | TP_ARGS(type, state), | ||
| 26 | |||
| 27 | TP_STRUCT__entry( | ||
| 28 | __field( u64, type ) | ||
| 29 | __field( u64, state ) | ||
| 30 | ), | ||
| 31 | |||
| 32 | TP_fast_assign( | ||
| 33 | __entry->type = type; | ||
| 34 | __entry->state = state; | ||
| 35 | ), | ||
| 36 | |||
| 37 | TP_printk("type=%lu state=%lu", (unsigned long)__entry->type, (unsigned long)__entry->state) | ||
| 38 | ); | ||
| 39 | |||
| 40 | TRACE_EVENT(power_end, | ||
| 41 | |||
| 42 | TP_PROTO(int dummy), | ||
| 43 | |||
| 44 | TP_ARGS(dummy), | ||
| 45 | |||
| 46 | TP_STRUCT__entry( | ||
| 47 | __field( u64, dummy ) | ||
| 48 | ), | ||
| 49 | |||
| 50 | TP_fast_assign( | ||
| 51 | __entry->dummy = 0xffff; | ||
| 52 | ), | ||
| 53 | |||
| 54 | TP_printk("dummy=%lu", (unsigned long)__entry->dummy) | ||
| 55 | |||
| 56 | ); | ||
| 57 | |||
| 58 | |||
| 59 | TRACE_EVENT(power_frequency, | ||
| 60 | |||
| 61 | TP_PROTO(unsigned int type, unsigned int state), | ||
| 62 | |||
| 63 | TP_ARGS(type, state), | ||
| 64 | |||
| 65 | TP_STRUCT__entry( | ||
| 66 | __field( u64, type ) | ||
| 67 | __field( u64, state ) | ||
| 68 | ), | ||
| 69 | |||
| 70 | TP_fast_assign( | ||
| 71 | __entry->type = type; | ||
| 72 | __entry->state = state; | ||
| 73 | ), | ||
| 74 | |||
| 75 | TP_printk("type=%lu state=%lu", (unsigned long)__entry->type, (unsigned long) __entry->state) | ||
| 76 | ); | ||
| 77 | |||
| 78 | #endif /* _TRACE_POWER_H */ | ||
| 79 | |||
| 80 | /* This part must be outside protection */ | ||
| 81 | #include <trace/define_trace.h> | ||
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h index b48f1ad7c946..4069c43f4187 100644 --- a/include/trace/events/sched.h +++ b/include/trace/events/sched.h | |||
| @@ -380,6 +380,39 @@ TRACE_EVENT(sched_stat_wait, | |||
| 380 | ); | 380 | ); |
| 381 | 381 | ||
| 382 | /* | 382 | /* |
| 383 | * Tracepoint for accounting runtime (time the task is executing | ||
| 384 | * on a CPU). | ||
| 385 | */ | ||
| 386 | TRACE_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("task: %s:%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 | */ |
diff --git a/include/trace/events/timer.h b/include/trace/events/timer.h new file mode 100644 index 000000000000..1844c48d640e --- /dev/null +++ b/include/trace/events/timer.h | |||
| @@ -0,0 +1,342 @@ | |||
| 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 | */ | ||
| 15 | TRACE_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 | */ | ||
| 37 | TRACE_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: func %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 | */ | ||
| 68 | TRACE_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 | */ | ||
| 97 | TRACE_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 | */ | ||
| 118 | TRACE_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 | */ | ||
| 141 | TRACE_EVENT(hrtimer_init, | ||
| 142 | |||
| 143 | TP_PROTO(struct hrtimer *timer, clockid_t clockid, | ||
| 144 | enum hrtimer_mode mode), | ||
| 145 | |||
| 146 | TP_ARGS(timer, clockid, mode), | ||
| 147 | |||
| 148 | TP_STRUCT__entry( | ||
| 149 | __field( void *, timer ) | ||
| 150 | __field( clockid_t, clockid ) | ||
| 151 | __field( enum hrtimer_mode, mode ) | ||
| 152 | ), | ||
| 153 | |||
| 154 | TP_fast_assign( | ||
| 155 | __entry->timer = timer; | ||
| 156 | __entry->clockid = clockid; | ||
| 157 | __entry->mode = mode; | ||
| 158 | ), | ||
| 159 | |||
| 160 | TP_printk("hrtimer %p, clockid %s, mode %s", __entry->timer, | ||
| 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 | */ | ||
| 171 | TRACE_EVENT(hrtimer_start, | ||
| 172 | |||
| 173 | TP_PROTO(struct hrtimer *timer), | ||
| 174 | |||
| 175 | TP_ARGS(timer), | ||
| 176 | |||
| 177 | TP_STRUCT__entry( | ||
| 178 | __field( void *, timer ) | ||
| 179 | __field( void *, function ) | ||
| 180 | __field( s64, expires ) | ||
| 181 | __field( s64, softexpires ) | ||
| 182 | ), | ||
| 183 | |||
| 184 | TP_fast_assign( | ||
| 185 | __entry->timer = timer; | ||
| 186 | __entry->function = timer->function; | ||
| 187 | __entry->expires = hrtimer_get_expires(timer).tv64; | ||
| 188 | __entry->softexpires = hrtimer_get_softexpires(timer).tv64; | ||
| 189 | ), | ||
| 190 | |||
| 191 | TP_printk("hrtimer %p, func %pf, expires %llu, softexpires %llu", | ||
| 192 | __entry->timer, __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 | */ | ||
| 207 | TRACE_EVENT(hrtimer_expire_entry, | ||
| 208 | |||
| 209 | TP_PROTO(struct hrtimer *timer, ktime_t *now), | ||
| 210 | |||
| 211 | TP_ARGS(timer, now), | ||
| 212 | |||
| 213 | TP_STRUCT__entry( | ||
| 214 | __field( void *, timer ) | ||
| 215 | __field( s64, now ) | ||
| 216 | ), | ||
| 217 | |||
| 218 | TP_fast_assign( | ||
| 219 | __entry->timer = timer; | ||
| 220 | __entry->now = now->tv64; | ||
| 221 | ), | ||
| 222 | |||
| 223 | TP_printk("hrtimer %p, now %llu", __entry->timer, | ||
| 224 | (unsigned long long)ktime_to_ns((ktime_t) { | ||
| 225 | .tv64 = __entry->now })) | ||
| 226 | ); | ||
| 227 | |||
| 228 | /** | ||
| 229 | * hrtimer_expire_exit - called immediately after the hrtimer callback returns | ||
| 230 | * @timer: pointer to struct hrtimer | ||
| 231 | * | ||
| 232 | * When used in combination with the hrtimer_expire_entry tracepoint we can | ||
| 233 | * determine the runtime of the callback function. | ||
| 234 | */ | ||
| 235 | TRACE_EVENT(hrtimer_expire_exit, | ||
| 236 | |||
| 237 | TP_PROTO(struct hrtimer *timer), | ||
| 238 | |||
| 239 | TP_ARGS(timer), | ||
| 240 | |||
| 241 | TP_STRUCT__entry( | ||
| 242 | __field( void *, timer ) | ||
| 243 | ), | ||
| 244 | |||
| 245 | TP_fast_assign( | ||
| 246 | __entry->timer = timer; | ||
| 247 | ), | ||
| 248 | |||
| 249 | TP_printk("hrtimer %p", __entry->timer) | ||
| 250 | ); | ||
| 251 | |||
| 252 | /** | ||
| 253 | * hrtimer_cancel - called when the hrtimer is canceled | ||
| 254 | * @timer: pointer to struct hrtimer | ||
| 255 | */ | ||
| 256 | TRACE_EVENT(hrtimer_cancel, | ||
| 257 | |||
| 258 | TP_PROTO(struct hrtimer *timer), | ||
| 259 | |||
| 260 | TP_ARGS(timer), | ||
| 261 | |||
| 262 | TP_STRUCT__entry( | ||
| 263 | __field( void *, timer ) | ||
| 264 | ), | ||
| 265 | |||
| 266 | TP_fast_assign( | ||
| 267 | __entry->timer = timer; | ||
| 268 | ), | ||
| 269 | |||
| 270 | TP_printk("hrtimer %p", __entry->timer) | ||
| 271 | ); | ||
| 272 | |||
| 273 | /** | ||
| 274 | * itimer_state - called when itimer is started or canceled | ||
| 275 | * @which: name of the interval timer | ||
| 276 | * @value: the itimers value, itimer is canceled if value->it_value is | ||
| 277 | * zero, otherwise it is started | ||
| 278 | * @expires: the itimers expiry time | ||
| 279 | */ | ||
| 280 | TRACE_EVENT(itimer_state, | ||
| 281 | |||
| 282 | TP_PROTO(int which, const struct itimerval *const value, | ||
| 283 | cputime_t expires), | ||
| 284 | |||
| 285 | TP_ARGS(which, value, expires), | ||
| 286 | |||
| 287 | TP_STRUCT__entry( | ||
| 288 | __field( int, which ) | ||
| 289 | __field( cputime_t, expires ) | ||
| 290 | __field( long, value_sec ) | ||
| 291 | __field( long, value_usec ) | ||
| 292 | __field( long, interval_sec ) | ||
| 293 | __field( long, interval_usec ) | ||
| 294 | ), | ||
| 295 | |||
| 296 | TP_fast_assign( | ||
| 297 | __entry->which = which; | ||
| 298 | __entry->expires = expires; | ||
| 299 | __entry->value_sec = value->it_value.tv_sec; | ||
| 300 | __entry->value_usec = value->it_value.tv_usec; | ||
| 301 | __entry->interval_sec = value->it_interval.tv_sec; | ||
| 302 | __entry->interval_usec = value->it_interval.tv_usec; | ||
| 303 | ), | ||
| 304 | |||
| 305 | TP_printk("which %d, expires %lu, it_value %lu.%lu, it_interval %lu.%lu", | ||
| 306 | __entry->which, __entry->expires, | ||
| 307 | __entry->value_sec, __entry->value_usec, | ||
| 308 | __entry->interval_sec, __entry->interval_usec) | ||
| 309 | ); | ||
| 310 | |||
| 311 | /** | ||
| 312 | * itimer_expire - called when itimer expires | ||
| 313 | * @which: type of the interval timer | ||
| 314 | * @pid: pid of the process which owns the timer | ||
| 315 | * @now: current time, used to calculate the latency of itimer | ||
| 316 | */ | ||
| 317 | TRACE_EVENT(itimer_expire, | ||
| 318 | |||
| 319 | TP_PROTO(int which, struct pid *pid, cputime_t now), | ||
| 320 | |||
| 321 | TP_ARGS(which, pid, now), | ||
| 322 | |||
| 323 | TP_STRUCT__entry( | ||
| 324 | __field( int , which ) | ||
| 325 | __field( pid_t, pid ) | ||
| 326 | __field( cputime_t, now ) | ||
| 327 | ), | ||
| 328 | |||
| 329 | TP_fast_assign( | ||
| 330 | __entry->which = which; | ||
| 331 | __entry->now = now; | ||
| 332 | __entry->pid = pid_nr(pid); | ||
| 333 | ), | ||
| 334 | |||
| 335 | TP_printk("which %d, pid %d, now %lu", __entry->which, | ||
| 336 | (int) __entry->pid, __entry->now) | ||
| 337 | ); | ||
| 338 | |||
| 339 | #endif /* _TRACE_TIMER_H */ | ||
| 340 | |||
| 341 | /* This part must be outside protection */ | ||
| 342 | #include <trace/define_trace.h> | ||
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h index 72a3b437b829..cc0d9667e182 100644 --- a/include/trace/ftrace.h +++ b/include/trace/ftrace.h | |||
| @@ -378,24 +378,18 @@ static inline int ftrace_get_offsets_##call( \ | |||
| 378 | #ifdef CONFIG_EVENT_PROFILE | 378 | #ifdef CONFIG_EVENT_PROFILE |
| 379 | 379 | ||
| 380 | /* | 380 | /* |
| 381 | * Generate the functions needed for tracepoint perf_counter support. | 381 | * Generate the functions needed for tracepoint perf_event support. |
| 382 | * | 382 | * |
| 383 | * NOTE: The insertion profile callback (ftrace_profile_<call>) is defined later | 383 | * NOTE: The insertion profile callback (ftrace_profile_<call>) is defined later |
| 384 | * | 384 | * |
| 385 | * static int ftrace_profile_enable_<call>(struct ftrace_event_call *event_call) | 385 | * static int ftrace_profile_enable_<call>(void) |
| 386 | * { | 386 | * { |
| 387 | * int ret = 0; | 387 | * 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 | * } | 388 | * } |
| 394 | * | 389 | * |
| 395 | * static void ftrace_profile_disable_<call>(struct ftrace_event_call *event_call) | 390 | * static void ftrace_profile_disable_<call>(void) |
| 396 | * { | 391 | * { |
| 397 | * if (atomic_add_negative(-1, &event->call->profile_count)) | 392 | * unregister_trace_<call>(ftrace_profile_<call>); |
| 398 | * unregister_trace_<call>(ftrace_profile_<call>); | ||
| 399 | * } | 393 | * } |
| 400 | * | 394 | * |
| 401 | */ | 395 | */ |
| @@ -405,20 +399,14 @@ static inline int ftrace_get_offsets_##call( \ | |||
| 405 | \ | 399 | \ |
| 406 | static void ftrace_profile_##call(proto); \ | 400 | static void ftrace_profile_##call(proto); \ |
| 407 | \ | 401 | \ |
| 408 | static int ftrace_profile_enable_##call(struct ftrace_event_call *event_call) \ | 402 | static int ftrace_profile_enable_##call(void) \ |
| 409 | { \ | 403 | { \ |
| 410 | int ret = 0; \ | 404 | 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 | } \ | 405 | } \ |
| 417 | \ | 406 | \ |
| 418 | static void ftrace_profile_disable_##call(struct ftrace_event_call *event_call)\ | 407 | static void ftrace_profile_disable_##call(void) \ |
| 419 | { \ | 408 | { \ |
| 420 | if (atomic_add_negative(-1, &event_call->profile_count)) \ | 409 | unregister_trace_##call(ftrace_profile_##call); \ |
| 421 | unregister_trace_##call(ftrace_profile_##call); \ | ||
| 422 | } | 410 | } |
| 423 | 411 | ||
| 424 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) | 412 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
| @@ -656,15 +644,16 @@ __attribute__((section("_ftrace_events"))) event_##call = { \ | |||
| 656 | * { | 644 | * { |
| 657 | * struct ftrace_data_offsets_<call> __maybe_unused __data_offsets; | 645 | * struct ftrace_data_offsets_<call> __maybe_unused __data_offsets; |
| 658 | * struct ftrace_event_call *event_call = &event_<call>; | 646 | * struct ftrace_event_call *event_call = &event_<call>; |
| 659 | * extern void perf_tpcounter_event(int, u64, u64, void *, int); | 647 | * extern void perf_tp_event(int, u64, u64, void *, int); |
| 660 | * struct ftrace_raw_##call *entry; | 648 | * struct ftrace_raw_##call *entry; |
| 661 | * u64 __addr = 0, __count = 1; | 649 | * u64 __addr = 0, __count = 1; |
| 662 | * unsigned long irq_flags; | 650 | * unsigned long irq_flags; |
| 651 | * struct trace_entry *ent; | ||
| 663 | * int __entry_size; | 652 | * int __entry_size; |
| 664 | * int __data_size; | 653 | * int __data_size; |
| 654 | * int __cpu | ||
| 665 | * int pc; | 655 | * int pc; |
| 666 | * | 656 | * |
| 667 | * local_save_flags(irq_flags); | ||
| 668 | * pc = preempt_count(); | 657 | * pc = preempt_count(); |
| 669 | * | 658 | * |
| 670 | * __data_size = ftrace_get_offsets_<call>(&__data_offsets, args); | 659 | * __data_size = ftrace_get_offsets_<call>(&__data_offsets, args); |
| @@ -675,25 +664,34 @@ __attribute__((section("_ftrace_events"))) event_##call = { \ | |||
| 675 | * sizeof(u64)); | 664 | * sizeof(u64)); |
| 676 | * __entry_size -= sizeof(u32); | 665 | * __entry_size -= sizeof(u32); |
| 677 | * | 666 | * |
| 678 | * do { | 667 | * // Protect the non nmi buffer |
| 679 | * char raw_data[__entry_size]; <- allocate our sample in the stack | 668 | * // This also protects the rcu read side |
| 680 | * struct trace_entry *ent; | 669 | * local_irq_save(irq_flags); |
| 670 | * __cpu = smp_processor_id(); | ||
| 671 | * | ||
| 672 | * if (in_nmi()) | ||
| 673 | * raw_data = rcu_dereference(trace_profile_buf_nmi); | ||
| 674 | * else | ||
| 675 | * raw_data = rcu_dereference(trace_profile_buf); | ||
| 676 | * | ||
| 677 | * if (!raw_data) | ||
| 678 | * goto end; | ||
| 681 | * | 679 | * |
| 682 | * zero dead bytes from alignment to avoid stack leak to userspace: | 680 | * raw_data = per_cpu_ptr(raw_data, __cpu); |
| 683 | * | 681 | * |
| 684 | * *(u64 *)(&raw_data[__entry_size - sizeof(u64)]) = 0ULL; | 682 | * //zero dead bytes from alignment to avoid stack leak to userspace: |
| 685 | * entry = (struct ftrace_raw_<call> *)raw_data; | 683 | * *(u64 *)(&raw_data[__entry_size - sizeof(u64)]) = 0ULL; |
| 686 | * ent = &entry->ent; | 684 | * entry = (struct ftrace_raw_<call> *)raw_data; |
| 687 | * tracing_generic_entry_update(ent, irq_flags, pc); | 685 | * ent = &entry->ent; |
| 688 | * ent->type = event_call->id; | 686 | * tracing_generic_entry_update(ent, irq_flags, pc); |
| 687 | * ent->type = event_call->id; | ||
| 689 | * | 688 | * |
| 690 | * <tstruct> <- do some jobs with dynamic arrays | 689 | * <tstruct> <- do some jobs with dynamic arrays |
| 691 | * | 690 | * |
| 692 | * <assign> <- affect our values | 691 | * <assign> <- affect our values |
| 693 | * | 692 | * |
| 694 | * perf_tpcounter_event(event_call->id, __addr, __count, entry, | 693 | * perf_tp_event(event_call->id, __addr, __count, entry, |
| 695 | * __entry_size); <- submit them to perf counter | 694 | * __entry_size); <- submit them to perf counter |
| 696 | * } while (0); | ||
| 697 | * | 695 | * |
| 698 | * } | 696 | * } |
| 699 | */ | 697 | */ |
| @@ -712,15 +710,17 @@ static void ftrace_profile_##call(proto) \ | |||
| 712 | { \ | 710 | { \ |
| 713 | struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\ | 711 | struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\ |
| 714 | struct ftrace_event_call *event_call = &event_##call; \ | 712 | struct ftrace_event_call *event_call = &event_##call; \ |
| 715 | extern void perf_tpcounter_event(int, u64, u64, void *, int); \ | 713 | extern void perf_tp_event(int, u64, u64, void *, int); \ |
| 716 | struct ftrace_raw_##call *entry; \ | 714 | struct ftrace_raw_##call *entry; \ |
| 717 | u64 __addr = 0, __count = 1; \ | 715 | u64 __addr = 0, __count = 1; \ |
| 718 | unsigned long irq_flags; \ | 716 | unsigned long irq_flags; \ |
| 717 | struct trace_entry *ent; \ | ||
| 719 | int __entry_size; \ | 718 | int __entry_size; \ |
| 720 | int __data_size; \ | 719 | int __data_size; \ |
| 720 | char *raw_data; \ | ||
| 721 | int __cpu; \ | ||
| 721 | int pc; \ | 722 | int pc; \ |
| 722 | \ | 723 | \ |
| 723 | local_save_flags(irq_flags); \ | ||
| 724 | pc = preempt_count(); \ | 724 | pc = preempt_count(); \ |
| 725 | \ | 725 | \ |
| 726 | __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \ | 726 | __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \ |
| @@ -728,23 +728,38 @@ static void ftrace_profile_##call(proto) \ | |||
| 728 | sizeof(u64)); \ | 728 | sizeof(u64)); \ |
| 729 | __entry_size -= sizeof(u32); \ | 729 | __entry_size -= sizeof(u32); \ |
| 730 | \ | 730 | \ |
| 731 | do { \ | 731 | if (WARN_ONCE(__entry_size > FTRACE_MAX_PROFILE_SIZE, \ |
| 732 | char raw_data[__entry_size]; \ | 732 | "profile buffer not large enough")) \ |
| 733 | struct trace_entry *ent; \ | 733 | return; \ |
| 734 | \ | ||
| 735 | local_irq_save(irq_flags); \ | ||
| 736 | __cpu = smp_processor_id(); \ | ||
| 734 | \ | 737 | \ |
| 735 | *(u64 *)(&raw_data[__entry_size - sizeof(u64)]) = 0ULL; \ | 738 | if (in_nmi()) \ |
| 736 | entry = (struct ftrace_raw_##call *)raw_data; \ | 739 | raw_data = rcu_dereference(trace_profile_buf_nmi); \ |
| 737 | ent = &entry->ent; \ | 740 | else \ |
| 738 | tracing_generic_entry_update(ent, irq_flags, pc); \ | 741 | raw_data = rcu_dereference(trace_profile_buf); \ |
| 739 | ent->type = event_call->id; \ | ||
| 740 | \ | 742 | \ |
| 741 | tstruct \ | 743 | if (!raw_data) \ |
| 744 | goto end; \ | ||
| 742 | \ | 745 | \ |
| 743 | { assign; } \ | 746 | raw_data = per_cpu_ptr(raw_data, __cpu); \ |
| 744 | \ | 747 | \ |
| 745 | perf_tpcounter_event(event_call->id, __addr, __count, entry,\ | 748 | *(u64 *)(&raw_data[__entry_size - sizeof(u64)]) = 0ULL; \ |
| 749 | entry = (struct ftrace_raw_##call *)raw_data; \ | ||
| 750 | ent = &entry->ent; \ | ||
| 751 | tracing_generic_entry_update(ent, irq_flags, pc); \ | ||
| 752 | ent->type = event_call->id; \ | ||
| 753 | \ | ||
| 754 | tstruct \ | ||
| 755 | \ | ||
| 756 | { assign; } \ | ||
| 757 | \ | ||
| 758 | perf_tp_event(event_call->id, __addr, __count, entry, \ | ||
| 746 | __entry_size); \ | 759 | __entry_size); \ |
| 747 | } while (0); \ | 760 | \ |
| 761 | end: \ | ||
| 762 | local_irq_restore(irq_flags); \ | ||
| 748 | \ | 763 | \ |
| 749 | } | 764 | } |
| 750 | 765 | ||
