aboutsummaryrefslogtreecommitdiffstats
path: root/include/trace
diff options
context:
space:
mode:
Diffstat (limited to 'include/trace')
-rw-r--r--include/trace/events/ext4.h9
-rw-r--r--include/trace/events/f2fs.h146
-rw-r--r--include/trace/events/power.h84
-rw-r--r--include/trace/events/sched.h20
-rw-r--r--include/trace/ftrace.h99
-rw-r--r--include/trace/syscall.h15
6 files changed, 339 insertions, 34 deletions
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/power.h b/include/trace/events/power.h
index 9a7e08d61258..d19840b0cac8 100644
--- a/include/trace/events/power.h
+++ b/include/trace/events/power.h
@@ -7,6 +7,9 @@
7#include <linux/ktime.h> 7#include <linux/ktime.h>
8#include <linux/pm_qos.h> 8#include <linux/pm_qos.h>
9#include <linux/tracepoint.h> 9#include <linux/tracepoint.h>
10#include <linux/ftrace_event.h>
11
12#define TPS(x) tracepoint_string(x)
10 13
11DECLARE_EVENT_CLASS(cpu, 14DECLARE_EVENT_CLASS(cpu,
12 15
@@ -90,6 +93,17 @@ TRACE_EVENT(pstate_sample,
90#define PWR_EVENT_EXIT -1 93#define PWR_EVENT_EXIT -1
91#endif 94#endif
92 95
96#define pm_verb_symbolic(event) \
97 __print_symbolic(event, \
98 { PM_EVENT_SUSPEND, "suspend" }, \
99 { PM_EVENT_RESUME, "resume" }, \
100 { PM_EVENT_FREEZE, "freeze" }, \
101 { PM_EVENT_QUIESCE, "quiesce" }, \
102 { PM_EVENT_HIBERNATE, "hibernate" }, \
103 { PM_EVENT_THAW, "thaw" }, \
104 { PM_EVENT_RESTORE, "restore" }, \
105 { PM_EVENT_RECOVER, "recover" })
106
93DEFINE_EVENT(cpu, cpu_frequency, 107DEFINE_EVENT(cpu, cpu_frequency,
94 108
95 TP_PROTO(unsigned int frequency, unsigned int cpu_id), 109 TP_PROTO(unsigned int frequency, unsigned int cpu_id),
@@ -97,58 +111,76 @@ DEFINE_EVENT(cpu, cpu_frequency,
97 TP_ARGS(frequency, cpu_id) 111 TP_ARGS(frequency, cpu_id)
98); 112);
99 113
100TRACE_EVENT(machine_suspend, 114TRACE_EVENT(device_pm_callback_start,
101 115
102 TP_PROTO(unsigned int state), 116 TP_PROTO(struct device *dev, const char *pm_ops, int event),
103 117
104 TP_ARGS(state), 118 TP_ARGS(dev, pm_ops, event),
105 119
106 TP_STRUCT__entry( 120 TP_STRUCT__entry(
107 __field( u32, state ) 121 __string(device, dev_name(dev))
122 __string(driver, dev_driver_string(dev))
123 __string(parent, dev->parent ? dev_name(dev->parent) : "none")
124 __string(pm_ops, pm_ops ? pm_ops : "none ")
125 __field(int, event)
108 ), 126 ),
109 127
110 TP_fast_assign( 128 TP_fast_assign(
111 __entry->state = state; 129 __assign_str(device, dev_name(dev));
130 __assign_str(driver, dev_driver_string(dev));
131 __assign_str(parent,
132 dev->parent ? dev_name(dev->parent) : "none");
133 __assign_str(pm_ops, pm_ops ? pm_ops : "none ");
134 __entry->event = event;
112 ), 135 ),
113 136
114 TP_printk("state=%lu", (unsigned long)__entry->state) 137 TP_printk("%s %s, parent: %s, %s[%s]", __get_str(driver),
138 __get_str(device), __get_str(parent), __get_str(pm_ops),
139 pm_verb_symbolic(__entry->event))
115); 140);
116 141
117TRACE_EVENT(device_pm_report_time, 142TRACE_EVENT(device_pm_callback_end,
118 143
119 TP_PROTO(struct device *dev, const char *pm_ops, s64 ops_time, 144 TP_PROTO(struct device *dev, int error),
120 char *pm_event_str, int error),
121 145
122 TP_ARGS(dev, pm_ops, ops_time, pm_event_str, error), 146 TP_ARGS(dev, error),
123 147
124 TP_STRUCT__entry( 148 TP_STRUCT__entry(
125 __string(device, dev_name(dev)) 149 __string(device, dev_name(dev))
126 __string(driver, dev_driver_string(dev)) 150 __string(driver, dev_driver_string(dev))
127 __string(parent, dev->parent ? dev_name(dev->parent) : "none")
128 __string(pm_ops, pm_ops ? pm_ops : "none ")
129 __string(pm_event_str, pm_event_str)
130 __field(s64, ops_time)
131 __field(int, error) 151 __field(int, error)
132 ), 152 ),
133 153
134 TP_fast_assign( 154 TP_fast_assign(
135 const char *tmp = dev->parent ? dev_name(dev->parent) : "none";
136 const char *tmp_i = pm_ops ? pm_ops : "none ";
137
138 __assign_str(device, dev_name(dev)); 155 __assign_str(device, dev_name(dev));
139 __assign_str(driver, dev_driver_string(dev)); 156 __assign_str(driver, dev_driver_string(dev));
140 __assign_str(parent, tmp);
141 __assign_str(pm_ops, tmp_i);
142 __assign_str(pm_event_str, pm_event_str);
143 __entry->ops_time = ops_time;
144 __entry->error = error; 157 __entry->error = error;
145 ), 158 ),
146 159
147 /* ops_str has an extra space at the end */ 160 TP_printk("%s %s, err=%d",
148 TP_printk("%s %s parent=%s state=%s ops=%snsecs=%lld err=%d", 161 __get_str(driver), __get_str(device), __entry->error)
149 __get_str(driver), __get_str(device), __get_str(parent), 162);
150 __get_str(pm_event_str), __get_str(pm_ops), 163
151 __entry->ops_time, __entry->error) 164TRACE_EVENT(suspend_resume,
165
166 TP_PROTO(const char *action, int val, bool start),
167
168 TP_ARGS(action, val, start),
169
170 TP_STRUCT__entry(
171 __field(const char *, action)
172 __field(int, val)
173 __field(bool, start)
174 ),
175
176 TP_fast_assign(
177 __entry->action = action;
178 __entry->val = val;
179 __entry->start = start;
180 ),
181
182 TP_printk("%s[%u] %s", __entry->action, (unsigned int)__entry->val,
183 (__entry->start)?"begin":"end")
152); 184);
153 185
154DECLARE_EVENT_CLASS(wakeup_source, 186DECLARE_EVENT_CLASS(wakeup_source,
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index 67e1bbf83695..0a68d5ae584e 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -530,6 +530,26 @@ TRACE_EVENT(sched_swap_numa,
530 __entry->dst_pid, __entry->dst_tgid, __entry->dst_ngid, 530 __entry->dst_pid, __entry->dst_tgid, __entry->dst_ngid,
531 __entry->dst_cpu, __entry->dst_nid) 531 __entry->dst_cpu, __entry->dst_nid)
532); 532);
533
534/*
535 * Tracepoint for waking a polling cpu without an IPI.
536 */
537TRACE_EVENT(sched_wake_idle_without_ipi,
538
539 TP_PROTO(int cpu),
540
541 TP_ARGS(cpu),
542
543 TP_STRUCT__entry(
544 __field( int, cpu )
545 ),
546
547 TP_fast_assign(
548 __entry->cpu = cpu;
549 ),
550
551 TP_printk("cpu=%d", __entry->cpu)
552);
533#endif /* _TRACE_SCHED_H */ 553#endif /* _TRACE_SCHED_H */
534 554
535/* This part must be outside protection */ 555/* This part must be outside protection */
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index 0a1a4f7caf09..26b4f2e13275 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -44,6 +44,12 @@
44#undef __field_ext 44#undef __field_ext
45#define __field_ext(type, item, filter_type) type item; 45#define __field_ext(type, item, filter_type) type item;
46 46
47#undef __field_struct
48#define __field_struct(type, item) type item;
49
50#undef __field_struct_ext
51#define __field_struct_ext(type, item, filter_type) type item;
52
47#undef __array 53#undef __array
48#define __array(type, item, len) type item[len]; 54#define __array(type, item, len) type item[len];
49 55
@@ -53,6 +59,9 @@
53#undef __string 59#undef __string
54#define __string(item, src) __dynamic_array(char, item, -1) 60#define __string(item, src) __dynamic_array(char, item, -1)
55 61
62#undef __bitmask
63#define __bitmask(item, nr_bits) __dynamic_array(char, item, -1)
64
56#undef TP_STRUCT__entry 65#undef TP_STRUCT__entry
57#define TP_STRUCT__entry(args...) args 66#define TP_STRUCT__entry(args...) args
58 67
@@ -119,6 +128,12 @@
119#undef __field_ext 128#undef __field_ext
120#define __field_ext(type, item, filter_type) 129#define __field_ext(type, item, filter_type)
121 130
131#undef __field_struct
132#define __field_struct(type, item)
133
134#undef __field_struct_ext
135#define __field_struct_ext(type, item, filter_type)
136
122#undef __array 137#undef __array
123#define __array(type, item, len) 138#define __array(type, item, len)
124 139
@@ -128,6 +143,9 @@
128#undef __string 143#undef __string
129#define __string(item, src) __dynamic_array(char, item, -1) 144#define __string(item, src) __dynamic_array(char, item, -1)
130 145
146#undef __bitmask
147#define __bitmask(item, nr_bits) __dynamic_array(unsigned long, item, -1)
148
131#undef DECLARE_EVENT_CLASS 149#undef DECLARE_EVENT_CLASS
132#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ 150#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
133 struct ftrace_data_offsets_##call { \ 151 struct ftrace_data_offsets_##call { \
@@ -197,9 +215,22 @@
197#define __get_dynamic_array(field) \ 215#define __get_dynamic_array(field) \
198 ((void *)__entry + (__entry->__data_loc_##field & 0xffff)) 216 ((void *)__entry + (__entry->__data_loc_##field & 0xffff))
199 217
218#undef __get_dynamic_array_len
219#define __get_dynamic_array_len(field) \
220 ((__entry->__data_loc_##field >> 16) & 0xffff)
221
200#undef __get_str 222#undef __get_str
201#define __get_str(field) (char *)__get_dynamic_array(field) 223#define __get_str(field) (char *)__get_dynamic_array(field)
202 224
225#undef __get_bitmask
226#define __get_bitmask(field) \
227 ({ \
228 void *__bitmask = __get_dynamic_array(field); \
229 unsigned int __bitmask_size; \
230 __bitmask_size = __get_dynamic_array_len(field); \
231 ftrace_print_bitmask_seq(p, __bitmask, __bitmask_size); \
232 })
233
203#undef __print_flags 234#undef __print_flags
204#define __print_flags(flag, delim, flag_array...) \ 235#define __print_flags(flag, delim, flag_array...) \
205 ({ \ 236 ({ \
@@ -296,9 +327,21 @@ static struct trace_event_functions ftrace_event_type_funcs_##call = { \
296 if (ret) \ 327 if (ret) \
297 return ret; 328 return ret;
298 329
330#undef __field_struct_ext
331#define __field_struct_ext(type, item, filter_type) \
332 ret = trace_define_field(event_call, #type, #item, \
333 offsetof(typeof(field), item), \
334 sizeof(field.item), \
335 0, filter_type); \
336 if (ret) \
337 return ret;
338
299#undef __field 339#undef __field
300#define __field(type, item) __field_ext(type, item, FILTER_OTHER) 340#define __field(type, item) __field_ext(type, item, FILTER_OTHER)
301 341
342#undef __field_struct
343#define __field_struct(type, item) __field_struct_ext(type, item, FILTER_OTHER)
344
302#undef __array 345#undef __array
303#define __array(type, item, len) \ 346#define __array(type, item, len) \
304 do { \ 347 do { \
@@ -322,6 +365,9 @@ static struct trace_event_functions ftrace_event_type_funcs_##call = { \
322#undef __string 365#undef __string
323#define __string(item, src) __dynamic_array(char, item, -1) 366#define __string(item, src) __dynamic_array(char, item, -1)
324 367
368#undef __bitmask
369#define __bitmask(item, nr_bits) __dynamic_array(unsigned long, item, -1)
370
325#undef DECLARE_EVENT_CLASS 371#undef DECLARE_EVENT_CLASS
326#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, func, print) \ 372#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, func, print) \
327static int notrace __init \ 373static int notrace __init \
@@ -357,6 +403,12 @@ ftrace_define_fields_##call(struct ftrace_event_call *event_call) \
357#undef __field_ext 403#undef __field_ext
358#define __field_ext(type, item, filter_type) 404#define __field_ext(type, item, filter_type)
359 405
406#undef __field_struct
407#define __field_struct(type, item)
408
409#undef __field_struct_ext
410#define __field_struct_ext(type, item, filter_type)
411
360#undef __array 412#undef __array
361#define __array(type, item, len) 413#define __array(type, item, len)
362 414
@@ -372,6 +424,29 @@ ftrace_define_fields_##call(struct ftrace_event_call *event_call) \
372#define __string(item, src) __dynamic_array(char, item, \ 424#define __string(item, src) __dynamic_array(char, item, \
373 strlen((src) ? (const char *)(src) : "(null)") + 1) 425 strlen((src) ? (const char *)(src) : "(null)") + 1)
374 426
427/*
428 * __bitmask_size_in_bytes_raw is the number of bytes needed to hold
429 * num_possible_cpus().
430 */
431#define __bitmask_size_in_bytes_raw(nr_bits) \
432 (((nr_bits) + 7) / 8)
433
434#define __bitmask_size_in_longs(nr_bits) \
435 ((__bitmask_size_in_bytes_raw(nr_bits) + \
436 ((BITS_PER_LONG / 8) - 1)) / (BITS_PER_LONG / 8))
437
438/*
439 * __bitmask_size_in_bytes is the number of bytes needed to hold
440 * num_possible_cpus() padded out to the nearest long. This is what
441 * is saved in the buffer, just to be consistent.
442 */
443#define __bitmask_size_in_bytes(nr_bits) \
444 (__bitmask_size_in_longs(nr_bits) * (BITS_PER_LONG / 8))
445
446#undef __bitmask
447#define __bitmask(item, nr_bits) __dynamic_array(unsigned long, item, \
448 __bitmask_size_in_longs(nr_bits))
449
375#undef DECLARE_EVENT_CLASS 450#undef DECLARE_EVENT_CLASS
376#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ 451#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
377static inline notrace int ftrace_get_offsets_##call( \ 452static inline notrace int ftrace_get_offsets_##call( \
@@ -505,6 +580,9 @@ static inline notrace int ftrace_get_offsets_##call( \
505#undef __field 580#undef __field
506#define __field(type, item) 581#define __field(type, item)
507 582
583#undef __field_struct
584#define __field_struct(type, item)
585
508#undef __array 586#undef __array
509#define __array(type, item, len) 587#define __array(type, item, len)
510 588
@@ -513,12 +591,22 @@ static inline notrace int ftrace_get_offsets_##call( \
513 __entry->__data_loc_##item = __data_offsets.item; 591 __entry->__data_loc_##item = __data_offsets.item;
514 592
515#undef __string 593#undef __string
516#define __string(item, src) __dynamic_array(char, item, -1) \ 594#define __string(item, src) __dynamic_array(char, item, -1)
517 595
518#undef __assign_str 596#undef __assign_str
519#define __assign_str(dst, src) \ 597#define __assign_str(dst, src) \
520 strcpy(__get_str(dst), (src) ? (const char *)(src) : "(null)"); 598 strcpy(__get_str(dst), (src) ? (const char *)(src) : "(null)");
521 599
600#undef __bitmask
601#define __bitmask(item, nr_bits) __dynamic_array(unsigned long, item, -1)
602
603#undef __get_bitmask
604#define __get_bitmask(field) (char *)__get_dynamic_array(field)
605
606#undef __assign_bitmask
607#define __assign_bitmask(dst, src, nr_bits) \
608 memcpy(__get_bitmask(dst), (src), __bitmask_size_in_bytes(nr_bits))
609
522#undef TP_fast_assign 610#undef TP_fast_assign
523#define TP_fast_assign(args...) args 611#define TP_fast_assign(args...) args
524 612
@@ -585,7 +673,9 @@ static inline void ftrace_test_probe_##call(void) \
585#undef __print_symbolic 673#undef __print_symbolic
586#undef __print_hex 674#undef __print_hex
587#undef __get_dynamic_array 675#undef __get_dynamic_array
676#undef __get_dynamic_array_len
588#undef __get_str 677#undef __get_str
678#undef __get_bitmask
589 679
590#undef TP_printk 680#undef TP_printk
591#define TP_printk(fmt, args...) "\"" fmt "\", " __stringify(args) 681#define TP_printk(fmt, args...) "\"" fmt "\", " __stringify(args)
@@ -648,9 +738,16 @@ __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call
648#define __get_dynamic_array(field) \ 738#define __get_dynamic_array(field) \
649 ((void *)__entry + (__entry->__data_loc_##field & 0xffff)) 739 ((void *)__entry + (__entry->__data_loc_##field & 0xffff))
650 740
741#undef __get_dynamic_array_len
742#define __get_dynamic_array_len(field) \
743 ((__entry->__data_loc_##field >> 16) & 0xffff)
744
651#undef __get_str 745#undef __get_str
652#define __get_str(field) (char *)__get_dynamic_array(field) 746#define __get_str(field) (char *)__get_dynamic_array(field)
653 747
748#undef __get_bitmask
749#define __get_bitmask(field) (char *)__get_dynamic_array(field)
750
654#undef __perf_addr 751#undef __perf_addr
655#define __perf_addr(a) (__addr = (a)) 752#define __perf_addr(a) (__addr = (a))
656 753
diff --git a/include/trace/syscall.h b/include/trace/syscall.h
index fed853f3d7aa..9674145e2f6a 100644
--- a/include/trace/syscall.h
+++ b/include/trace/syscall.h
@@ -4,6 +4,7 @@
4#include <linux/tracepoint.h> 4#include <linux/tracepoint.h>
5#include <linux/unistd.h> 5#include <linux/unistd.h>
6#include <linux/ftrace_event.h> 6#include <linux/ftrace_event.h>
7#include <linux/thread_info.h>
7 8
8#include <asm/ptrace.h> 9#include <asm/ptrace.h>
9 10
@@ -32,4 +33,18 @@ struct syscall_metadata {
32 struct ftrace_event_call *exit_event; 33 struct ftrace_event_call *exit_event;
33}; 34};
34 35
36#if defined(CONFIG_TRACEPOINTS) && defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
37static inline void syscall_tracepoint_update(struct task_struct *p)
38{
39 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
40 set_tsk_thread_flag(p, TIF_SYSCALL_TRACEPOINT);
41 else
42 clear_tsk_thread_flag(p, TIF_SYSCALL_TRACEPOINT);
43}
44#else
45static inline void syscall_tracepoint_update(struct task_struct *p)
46{
47}
48#endif
49
35#endif /* _TRACE_SYSCALL_H */ 50#endif /* _TRACE_SYSCALL_H */