aboutsummaryrefslogtreecommitdiffstats
path: root/include/trace
diff options
context:
space:
mode:
Diffstat (limited to 'include/trace')
-rw-r--r--include/trace/events/asoc.h92
-rw-r--r--include/trace/events/compaction.h25
-rw-r--r--include/trace/events/ext4.h9
-rw-r--r--include/trace/events/f2fs.h146
-rw-r--r--include/trace/events/gfpflags.h1
-rw-r--r--include/trace/events/vmscan.h19
-rw-r--r--include/trace/ftrace.h66
7 files changed, 247 insertions, 111 deletions
diff --git a/include/trace/events/asoc.h b/include/trace/events/asoc.h
index 03996b2bb04f..c75c795a377b 100644
--- a/include/trace/events/asoc.h
+++ b/include/trace/events/asoc.h
@@ -11,102 +11,10 @@
11 11
12struct snd_soc_jack; 12struct snd_soc_jack;
13struct snd_soc_codec; 13struct snd_soc_codec;
14struct snd_soc_platform;
15struct snd_soc_card; 14struct snd_soc_card;
16struct snd_soc_dapm_widget; 15struct snd_soc_dapm_widget;
17struct snd_soc_dapm_path; 16struct snd_soc_dapm_path;
18 17
19/*
20 * Log register events
21 */
22DECLARE_EVENT_CLASS(snd_soc_reg,
23
24 TP_PROTO(struct snd_soc_codec *codec, unsigned int reg,
25 unsigned int val),
26
27 TP_ARGS(codec, reg, val),
28
29 TP_STRUCT__entry(
30 __string( name, codec->name )
31 __field( int, id )
32 __field( unsigned int, reg )
33 __field( unsigned int, val )
34 ),
35
36 TP_fast_assign(
37 __assign_str(name, codec->name);
38 __entry->id = codec->id;
39 __entry->reg = reg;
40 __entry->val = val;
41 ),
42
43 TP_printk("codec=%s.%d reg=%x val=%x", __get_str(name),
44 (int)__entry->id, (unsigned int)__entry->reg,
45 (unsigned int)__entry->val)
46);
47
48DEFINE_EVENT(snd_soc_reg, snd_soc_reg_write,
49
50 TP_PROTO(struct snd_soc_codec *codec, unsigned int reg,
51 unsigned int val),
52
53 TP_ARGS(codec, reg, val)
54
55);
56
57DEFINE_EVENT(snd_soc_reg, snd_soc_reg_read,
58
59 TP_PROTO(struct snd_soc_codec *codec, unsigned int reg,
60 unsigned int val),
61
62 TP_ARGS(codec, reg, val)
63
64);
65
66DECLARE_EVENT_CLASS(snd_soc_preg,
67
68 TP_PROTO(struct snd_soc_platform *platform, unsigned int reg,
69 unsigned int val),
70
71 TP_ARGS(platform, reg, val),
72
73 TP_STRUCT__entry(
74 __string( name, platform->name )
75 __field( int, id )
76 __field( unsigned int, reg )
77 __field( unsigned int, val )
78 ),
79
80 TP_fast_assign(
81 __assign_str(name, platform->name);
82 __entry->id = platform->id;
83 __entry->reg = reg;
84 __entry->val = val;
85 ),
86
87 TP_printk("platform=%s.%d reg=%x val=%x", __get_str(name),
88 (int)__entry->id, (unsigned int)__entry->reg,
89 (unsigned int)__entry->val)
90);
91
92DEFINE_EVENT(snd_soc_preg, snd_soc_preg_write,
93
94 TP_PROTO(struct snd_soc_platform *platform, unsigned int reg,
95 unsigned int val),
96
97 TP_ARGS(platform, reg, val)
98
99);
100
101DEFINE_EVENT(snd_soc_preg, snd_soc_preg_read,
102
103 TP_PROTO(struct snd_soc_platform *platform, unsigned int reg,
104 unsigned int val),
105
106 TP_ARGS(platform, reg, val)
107
108);
109
110DECLARE_EVENT_CLASS(snd_soc_card, 18DECLARE_EVENT_CLASS(snd_soc_card,
111 19
112 TP_PROTO(struct snd_soc_card *card, int val), 20 TP_PROTO(struct snd_soc_card *card, int val),
diff --git a/include/trace/events/compaction.h b/include/trace/events/compaction.h
index 06f544ef2f6f..c6814b917bdf 100644
--- a/include/trace/events/compaction.h
+++ b/include/trace/events/compaction.h
@@ -5,6 +5,7 @@
5#define _TRACE_COMPACTION_H 5#define _TRACE_COMPACTION_H
6 6
7#include <linux/types.h> 7#include <linux/types.h>
8#include <linux/list.h>
8#include <linux/tracepoint.h> 9#include <linux/tracepoint.h>
9#include <trace/events/gfpflags.h> 10#include <trace/events/gfpflags.h>
10 11
@@ -47,10 +48,11 @@ DEFINE_EVENT(mm_compaction_isolate_template, mm_compaction_isolate_freepages,
47 48
48TRACE_EVENT(mm_compaction_migratepages, 49TRACE_EVENT(mm_compaction_migratepages,
49 50
50 TP_PROTO(unsigned long nr_migrated, 51 TP_PROTO(unsigned long nr_all,
51 unsigned long nr_failed), 52 int migrate_rc,
53 struct list_head *migratepages),
52 54
53 TP_ARGS(nr_migrated, nr_failed), 55 TP_ARGS(nr_all, migrate_rc, migratepages),
54 56
55 TP_STRUCT__entry( 57 TP_STRUCT__entry(
56 __field(unsigned long, nr_migrated) 58 __field(unsigned long, nr_migrated)
@@ -58,7 +60,22 @@ TRACE_EVENT(mm_compaction_migratepages,
58 ), 60 ),
59 61
60 TP_fast_assign( 62 TP_fast_assign(
61 __entry->nr_migrated = nr_migrated; 63 unsigned long nr_failed = 0;
64 struct list_head *page_lru;
65
66 /*
67 * migrate_pages() returns either a non-negative number
68 * with the number of pages that failed migration, or an
69 * error code, in which case we need to count the remaining
70 * pages manually
71 */
72 if (migrate_rc >= 0)
73 nr_failed = migrate_rc;
74 else
75 list_for_each(page_lru, migratepages)
76 nr_failed++;
77
78 __entry->nr_migrated = nr_all - nr_failed;
62 __entry->nr_failed = nr_failed; 79 __entry->nr_failed = nr_failed;
63 ), 80 ),
64 81
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index 6a1a0245474f..d4f70a7fe876 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -36,7 +36,7 @@ struct extent_status;
36 36
37#define show_map_flags(flags) __print_flags(flags, "|", \ 37#define show_map_flags(flags) __print_flags(flags, "|", \
38 { EXT4_GET_BLOCKS_CREATE, "CREATE" }, \ 38 { EXT4_GET_BLOCKS_CREATE, "CREATE" }, \
39 { EXT4_GET_BLOCKS_UNINIT_EXT, "UNINIT" }, \ 39 { EXT4_GET_BLOCKS_UNWRIT_EXT, "UNWRIT" }, \
40 { EXT4_GET_BLOCKS_DELALLOC_RESERVE, "DELALLOC" }, \ 40 { EXT4_GET_BLOCKS_DELALLOC_RESERVE, "DELALLOC" }, \
41 { EXT4_GET_BLOCKS_PRE_IO, "PRE_IO" }, \ 41 { EXT4_GET_BLOCKS_PRE_IO, "PRE_IO" }, \
42 { EXT4_GET_BLOCKS_CONVERT, "CONVERT" }, \ 42 { EXT4_GET_BLOCKS_CONVERT, "CONVERT" }, \
@@ -51,7 +51,6 @@ struct extent_status;
51 { EXT4_MAP_MAPPED, "M" }, \ 51 { EXT4_MAP_MAPPED, "M" }, \
52 { EXT4_MAP_UNWRITTEN, "U" }, \ 52 { EXT4_MAP_UNWRITTEN, "U" }, \
53 { EXT4_MAP_BOUNDARY, "B" }, \ 53 { EXT4_MAP_BOUNDARY, "B" }, \
54 { EXT4_MAP_UNINIT, "u" }, \
55 { EXT4_MAP_FROM_CLUSTER, "C" }) 54 { EXT4_MAP_FROM_CLUSTER, "C" })
56 55
57#define show_free_flags(flags) __print_flags(flags, "|", \ 56#define show_free_flags(flags) __print_flags(flags, "|", \
@@ -1497,7 +1496,7 @@ DEFINE_EVENT(ext4__truncate, ext4_truncate_exit,
1497 TP_ARGS(inode) 1496 TP_ARGS(inode)
1498); 1497);
1499 1498
1500/* 'ux' is the uninitialized extent. */ 1499/* 'ux' is the unwritten extent. */
1501TRACE_EVENT(ext4_ext_convert_to_initialized_enter, 1500TRACE_EVENT(ext4_ext_convert_to_initialized_enter,
1502 TP_PROTO(struct inode *inode, struct ext4_map_blocks *map, 1501 TP_PROTO(struct inode *inode, struct ext4_map_blocks *map,
1503 struct ext4_extent *ux), 1502 struct ext4_extent *ux),
@@ -1533,7 +1532,7 @@ TRACE_EVENT(ext4_ext_convert_to_initialized_enter,
1533); 1532);
1534 1533
1535/* 1534/*
1536 * 'ux' is the uninitialized extent. 1535 * 'ux' is the unwritten extent.
1537 * 'ix' is the initialized extent to which blocks are transferred. 1536 * 'ix' is the initialized extent to which blocks are transferred.
1538 */ 1537 */
1539TRACE_EVENT(ext4_ext_convert_to_initialized_fastpath, 1538TRACE_EVENT(ext4_ext_convert_to_initialized_fastpath,
@@ -1811,7 +1810,7 @@ DEFINE_EVENT(ext4__trim, ext4_trim_all_free,
1811 TP_ARGS(sb, group, start, len) 1810 TP_ARGS(sb, group, start, len)
1812); 1811);
1813 1812
1814TRACE_EVENT(ext4_ext_handle_uninitialized_extents, 1813TRACE_EVENT(ext4_ext_handle_unwritten_extents,
1815 TP_PROTO(struct inode *inode, struct ext4_map_blocks *map, int flags, 1814 TP_PROTO(struct inode *inode, struct ext4_map_blocks *map, int flags,
1816 unsigned int allocated, ext4_fsblk_t newblock), 1815 unsigned int allocated, ext4_fsblk_t newblock),
1817 1816
diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h
index 67f38faac589..b983990b4a9f 100644
--- a/include/trace/events/f2fs.h
+++ b/include/trace/events/f2fs.h
@@ -659,6 +659,66 @@ DEFINE_EVENT_CONDITION(f2fs__submit_bio, f2fs_submit_read_bio,
659 TP_CONDITION(bio) 659 TP_CONDITION(bio)
660); 660);
661 661
662TRACE_EVENT(f2fs_write_begin,
663
664 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
665 unsigned int flags),
666
667 TP_ARGS(inode, pos, len, flags),
668
669 TP_STRUCT__entry(
670 __field(dev_t, dev)
671 __field(ino_t, ino)
672 __field(loff_t, pos)
673 __field(unsigned int, len)
674 __field(unsigned int, flags)
675 ),
676
677 TP_fast_assign(
678 __entry->dev = inode->i_sb->s_dev;
679 __entry->ino = inode->i_ino;
680 __entry->pos = pos;
681 __entry->len = len;
682 __entry->flags = flags;
683 ),
684
685 TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, flags = %u",
686 show_dev_ino(__entry),
687 (unsigned long long)__entry->pos,
688 __entry->len,
689 __entry->flags)
690);
691
692TRACE_EVENT(f2fs_write_end,
693
694 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
695 unsigned int copied),
696
697 TP_ARGS(inode, pos, len, copied),
698
699 TP_STRUCT__entry(
700 __field(dev_t, dev)
701 __field(ino_t, ino)
702 __field(loff_t, pos)
703 __field(unsigned int, len)
704 __field(unsigned int, copied)
705 ),
706
707 TP_fast_assign(
708 __entry->dev = inode->i_sb->s_dev;
709 __entry->ino = inode->i_ino;
710 __entry->pos = pos;
711 __entry->len = len;
712 __entry->copied = copied;
713 ),
714
715 TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, copied = %u",
716 show_dev_ino(__entry),
717 (unsigned long long)__entry->pos,
718 __entry->len,
719 __entry->copied)
720);
721
662DECLARE_EVENT_CLASS(f2fs__page, 722DECLARE_EVENT_CLASS(f2fs__page,
663 723
664 TP_PROTO(struct page *page, int type), 724 TP_PROTO(struct page *page, int type),
@@ -672,6 +732,7 @@ DECLARE_EVENT_CLASS(f2fs__page,
672 __field(int, dir) 732 __field(int, dir)
673 __field(pgoff_t, index) 733 __field(pgoff_t, index)
674 __field(int, dirty) 734 __field(int, dirty)
735 __field(int, uptodate)
675 ), 736 ),
676 737
677 TP_fast_assign( 738 TP_fast_assign(
@@ -681,14 +742,31 @@ DECLARE_EVENT_CLASS(f2fs__page,
681 __entry->dir = S_ISDIR(page->mapping->host->i_mode); 742 __entry->dir = S_ISDIR(page->mapping->host->i_mode);
682 __entry->index = page->index; 743 __entry->index = page->index;
683 __entry->dirty = PageDirty(page); 744 __entry->dirty = PageDirty(page);
745 __entry->uptodate = PageUptodate(page);
684 ), 746 ),
685 747
686 TP_printk("dev = (%d,%d), ino = %lu, %s, %s, index = %lu, dirty = %d", 748 TP_printk("dev = (%d,%d), ino = %lu, %s, %s, index = %lu, "
749 "dirty = %d, uptodate = %d",
687 show_dev_ino(__entry), 750 show_dev_ino(__entry),
688 show_block_type(__entry->type), 751 show_block_type(__entry->type),
689 show_file_type(__entry->dir), 752 show_file_type(__entry->dir),
690 (unsigned long)__entry->index, 753 (unsigned long)__entry->index,
691 __entry->dirty) 754 __entry->dirty,
755 __entry->uptodate)
756);
757
758DEFINE_EVENT(f2fs__page, f2fs_writepage,
759
760 TP_PROTO(struct page *page, int type),
761
762 TP_ARGS(page, type)
763);
764
765DEFINE_EVENT(f2fs__page, f2fs_readpage,
766
767 TP_PROTO(struct page *page, int type),
768
769 TP_ARGS(page, type)
692); 770);
693 771
694DEFINE_EVENT(f2fs__page, f2fs_set_page_dirty, 772DEFINE_EVENT(f2fs__page, f2fs_set_page_dirty,
@@ -705,6 +783,70 @@ DEFINE_EVENT(f2fs__page, f2fs_vm_page_mkwrite,
705 TP_ARGS(page, type) 783 TP_ARGS(page, type)
706); 784);
707 785
786TRACE_EVENT(f2fs_writepages,
787
788 TP_PROTO(struct inode *inode, struct writeback_control *wbc, int type),
789
790 TP_ARGS(inode, wbc, type),
791
792 TP_STRUCT__entry(
793 __field(dev_t, dev)
794 __field(ino_t, ino)
795 __field(int, type)
796 __field(int, dir)
797 __field(long, nr_to_write)
798 __field(long, pages_skipped)
799 __field(loff_t, range_start)
800 __field(loff_t, range_end)
801 __field(pgoff_t, writeback_index)
802 __field(int, sync_mode)
803 __field(char, for_kupdate)
804 __field(char, for_background)
805 __field(char, tagged_writepages)
806 __field(char, for_reclaim)
807 __field(char, range_cyclic)
808 __field(char, for_sync)
809 ),
810
811 TP_fast_assign(
812 __entry->dev = inode->i_sb->s_dev;
813 __entry->ino = inode->i_ino;
814 __entry->type = type;
815 __entry->dir = S_ISDIR(inode->i_mode);
816 __entry->nr_to_write = wbc->nr_to_write;
817 __entry->pages_skipped = wbc->pages_skipped;
818 __entry->range_start = wbc->range_start;
819 __entry->range_end = wbc->range_end;
820 __entry->writeback_index = inode->i_mapping->writeback_index;
821 __entry->sync_mode = wbc->sync_mode;
822 __entry->for_kupdate = wbc->for_kupdate;
823 __entry->for_background = wbc->for_background;
824 __entry->tagged_writepages = wbc->tagged_writepages;
825 __entry->for_reclaim = wbc->for_reclaim;
826 __entry->range_cyclic = wbc->range_cyclic;
827 __entry->for_sync = wbc->for_sync;
828 ),
829
830 TP_printk("dev = (%d,%d), ino = %lu, %s, %s, nr_to_write %ld, "
831 "skipped %ld, start %lld, end %lld, wb_idx %lu, sync_mode %d, "
832 "kupdate %u background %u tagged %u reclaim %u cyclic %u sync %u",
833 show_dev_ino(__entry),
834 show_block_type(__entry->type),
835 show_file_type(__entry->dir),
836 __entry->nr_to_write,
837 __entry->pages_skipped,
838 __entry->range_start,
839 __entry->range_end,
840 (unsigned long)__entry->writeback_index,
841 __entry->sync_mode,
842 __entry->for_kupdate,
843 __entry->for_background,
844 __entry->tagged_writepages,
845 __entry->for_reclaim,
846 __entry->range_cyclic,
847 __entry->for_sync)
848);
849
708TRACE_EVENT(f2fs_submit_page_mbio, 850TRACE_EVENT(f2fs_submit_page_mbio,
709 851
710 TP_PROTO(struct page *page, int rw, int type, block_t blk_addr), 852 TP_PROTO(struct page *page, int rw, int type, block_t blk_addr),
diff --git a/include/trace/events/gfpflags.h b/include/trace/events/gfpflags.h
index 1eddbf1557f2..d6fd8e5b14b7 100644
--- a/include/trace/events/gfpflags.h
+++ b/include/trace/events/gfpflags.h
@@ -34,7 +34,6 @@
34 {(unsigned long)__GFP_HARDWALL, "GFP_HARDWALL"}, \ 34 {(unsigned long)__GFP_HARDWALL, "GFP_HARDWALL"}, \
35 {(unsigned long)__GFP_THISNODE, "GFP_THISNODE"}, \ 35 {(unsigned long)__GFP_THISNODE, "GFP_THISNODE"}, \
36 {(unsigned long)__GFP_RECLAIMABLE, "GFP_RECLAIMABLE"}, \ 36 {(unsigned long)__GFP_RECLAIMABLE, "GFP_RECLAIMABLE"}, \
37 {(unsigned long)__GFP_KMEMCG, "GFP_KMEMCG"}, \
38 {(unsigned long)__GFP_MOVABLE, "GFP_MOVABLE"}, \ 37 {(unsigned long)__GFP_MOVABLE, "GFP_MOVABLE"}, \
39 {(unsigned long)__GFP_NOTRACK, "GFP_NOTRACK"}, \ 38 {(unsigned long)__GFP_NOTRACK, "GFP_NOTRACK"}, \
40 {(unsigned long)__GFP_NO_KSWAPD, "GFP_NO_KSWAPD"}, \ 39 {(unsigned long)__GFP_NO_KSWAPD, "GFP_NO_KSWAPD"}, \
diff --git a/include/trace/events/vmscan.h b/include/trace/events/vmscan.h
index 132a985aba8b..69590b6ffc09 100644
--- a/include/trace/events/vmscan.h
+++ b/include/trace/events/vmscan.h
@@ -191,6 +191,7 @@ TRACE_EVENT(mm_shrink_slab_start,
191 TP_STRUCT__entry( 191 TP_STRUCT__entry(
192 __field(struct shrinker *, shr) 192 __field(struct shrinker *, shr)
193 __field(void *, shrink) 193 __field(void *, shrink)
194 __field(int, nid)
194 __field(long, nr_objects_to_shrink) 195 __field(long, nr_objects_to_shrink)
195 __field(gfp_t, gfp_flags) 196 __field(gfp_t, gfp_flags)
196 __field(unsigned long, pgs_scanned) 197 __field(unsigned long, pgs_scanned)
@@ -203,6 +204,7 @@ TRACE_EVENT(mm_shrink_slab_start,
203 TP_fast_assign( 204 TP_fast_assign(
204 __entry->shr = shr; 205 __entry->shr = shr;
205 __entry->shrink = shr->scan_objects; 206 __entry->shrink = shr->scan_objects;
207 __entry->nid = sc->nid;
206 __entry->nr_objects_to_shrink = nr_objects_to_shrink; 208 __entry->nr_objects_to_shrink = nr_objects_to_shrink;
207 __entry->gfp_flags = sc->gfp_mask; 209 __entry->gfp_flags = sc->gfp_mask;
208 __entry->pgs_scanned = pgs_scanned; 210 __entry->pgs_scanned = pgs_scanned;
@@ -212,9 +214,10 @@ TRACE_EVENT(mm_shrink_slab_start,
212 __entry->total_scan = total_scan; 214 __entry->total_scan = total_scan;
213 ), 215 ),
214 216
215 TP_printk("%pF %p: objects to shrink %ld gfp_flags %s pgs_scanned %ld lru_pgs %ld cache items %ld delta %lld total_scan %ld", 217 TP_printk("%pF %p: nid: %d objects to shrink %ld gfp_flags %s pgs_scanned %ld lru_pgs %ld cache items %ld delta %lld total_scan %ld",
216 __entry->shrink, 218 __entry->shrink,
217 __entry->shr, 219 __entry->shr,
220 __entry->nid,
218 __entry->nr_objects_to_shrink, 221 __entry->nr_objects_to_shrink,
219 show_gfp_flags(__entry->gfp_flags), 222 show_gfp_flags(__entry->gfp_flags),
220 __entry->pgs_scanned, 223 __entry->pgs_scanned,
@@ -225,13 +228,15 @@ TRACE_EVENT(mm_shrink_slab_start,
225); 228);
226 229
227TRACE_EVENT(mm_shrink_slab_end, 230TRACE_EVENT(mm_shrink_slab_end,
228 TP_PROTO(struct shrinker *shr, int shrinker_retval, 231 TP_PROTO(struct shrinker *shr, int nid, int shrinker_retval,
229 long unused_scan_cnt, long new_scan_cnt), 232 long unused_scan_cnt, long new_scan_cnt, long total_scan),
230 233
231 TP_ARGS(shr, shrinker_retval, unused_scan_cnt, new_scan_cnt), 234 TP_ARGS(shr, nid, shrinker_retval, unused_scan_cnt, new_scan_cnt,
235 total_scan),
232 236
233 TP_STRUCT__entry( 237 TP_STRUCT__entry(
234 __field(struct shrinker *, shr) 238 __field(struct shrinker *, shr)
239 __field(int, nid)
235 __field(void *, shrink) 240 __field(void *, shrink)
236 __field(long, unused_scan) 241 __field(long, unused_scan)
237 __field(long, new_scan) 242 __field(long, new_scan)
@@ -241,16 +246,18 @@ TRACE_EVENT(mm_shrink_slab_end,
241 246
242 TP_fast_assign( 247 TP_fast_assign(
243 __entry->shr = shr; 248 __entry->shr = shr;
249 __entry->nid = nid;
244 __entry->shrink = shr->scan_objects; 250 __entry->shrink = shr->scan_objects;
245 __entry->unused_scan = unused_scan_cnt; 251 __entry->unused_scan = unused_scan_cnt;
246 __entry->new_scan = new_scan_cnt; 252 __entry->new_scan = new_scan_cnt;
247 __entry->retval = shrinker_retval; 253 __entry->retval = shrinker_retval;
248 __entry->total_scan = new_scan_cnt - unused_scan_cnt; 254 __entry->total_scan = total_scan;
249 ), 255 ),
250 256
251 TP_printk("%pF %p: unused scan count %ld new scan count %ld total_scan %ld last shrinker return val %d", 257 TP_printk("%pF %p: nid: %d unused scan count %ld new scan count %ld total_scan %ld last shrinker return val %d",
252 __entry->shrink, 258 __entry->shrink,
253 __entry->shr, 259 __entry->shr,
260 __entry->nid,
254 __entry->unused_scan, 261 __entry->unused_scan,
255 __entry->new_scan, 262 __entry->new_scan,
256 __entry->total_scan, 263 __entry->total_scan,
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index 0a1a4f7caf09..0fd06fef9fac 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -53,6 +53,9 @@
53#undef __string 53#undef __string
54#define __string(item, src) __dynamic_array(char, item, -1) 54#define __string(item, src) __dynamic_array(char, item, -1)
55 55
56#undef __bitmask
57#define __bitmask(item, nr_bits) __dynamic_array(char, item, -1)
58
56#undef TP_STRUCT__entry 59#undef TP_STRUCT__entry
57#define TP_STRUCT__entry(args...) args 60#define TP_STRUCT__entry(args...) args
58 61
@@ -128,6 +131,9 @@
128#undef __string 131#undef __string
129#define __string(item, src) __dynamic_array(char, item, -1) 132#define __string(item, src) __dynamic_array(char, item, -1)
130 133
134#undef __bitmask
135#define __bitmask(item, nr_bits) __dynamic_array(unsigned long, item, -1)
136
131#undef DECLARE_EVENT_CLASS 137#undef DECLARE_EVENT_CLASS
132#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ 138#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
133 struct ftrace_data_offsets_##call { \ 139 struct ftrace_data_offsets_##call { \
@@ -197,9 +203,22 @@
197#define __get_dynamic_array(field) \ 203#define __get_dynamic_array(field) \
198 ((void *)__entry + (__entry->__data_loc_##field & 0xffff)) 204 ((void *)__entry + (__entry->__data_loc_##field & 0xffff))
199 205
206#undef __get_dynamic_array_len
207#define __get_dynamic_array_len(field) \
208 ((__entry->__data_loc_##field >> 16) & 0xffff)
209
200#undef __get_str 210#undef __get_str
201#define __get_str(field) (char *)__get_dynamic_array(field) 211#define __get_str(field) (char *)__get_dynamic_array(field)
202 212
213#undef __get_bitmask
214#define __get_bitmask(field) \
215 ({ \
216 void *__bitmask = __get_dynamic_array(field); \
217 unsigned int __bitmask_size; \
218 __bitmask_size = __get_dynamic_array_len(field); \
219 ftrace_print_bitmask_seq(p, __bitmask, __bitmask_size); \
220 })
221
203#undef __print_flags 222#undef __print_flags
204#define __print_flags(flag, delim, flag_array...) \ 223#define __print_flags(flag, delim, flag_array...) \
205 ({ \ 224 ({ \
@@ -322,6 +341,9 @@ static struct trace_event_functions ftrace_event_type_funcs_##call = { \
322#undef __string 341#undef __string
323#define __string(item, src) __dynamic_array(char, item, -1) 342#define __string(item, src) __dynamic_array(char, item, -1)
324 343
344#undef __bitmask
345#define __bitmask(item, nr_bits) __dynamic_array(unsigned long, item, -1)
346
325#undef DECLARE_EVENT_CLASS 347#undef DECLARE_EVENT_CLASS
326#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, func, print) \ 348#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, func, print) \
327static int notrace __init \ 349static int notrace __init \
@@ -372,6 +394,29 @@ ftrace_define_fields_##call(struct ftrace_event_call *event_call) \
372#define __string(item, src) __dynamic_array(char, item, \ 394#define __string(item, src) __dynamic_array(char, item, \
373 strlen((src) ? (const char *)(src) : "(null)") + 1) 395 strlen((src) ? (const char *)(src) : "(null)") + 1)
374 396
397/*
398 * __bitmask_size_in_bytes_raw is the number of bytes needed to hold
399 * num_possible_cpus().
400 */
401#define __bitmask_size_in_bytes_raw(nr_bits) \
402 (((nr_bits) + 7) / 8)
403
404#define __bitmask_size_in_longs(nr_bits) \
405 ((__bitmask_size_in_bytes_raw(nr_bits) + \
406 ((BITS_PER_LONG / 8) - 1)) / (BITS_PER_LONG / 8))
407
408/*
409 * __bitmask_size_in_bytes is the number of bytes needed to hold
410 * num_possible_cpus() padded out to the nearest long. This is what
411 * is saved in the buffer, just to be consistent.
412 */
413#define __bitmask_size_in_bytes(nr_bits) \
414 (__bitmask_size_in_longs(nr_bits) * (BITS_PER_LONG / 8))
415
416#undef __bitmask
417#define __bitmask(item, nr_bits) __dynamic_array(unsigned long, item, \
418 __bitmask_size_in_longs(nr_bits))
419
375#undef DECLARE_EVENT_CLASS 420#undef DECLARE_EVENT_CLASS
376#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ 421#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
377static inline notrace int ftrace_get_offsets_##call( \ 422static inline notrace int ftrace_get_offsets_##call( \
@@ -513,12 +558,22 @@ static inline notrace int ftrace_get_offsets_##call( \
513 __entry->__data_loc_##item = __data_offsets.item; 558 __entry->__data_loc_##item = __data_offsets.item;
514 559
515#undef __string 560#undef __string
516#define __string(item, src) __dynamic_array(char, item, -1) \ 561#define __string(item, src) __dynamic_array(char, item, -1)
517 562
518#undef __assign_str 563#undef __assign_str
519#define __assign_str(dst, src) \ 564#define __assign_str(dst, src) \
520 strcpy(__get_str(dst), (src) ? (const char *)(src) : "(null)"); 565 strcpy(__get_str(dst), (src) ? (const char *)(src) : "(null)");
521 566
567#undef __bitmask
568#define __bitmask(item, nr_bits) __dynamic_array(unsigned long, item, -1)
569
570#undef __get_bitmask
571#define __get_bitmask(field) (char *)__get_dynamic_array(field)
572
573#undef __assign_bitmask
574#define __assign_bitmask(dst, src, nr_bits) \
575 memcpy(__get_bitmask(dst), (src), __bitmask_size_in_bytes(nr_bits))
576
522#undef TP_fast_assign 577#undef TP_fast_assign
523#define TP_fast_assign(args...) args 578#define TP_fast_assign(args...) args
524 579
@@ -585,7 +640,9 @@ static inline void ftrace_test_probe_##call(void) \
585#undef __print_symbolic 640#undef __print_symbolic
586#undef __print_hex 641#undef __print_hex
587#undef __get_dynamic_array 642#undef __get_dynamic_array
643#undef __get_dynamic_array_len
588#undef __get_str 644#undef __get_str
645#undef __get_bitmask
589 646
590#undef TP_printk 647#undef TP_printk
591#define TP_printk(fmt, args...) "\"" fmt "\", " __stringify(args) 648#define TP_printk(fmt, args...) "\"" fmt "\", " __stringify(args)
@@ -648,9 +705,16 @@ __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call
648#define __get_dynamic_array(field) \ 705#define __get_dynamic_array(field) \
649 ((void *)__entry + (__entry->__data_loc_##field & 0xffff)) 706 ((void *)__entry + (__entry->__data_loc_##field & 0xffff))
650 707
708#undef __get_dynamic_array_len
709#define __get_dynamic_array_len(field) \
710 ((__entry->__data_loc_##field >> 16) & 0xffff)
711
651#undef __get_str 712#undef __get_str
652#define __get_str(field) (char *)__get_dynamic_array(field) 713#define __get_str(field) (char *)__get_dynamic_array(field)
653 714
715#undef __get_bitmask
716#define __get_bitmask(field) (char *)__get_dynamic_array(field)
717
654#undef __perf_addr 718#undef __perf_addr
655#define __perf_addr(a) (__addr = (a)) 719#define __perf_addr(a) (__addr = (a))
656 720