aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/tracepoints.txt8
-rw-r--r--include/linux/tracepoint.h10
-rw-r--r--include/trace/block.h70
-rw-r--r--include/trace/irq_event_types.h46
-rw-r--r--include/trace/lockdep_event_types.h26
-rw-r--r--include/trace/power.h12
-rw-r--r--include/trace/sched_event_types.h442
-rw-r--r--include/trace/workqueue.h16
-rw-r--r--kernel/trace/events.c4
-rw-r--r--kernel/trace/trace.h5
-rw-r--r--kernel/trace/trace_event_types.h29
-rw-r--r--kernel/trace/trace_events.c174
-rw-r--r--kernel/trace/trace_events_stage_1.h27
-rw-r--r--kernel/trace/trace_events_stage_2.h91
-rw-r--r--kernel/trace/trace_events_stage_3.h42
-rw-r--r--kernel/trace/trace_export.c41
-rw-r--r--kernel/trace/trace_format.h55
-rw-r--r--kernel/trace/trace_selftest.c6
-rw-r--r--samples/tracepoints/tp-samples-trace.h8
19 files changed, 575 insertions, 537 deletions
diff --git a/Documentation/tracepoints.txt b/Documentation/tracepoints.txt
index 6f0a044f5b5e..4ff43c6de299 100644
--- a/Documentation/tracepoints.txt
+++ b/Documentation/tracepoints.txt
@@ -45,8 +45,8 @@ In include/trace/subsys.h :
45#include <linux/tracepoint.h> 45#include <linux/tracepoint.h>
46 46
47DECLARE_TRACE(subsys_eventname, 47DECLARE_TRACE(subsys_eventname,
48 TPPROTO(int firstarg, struct task_struct *p), 48 TP_PROTO(int firstarg, struct task_struct *p),
49 TPARGS(firstarg, p)); 49 TP_ARGS(firstarg, p));
50 50
51In subsys/file.c (where the tracing statement must be added) : 51In subsys/file.c (where the tracing statement must be added) :
52 52
@@ -66,10 +66,10 @@ Where :
66 - subsys is the name of your subsystem. 66 - subsys is the name of your subsystem.
67 - eventname is the name of the event to trace. 67 - eventname is the name of the event to trace.
68 68
69- TPPROTO(int firstarg, struct task_struct *p) is the prototype of the 69- TP_PROTO(int firstarg, struct task_struct *p) is the prototype of the
70 function called by this tracepoint. 70 function called by this tracepoint.
71 71
72- TPARGS(firstarg, p) are the parameters names, same as found in the 72- TP_ARGS(firstarg, p) are the parameters names, same as found in the
73 prototype. 73 prototype.
74 74
75Connecting a function (probe) to a tracepoint is done by providing a 75Connecting a function (probe) to a tracepoint is done by providing a
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 152b2f03fb86..69b56988813d 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -31,8 +31,8 @@ struct tracepoint {
31 * Keep in sync with vmlinux.lds.h. 31 * Keep in sync with vmlinux.lds.h.
32 */ 32 */
33 33
34#define TPPROTO(args...) args 34#define TP_PROTO(args...) args
35#define TPARGS(args...) args 35#define TP_ARGS(args...) args
36 36
37#ifdef CONFIG_TRACEPOINTS 37#ifdef CONFIG_TRACEPOINTS
38 38
@@ -65,7 +65,7 @@ struct tracepoint {
65 { \ 65 { \
66 if (unlikely(__tracepoint_##name.state)) \ 66 if (unlikely(__tracepoint_##name.state)) \
67 __DO_TRACE(&__tracepoint_##name, \ 67 __DO_TRACE(&__tracepoint_##name, \
68 TPPROTO(proto), TPARGS(args)); \ 68 TP_PROTO(proto), TP_ARGS(args)); \
69 } \ 69 } \
70 static inline int register_trace_##name(void (*probe)(proto)) \ 70 static inline int register_trace_##name(void (*probe)(proto)) \
71 { \ 71 { \
@@ -157,7 +157,7 @@ static inline void tracepoint_synchronize_unregister(void)
157#define TRACE_FORMAT(name, proto, args, fmt) \ 157#define TRACE_FORMAT(name, proto, args, fmt) \
158 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) 158 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
159 159
160#define TRACE_EVENT_FORMAT(name, proto, args, fmt, struct, tpfmt) \ 160#define TRACE_EVENT(name, proto, args, struct, print, assign) \
161 TRACE_FORMAT(name, PARAMS(proto), PARAMS(args), PARAMS(fmt)) 161 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
162 162
163#endif 163#endif
diff --git a/include/trace/block.h b/include/trace/block.h
index 25c6a1fd5b77..25b7068b819e 100644
--- a/include/trace/block.h
+++ b/include/trace/block.h
@@ -5,72 +5,72 @@
5#include <linux/tracepoint.h> 5#include <linux/tracepoint.h>
6 6
7DECLARE_TRACE(block_rq_abort, 7DECLARE_TRACE(block_rq_abort,
8 TPPROTO(struct request_queue *q, struct request *rq), 8 TP_PROTO(struct request_queue *q, struct request *rq),
9 TPARGS(q, rq)); 9 TP_ARGS(q, rq));
10 10
11DECLARE_TRACE(block_rq_insert, 11DECLARE_TRACE(block_rq_insert,
12 TPPROTO(struct request_queue *q, struct request *rq), 12 TP_PROTO(struct request_queue *q, struct request *rq),
13 TPARGS(q, rq)); 13 TP_ARGS(q, rq));
14 14
15DECLARE_TRACE(block_rq_issue, 15DECLARE_TRACE(block_rq_issue,
16 TPPROTO(struct request_queue *q, struct request *rq), 16 TP_PROTO(struct request_queue *q, struct request *rq),
17 TPARGS(q, rq)); 17 TP_ARGS(q, rq));
18 18
19DECLARE_TRACE(block_rq_requeue, 19DECLARE_TRACE(block_rq_requeue,
20 TPPROTO(struct request_queue *q, struct request *rq), 20 TP_PROTO(struct request_queue *q, struct request *rq),
21 TPARGS(q, rq)); 21 TP_ARGS(q, rq));
22 22
23DECLARE_TRACE(block_rq_complete, 23DECLARE_TRACE(block_rq_complete,
24 TPPROTO(struct request_queue *q, struct request *rq), 24 TP_PROTO(struct request_queue *q, struct request *rq),
25 TPARGS(q, rq)); 25 TP_ARGS(q, rq));
26 26
27DECLARE_TRACE(block_bio_bounce, 27DECLARE_TRACE(block_bio_bounce,
28 TPPROTO(struct request_queue *q, struct bio *bio), 28 TP_PROTO(struct request_queue *q, struct bio *bio),
29 TPARGS(q, bio)); 29 TP_ARGS(q, bio));
30 30
31DECLARE_TRACE(block_bio_complete, 31DECLARE_TRACE(block_bio_complete,
32 TPPROTO(struct request_queue *q, struct bio *bio), 32 TP_PROTO(struct request_queue *q, struct bio *bio),
33 TPARGS(q, bio)); 33 TP_ARGS(q, bio));
34 34
35DECLARE_TRACE(block_bio_backmerge, 35DECLARE_TRACE(block_bio_backmerge,
36 TPPROTO(struct request_queue *q, struct bio *bio), 36 TP_PROTO(struct request_queue *q, struct bio *bio),
37 TPARGS(q, bio)); 37 TP_ARGS(q, bio));
38 38
39DECLARE_TRACE(block_bio_frontmerge, 39DECLARE_TRACE(block_bio_frontmerge,
40 TPPROTO(struct request_queue *q, struct bio *bio), 40 TP_PROTO(struct request_queue *q, struct bio *bio),
41 TPARGS(q, bio)); 41 TP_ARGS(q, bio));
42 42
43DECLARE_TRACE(block_bio_queue, 43DECLARE_TRACE(block_bio_queue,
44 TPPROTO(struct request_queue *q, struct bio *bio), 44 TP_PROTO(struct request_queue *q, struct bio *bio),
45 TPARGS(q, bio)); 45 TP_ARGS(q, bio));
46 46
47DECLARE_TRACE(block_getrq, 47DECLARE_TRACE(block_getrq,
48 TPPROTO(struct request_queue *q, struct bio *bio, int rw), 48 TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
49 TPARGS(q, bio, rw)); 49 TP_ARGS(q, bio, rw));
50 50
51DECLARE_TRACE(block_sleeprq, 51DECLARE_TRACE(block_sleeprq,
52 TPPROTO(struct request_queue *q, struct bio *bio, int rw), 52 TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
53 TPARGS(q, bio, rw)); 53 TP_ARGS(q, bio, rw));
54 54
55DECLARE_TRACE(block_plug, 55DECLARE_TRACE(block_plug,
56 TPPROTO(struct request_queue *q), 56 TP_PROTO(struct request_queue *q),
57 TPARGS(q)); 57 TP_ARGS(q));
58 58
59DECLARE_TRACE(block_unplug_timer, 59DECLARE_TRACE(block_unplug_timer,
60 TPPROTO(struct request_queue *q), 60 TP_PROTO(struct request_queue *q),
61 TPARGS(q)); 61 TP_ARGS(q));
62 62
63DECLARE_TRACE(block_unplug_io, 63DECLARE_TRACE(block_unplug_io,
64 TPPROTO(struct request_queue *q), 64 TP_PROTO(struct request_queue *q),
65 TPARGS(q)); 65 TP_ARGS(q));
66 66
67DECLARE_TRACE(block_split, 67DECLARE_TRACE(block_split,
68 TPPROTO(struct request_queue *q, struct bio *bio, unsigned int pdu), 68 TP_PROTO(struct request_queue *q, struct bio *bio, unsigned int pdu),
69 TPARGS(q, bio, pdu)); 69 TP_ARGS(q, bio, pdu));
70 70
71DECLARE_TRACE(block_remap, 71DECLARE_TRACE(block_remap,
72 TPPROTO(struct request_queue *q, struct bio *bio, dev_t dev, 72 TP_PROTO(struct request_queue *q, struct bio *bio, dev_t dev,
73 sector_t from, sector_t to), 73 sector_t from, sector_t to),
74 TPARGS(q, bio, dev, from, to)); 74 TP_ARGS(q, bio, dev, from, to));
75 75
76#endif 76#endif
diff --git a/include/trace/irq_event_types.h b/include/trace/irq_event_types.h
index 65850bc5ea06..43bcb74dd49f 100644
--- a/include/trace/irq_event_types.h
+++ b/include/trace/irq_event_types.h
@@ -8,26 +8,36 @@
8#undef TRACE_SYSTEM 8#undef TRACE_SYSTEM
9#define TRACE_SYSTEM irq 9#define TRACE_SYSTEM irq
10 10
11TRACE_EVENT_FORMAT(irq_handler_entry, 11/*
12 TPPROTO(int irq, struct irqaction *action), 12 * Tracepoint for entry of interrupt handler:
13 TPARGS(irq, action), 13 */
14 TPFMT("irq=%d handler=%s", irq, action->name), 14TRACE_FORMAT(irq_handler_entry,
15 TRACE_STRUCT( 15 TP_PROTO(int irq, struct irqaction *action),
16 TRACE_FIELD(int, irq, irq) 16 TP_ARGS(irq, action),
17 ), 17 TP_FMT("irq=%d handler=%s", irq, action->name)
18 TPRAWFMT("irq %d")
19 ); 18 );
20 19
21TRACE_EVENT_FORMAT(irq_handler_exit, 20/*
22 TPPROTO(int irq, struct irqaction *action, int ret), 21 * Tracepoint for return of an interrupt handler:
23 TPARGS(irq, action, ret), 22 */
24 TPFMT("irq=%d handler=%s return=%s", 23TRACE_EVENT(irq_handler_exit,
25 irq, action->name, ret ? "handled" : "unhandled"), 24
26 TRACE_STRUCT( 25 TP_PROTO(int irq, struct irqaction *action, int ret),
27 TRACE_FIELD(int, irq, irq) 26
28 TRACE_FIELD(int, ret, ret) 27 TP_ARGS(irq, action, ret),
28
29 TP_STRUCT__entry(
30 __field( int, irq )
31 __field( int, ret )
29 ), 32 ),
30 TPRAWFMT("irq %d ret %d") 33
31 ); 34 TP_printk("irq=%d return=%s",
35 __entry->irq, __entry->ret ? "handled" : "unhandled"),
36
37 TP_fast_assign(
38 __entry->irq = irq;
39 __entry->ret = ret;
40 )
41);
32 42
33#undef TRACE_SYSTEM 43#undef TRACE_SYSTEM
diff --git a/include/trace/lockdep_event_types.h b/include/trace/lockdep_event_types.h
index f713d74a82b4..adccfcd2ec8f 100644
--- a/include/trace/lockdep_event_types.h
+++ b/include/trace/lockdep_event_types.h
@@ -1,5 +1,5 @@
1 1
2#ifndef TRACE_EVENT_FORMAT 2#ifndef TRACE_FORMAT
3# error Do not include this file directly. 3# error Do not include this file directly.
4# error Unless you know what you are doing. 4# error Unless you know what you are doing.
5#endif 5#endif
@@ -10,32 +10,32 @@
10#ifdef CONFIG_LOCKDEP 10#ifdef CONFIG_LOCKDEP
11 11
12TRACE_FORMAT(lock_acquire, 12TRACE_FORMAT(lock_acquire,
13 TPPROTO(struct lockdep_map *lock, unsigned int subclass, 13 TP_PROTO(struct lockdep_map *lock, unsigned int subclass,
14 int trylock, int read, int check, 14 int trylock, int read, int check,
15 struct lockdep_map *next_lock, unsigned long ip), 15 struct lockdep_map *next_lock, unsigned long ip),
16 TPARGS(lock, subclass, trylock, read, check, next_lock, ip), 16 TP_ARGS(lock, subclass, trylock, read, check, next_lock, ip),
17 TPFMT("%s%s%s", trylock ? "try " : "", 17 TP_FMT("%s%s%s", trylock ? "try " : "",
18 read ? "read " : "", lock->name) 18 read ? "read " : "", lock->name)
19 ); 19 );
20 20
21TRACE_FORMAT(lock_release, 21TRACE_FORMAT(lock_release,
22 TPPROTO(struct lockdep_map *lock, int nested, unsigned long ip), 22 TP_PROTO(struct lockdep_map *lock, int nested, unsigned long ip),
23 TPARGS(lock, nested, ip), 23 TP_ARGS(lock, nested, ip),
24 TPFMT("%s", lock->name) 24 TP_FMT("%s", lock->name)
25 ); 25 );
26 26
27#ifdef CONFIG_LOCK_STAT 27#ifdef CONFIG_LOCK_STAT
28 28
29TRACE_FORMAT(lock_contended, 29TRACE_FORMAT(lock_contended,
30 TPPROTO(struct lockdep_map *lock, unsigned long ip), 30 TP_PROTO(struct lockdep_map *lock, unsigned long ip),
31 TPARGS(lock, ip), 31 TP_ARGS(lock, ip),
32 TPFMT("%s", lock->name) 32 TP_FMT("%s", lock->name)
33 ); 33 );
34 34
35TRACE_FORMAT(lock_acquired, 35TRACE_FORMAT(lock_acquired,
36 TPPROTO(struct lockdep_map *lock, unsigned long ip), 36 TP_PROTO(struct lockdep_map *lock, unsigned long ip),
37 TPARGS(lock, ip), 37 TP_ARGS(lock, ip),
38 TPFMT("%s", lock->name) 38 TP_FMT("%s", lock->name)
39 ); 39 );
40 40
41#endif 41#endif
diff --git a/include/trace/power.h b/include/trace/power.h
index 38aca537e497..ef204666e983 100644
--- a/include/trace/power.h
+++ b/include/trace/power.h
@@ -18,15 +18,15 @@ struct power_trace {
18}; 18};
19 19
20DECLARE_TRACE(power_start, 20DECLARE_TRACE(power_start,
21 TPPROTO(struct power_trace *it, unsigned int type, unsigned int state), 21 TP_PROTO(struct power_trace *it, unsigned int type, unsigned int state),
22 TPARGS(it, type, state)); 22 TP_ARGS(it, type, state));
23 23
24DECLARE_TRACE(power_mark, 24DECLARE_TRACE(power_mark,
25 TPPROTO(struct power_trace *it, unsigned int type, unsigned int state), 25 TP_PROTO(struct power_trace *it, unsigned int type, unsigned int state),
26 TPARGS(it, type, state)); 26 TP_ARGS(it, type, state));
27 27
28DECLARE_TRACE(power_end, 28DECLARE_TRACE(power_end,
29 TPPROTO(struct power_trace *it), 29 TP_PROTO(struct power_trace *it),
30 TPARGS(it)); 30 TP_ARGS(it));
31 31
32#endif /* _TRACE_POWER_H */ 32#endif /* _TRACE_POWER_H */
diff --git a/include/trace/sched_event_types.h b/include/trace/sched_event_types.h
index a6de5c1601a0..fb37af672c88 100644
--- a/include/trace/sched_event_types.h
+++ b/include/trace/sched_event_types.h
@@ -1,6 +1,6 @@
1 1
2/* use <trace/sched.h> instead */ 2/* use <trace/sched.h> instead */
3#ifndef TRACE_EVENT_FORMAT 3#ifndef TRACE_EVENT
4# error Do not include this file directly. 4# error Do not include this file directly.
5# error Unless you know what you are doing. 5# error Unless you know what you are doing.
6#endif 6#endif
@@ -8,144 +8,330 @@
8#undef TRACE_SYSTEM 8#undef TRACE_SYSTEM
9#define TRACE_SYSTEM sched 9#define TRACE_SYSTEM sched
10 10
11TRACE_EVENT_FORMAT(sched_kthread_stop, 11/*
12 TPPROTO(struct task_struct *t), 12 * Tracepoint for calling kthread_stop, performed to end a kthread:
13 TPARGS(t), 13 */
14 TPFMT("task %s:%d", t->comm, t->pid), 14TRACE_EVENT(sched_kthread_stop,
15 TRACE_STRUCT( 15
16 TRACE_FIELD(pid_t, pid, t->pid) 16 TP_PROTO(struct task_struct *t),
17
18 TP_ARGS(t),
19
20 TP_STRUCT__entry(
21 __array( char, comm, TASK_COMM_LEN )
22 __field( pid_t, pid )
17 ), 23 ),
18 TPRAWFMT("task %d") 24
19 ); 25 TP_printk("task %s:%d", __entry->comm, __entry->pid),
20 26
21TRACE_EVENT_FORMAT(sched_kthread_stop_ret, 27 TP_fast_assign(
22 TPPROTO(int ret), 28 memcpy(__entry->comm, t->comm, TASK_COMM_LEN);
23 TPARGS(ret), 29 __entry->pid = t->pid;
24 TPFMT("ret=%d", ret), 30 )
25 TRACE_STRUCT( 31);
26 TRACE_FIELD(int, ret, ret) 32
33/*
34 * Tracepoint for the return value of the kthread stopping:
35 */
36TRACE_EVENT(sched_kthread_stop_ret,
37
38 TP_PROTO(int ret),
39
40 TP_ARGS(ret),
41
42 TP_STRUCT__entry(
43 __field( int, ret )
27 ), 44 ),
28 TPRAWFMT("ret=%d") 45
29 ); 46 TP_printk("ret %d", __entry->ret),
30 47
31TRACE_EVENT_FORMAT(sched_wait_task, 48 TP_fast_assign(
32 TPPROTO(struct rq *rq, struct task_struct *p), 49 __entry->ret = ret;
33 TPARGS(rq, p), 50 )
34 TPFMT("task %s:%d", p->comm, p->pid), 51);
35 TRACE_STRUCT( 52
36 TRACE_FIELD(pid_t, pid, p->pid) 53/*
54 * Tracepoint for waiting on task to unschedule:
55 *
56 * (NOTE: the 'rq' argument is not used by generic trace events,
57 * but used by the latency tracer plugin. )
58 */
59TRACE_EVENT(sched_wait_task,
60
61 TP_PROTO(struct rq *rq, struct task_struct *p),
62
63 TP_ARGS(rq, p),
64
65 TP_STRUCT__entry(
66 __array( char, comm, TASK_COMM_LEN )
67 __field( pid_t, pid )
68 __field( int, prio )
37 ), 69 ),
38 TPRAWFMT("task %d") 70
39 ); 71 TP_printk("task %s:%d [%d]",
40 72 __entry->comm, __entry->pid, __entry->prio),
41TRACE_EVENT_FORMAT(sched_wakeup, 73
42 TPPROTO(struct rq *rq, struct task_struct *p, int success), 74 TP_fast_assign(
43 TPARGS(rq, p, success), 75 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
44 TPFMT("task %s:%d %s", 76 __entry->pid = p->pid;
45 p->comm, p->pid, success ? "succeeded" : "failed"), 77 __entry->prio = p->prio;
46 TRACE_STRUCT( 78 )
47 TRACE_FIELD(pid_t, pid, p->pid) 79);
48 TRACE_FIELD(int, success, success) 80
81/*
82 * Tracepoint for waking up a task:
83 *
84 * (NOTE: the 'rq' argument is not used by generic trace events,
85 * but used by the latency tracer plugin. )
86 */
87TRACE_EVENT(sched_wakeup,
88
89 TP_PROTO(struct rq *rq, struct task_struct *p, int success),
90
91 TP_ARGS(rq, p, success),
92
93 TP_STRUCT__entry(
94 __array( char, comm, TASK_COMM_LEN )
95 __field( pid_t, pid )
96 __field( int, prio )
97 __field( int, success )
49 ), 98 ),
50 TPRAWFMT("task %d success=%d") 99
51 ); 100 TP_printk("task %s:%d [%d] success=%d",
52 101 __entry->comm, __entry->pid, __entry->prio,
53TRACE_EVENT_FORMAT(sched_wakeup_new, 102 __entry->success),
54 TPPROTO(struct rq *rq, struct task_struct *p, int success), 103
55 TPARGS(rq, p, success), 104 TP_fast_assign(
56 TPFMT("task %s:%d", 105 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
57 p->comm, p->pid, success ? "succeeded" : "failed"), 106 __entry->pid = p->pid;
58 TRACE_STRUCT( 107 __entry->prio = p->prio;
59 TRACE_FIELD(pid_t, pid, p->pid) 108 __entry->success = success;
60 TRACE_FIELD(int, success, success) 109 )
110);
111
112/*
113 * Tracepoint for waking up a new task:
114 *
115 * (NOTE: the 'rq' argument is not used by generic trace events,
116 * but used by the latency tracer plugin. )
117 */
118TRACE_EVENT(sched_wakeup_new,
119
120 TP_PROTO(struct rq *rq, struct task_struct *p, int success),
121
122 TP_ARGS(rq, p, success),
123
124 TP_STRUCT__entry(
125 __array( char, comm, TASK_COMM_LEN )
126 __field( pid_t, pid )
127 __field( int, prio )
128 __field( int, success )
61 ), 129 ),
62 TPRAWFMT("task %d success=%d") 130
63 ); 131 TP_printk("task %s:%d [%d] success=%d",
64 132 __entry->comm, __entry->pid, __entry->prio,
65TRACE_EVENT_FORMAT(sched_switch, 133 __entry->success),
66 TPPROTO(struct rq *rq, struct task_struct *prev, 134
67 struct task_struct *next), 135 TP_fast_assign(
68 TPARGS(rq, prev, next), 136 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
69 TPFMT("task %s:%d ==> %s:%d", 137 __entry->pid = p->pid;
70 prev->comm, prev->pid, next->comm, next->pid), 138 __entry->prio = p->prio;
71 TRACE_STRUCT( 139 __entry->success = success;
72 TRACE_FIELD(pid_t, prev_pid, prev->pid) 140 )
73 TRACE_FIELD(int, prev_prio, prev->prio) 141);
74 TRACE_FIELD_SPECIAL(char next_comm[TASK_COMM_LEN], 142
75 next_comm, 143/*
76 TPCMD(memcpy(TRACE_ENTRY->next_comm, 144 * Tracepoint for task switches, performed by the scheduler:
77 next->comm, 145 *
78 TASK_COMM_LEN))) 146 * (NOTE: the 'rq' argument is not used by generic trace events,
79 TRACE_FIELD(pid_t, next_pid, next->pid) 147 * but used by the latency tracer plugin. )
80 TRACE_FIELD(int, next_prio, next->prio) 148 */
149TRACE_EVENT(sched_switch,
150
151 TP_PROTO(struct rq *rq, struct task_struct *prev,
152 struct task_struct *next),
153
154 TP_ARGS(rq, prev, next),
155
156 TP_STRUCT__entry(
157 __array( char, prev_comm, TASK_COMM_LEN )
158 __field( pid_t, prev_pid )
159 __field( int, prev_prio )
160 __array( char, next_comm, TASK_COMM_LEN )
161 __field( pid_t, next_pid )
162 __field( int, next_prio )
81 ), 163 ),
82 TPRAWFMT("prev %d:%d ==> next %s:%d:%d") 164
83 ); 165 TP_printk("task %s:%d [%d] ==> %s:%d [%d]",
84 166 __entry->prev_comm, __entry->prev_pid, __entry->prev_prio,
85TRACE_EVENT_FORMAT(sched_migrate_task, 167 __entry->next_comm, __entry->next_pid, __entry->next_prio),
86 TPPROTO(struct task_struct *p, int orig_cpu, int dest_cpu), 168
87 TPARGS(p, orig_cpu, dest_cpu), 169 TP_fast_assign(
88 TPFMT("task %s:%d from: %d to: %d", 170 memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN);
89 p->comm, p->pid, orig_cpu, dest_cpu), 171 __entry->prev_pid = prev->pid;
90 TRACE_STRUCT( 172 __entry->prev_prio = prev->prio;
91 TRACE_FIELD(pid_t, pid, p->pid) 173 memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN);
92 TRACE_FIELD(int, orig_cpu, orig_cpu) 174 __entry->next_pid = next->pid;
93 TRACE_FIELD(int, dest_cpu, dest_cpu) 175 __entry->next_prio = next->prio;
176 )
177);
178
179/*
180 * Tracepoint for a task being migrated:
181 */
182TRACE_EVENT(sched_migrate_task,
183
184 TP_PROTO(struct task_struct *p, int orig_cpu, int dest_cpu),
185
186 TP_ARGS(p, orig_cpu, dest_cpu),
187
188 TP_STRUCT__entry(
189 __array( char, comm, TASK_COMM_LEN )
190 __field( pid_t, pid )
191 __field( int, prio )
192 __field( int, orig_cpu )
193 __field( int, dest_cpu )
94 ), 194 ),
95 TPRAWFMT("task %d from: %d to: %d") 195
96 ); 196 TP_printk("task %s:%d [%d] from: %d to: %d",
97 197 __entry->comm, __entry->pid, __entry->prio,
98TRACE_EVENT_FORMAT(sched_process_free, 198 __entry->orig_cpu, __entry->dest_cpu),
99 TPPROTO(struct task_struct *p), 199
100 TPARGS(p), 200 TP_fast_assign(
101 TPFMT("task %s:%d", p->comm, p->pid), 201 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
102 TRACE_STRUCT( 202 __entry->pid = p->pid;
103 TRACE_FIELD(pid_t, pid, p->pid) 203 __entry->prio = p->prio;
204 __entry->orig_cpu = orig_cpu;
205 __entry->dest_cpu = dest_cpu;
206 )
207);
208
209/*
210 * Tracepoint for freeing a task:
211 */
212TRACE_EVENT(sched_process_free,
213
214 TP_PROTO(struct task_struct *p),
215
216 TP_ARGS(p),
217
218 TP_STRUCT__entry(
219 __array( char, comm, TASK_COMM_LEN )
220 __field( pid_t, pid )
221 __field( int, prio )
104 ), 222 ),
105 TPRAWFMT("task %d") 223
106 ); 224 TP_printk("task %s:%d [%d]",
107 225 __entry->comm, __entry->pid, __entry->prio),
108TRACE_EVENT_FORMAT(sched_process_exit, 226
109 TPPROTO(struct task_struct *p), 227 TP_fast_assign(
110 TPARGS(p), 228 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
111 TPFMT("task %s:%d", p->comm, p->pid), 229 __entry->pid = p->pid;
112 TRACE_STRUCT( 230 __entry->prio = p->prio;
113 TRACE_FIELD(pid_t, pid, p->pid) 231 )
232);
233
234/*
235 * Tracepoint for a task exiting:
236 */
237TRACE_EVENT(sched_process_exit,
238
239 TP_PROTO(struct task_struct *p),
240
241 TP_ARGS(p),
242
243 TP_STRUCT__entry(
244 __array( char, comm, TASK_COMM_LEN )
245 __field( pid_t, pid )
246 __field( int, prio )
114 ), 247 ),
115 TPRAWFMT("task %d") 248
116 ); 249 TP_printk("task %s:%d [%d]",
117 250 __entry->comm, __entry->pid, __entry->prio),
118TRACE_EVENT_FORMAT(sched_process_wait, 251
119 TPPROTO(struct pid *pid), 252 TP_fast_assign(
120 TPARGS(pid), 253 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
121 TPFMT("pid %d", pid_nr(pid)), 254 __entry->pid = p->pid;
122 TRACE_STRUCT( 255 __entry->prio = p->prio;
123 TRACE_FIELD(pid_t, pid, pid_nr(pid)) 256 )
257);
258
259/*
260 * Tracepoint for a waiting task:
261 */
262TRACE_EVENT(sched_process_wait,
263
264 TP_PROTO(struct pid *pid),
265
266 TP_ARGS(pid),
267
268 TP_STRUCT__entry(
269 __array( char, comm, TASK_COMM_LEN )
270 __field( pid_t, pid )
271 __field( int, prio )
124 ), 272 ),
125 TPRAWFMT("task %d") 273
126 ); 274 TP_printk("task %s:%d [%d]",
127 275 __entry->comm, __entry->pid, __entry->prio),
128TRACE_EVENT_FORMAT(sched_process_fork, 276
129 TPPROTO(struct task_struct *parent, struct task_struct *child), 277 TP_fast_assign(
130 TPARGS(parent, child), 278 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
131 TPFMT("parent %s:%d child %s:%d", 279 __entry->pid = pid_nr(pid);
132 parent->comm, parent->pid, child->comm, child->pid), 280 __entry->prio = current->prio;
133 TRACE_STRUCT( 281 )
134 TRACE_FIELD(pid_t, parent, parent->pid) 282);
135 TRACE_FIELD(pid_t, child, child->pid) 283
284/*
285 * Tracepoint for do_fork:
286 */
287TRACE_EVENT(sched_process_fork,
288
289 TP_PROTO(struct task_struct *parent, struct task_struct *child),
290
291 TP_ARGS(parent, child),
292
293 TP_STRUCT__entry(
294 __array( char, parent_comm, TASK_COMM_LEN )
295 __field( pid_t, parent_pid )
296 __array( char, child_comm, TASK_COMM_LEN )
297 __field( pid_t, child_pid )
136 ), 298 ),
137 TPRAWFMT("parent %d child %d") 299
138 ); 300 TP_printk("parent %s:%d child %s:%d",
139 301 __entry->parent_comm, __entry->parent_pid,
140TRACE_EVENT_FORMAT(sched_signal_send, 302 __entry->child_comm, __entry->child_pid),
141 TPPROTO(int sig, struct task_struct *p), 303
142 TPARGS(sig, p), 304 TP_fast_assign(
143 TPFMT("sig: %d task %s:%d", sig, p->comm, p->pid), 305 memcpy(__entry->parent_comm, parent->comm, TASK_COMM_LEN);
144 TRACE_STRUCT( 306 __entry->parent_pid = parent->pid;
145 TRACE_FIELD(int, sig, sig) 307 memcpy(__entry->child_comm, child->comm, TASK_COMM_LEN);
146 TRACE_FIELD(pid_t, pid, p->pid) 308 __entry->child_pid = child->pid;
309 )
310);
311
312/*
313 * Tracepoint for sending a signal:
314 */
315TRACE_EVENT(sched_signal_send,
316
317 TP_PROTO(int sig, struct task_struct *p),
318
319 TP_ARGS(sig, p),
320
321 TP_STRUCT__entry(
322 __field( int, sig )
323 __array( char, comm, TASK_COMM_LEN )
324 __field( pid_t, pid )
147 ), 325 ),
148 TPRAWFMT("sig: %d task %d") 326
149 ); 327 TP_printk("sig: %d task %s:%d",
328 __entry->sig, __entry->comm, __entry->pid),
329
330 TP_fast_assign(
331 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
332 __entry->pid = p->pid;
333 __entry->sig = sig;
334 )
335);
150 336
151#undef TRACE_SYSTEM 337#undef TRACE_SYSTEM
diff --git a/include/trace/workqueue.h b/include/trace/workqueue.h
index 867829df4571..7626523deeba 100644
--- a/include/trace/workqueue.h
+++ b/include/trace/workqueue.h
@@ -6,20 +6,20 @@
6#include <linux/sched.h> 6#include <linux/sched.h>
7 7
8DECLARE_TRACE(workqueue_insertion, 8DECLARE_TRACE(workqueue_insertion,
9 TPPROTO(struct task_struct *wq_thread, struct work_struct *work), 9 TP_PROTO(struct task_struct *wq_thread, struct work_struct *work),
10 TPARGS(wq_thread, work)); 10 TP_ARGS(wq_thread, work));
11 11
12DECLARE_TRACE(workqueue_execution, 12DECLARE_TRACE(workqueue_execution,
13 TPPROTO(struct task_struct *wq_thread, struct work_struct *work), 13 TP_PROTO(struct task_struct *wq_thread, struct work_struct *work),
14 TPARGS(wq_thread, work)); 14 TP_ARGS(wq_thread, work));
15 15
16/* Trace the creation of one workqueue thread on a cpu */ 16/* Trace the creation of one workqueue thread on a cpu */
17DECLARE_TRACE(workqueue_creation, 17DECLARE_TRACE(workqueue_creation,
18 TPPROTO(struct task_struct *wq_thread, int cpu), 18 TP_PROTO(struct task_struct *wq_thread, int cpu),
19 TPARGS(wq_thread, cpu)); 19 TP_ARGS(wq_thread, cpu));
20 20
21DECLARE_TRACE(workqueue_destruction, 21DECLARE_TRACE(workqueue_destruction,
22 TPPROTO(struct task_struct *wq_thread), 22 TP_PROTO(struct task_struct *wq_thread),
23 TPARGS(wq_thread)); 23 TP_ARGS(wq_thread));
24 24
25#endif /* __TRACE_WORKQUEUE_H */ 25#endif /* __TRACE_WORKQUEUE_H */
diff --git a/kernel/trace/events.c b/kernel/trace/events.c
index f2509cbaacea..9fc918da404f 100644
--- a/kernel/trace/events.c
+++ b/kernel/trace/events.c
@@ -2,9 +2,7 @@
2 * This is the place to register all trace points as events. 2 * This is the place to register all trace points as events.
3 */ 3 */
4 4
5/* someday this needs to go in a generic header */ 5#include <linux/stringify.h>
6#define __STR(x) #x
7#define STR(x) __STR(x)
8 6
9#include <trace/trace_events.h> 7#include <trace/trace_events.h>
10 8
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 2bfb7d11fc17..c5e1d8865fe4 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -751,12 +751,7 @@ struct ftrace_event_call {
751 int (*regfunc)(void); 751 int (*regfunc)(void);
752 void (*unregfunc)(void); 752 void (*unregfunc)(void);
753 int id; 753 int id;
754 struct dentry *raw_dir;
755 int raw_enabled;
756 int type;
757 int (*raw_init)(void); 754 int (*raw_init)(void);
758 int (*raw_reg)(void);
759 void (*raw_unreg)(void);
760 int (*show_format)(struct trace_seq *s); 755 int (*show_format)(struct trace_seq *s);
761}; 756};
762 757
diff --git a/kernel/trace/trace_event_types.h b/kernel/trace/trace_event_types.h
index fb4eba166433..5cca4c978bde 100644
--- a/kernel/trace/trace_event_types.h
+++ b/kernel/trace/trace_event_types.h
@@ -10,7 +10,7 @@ TRACE_EVENT_FORMAT(function, TRACE_FN, ftrace_entry, ignore,
10 TRACE_FIELD(unsigned long, ip, ip) 10 TRACE_FIELD(unsigned long, ip, ip)
11 TRACE_FIELD(unsigned long, parent_ip, parent_ip) 11 TRACE_FIELD(unsigned long, parent_ip, parent_ip)
12 ), 12 ),
13 TPRAWFMT(" %lx <-- %lx") 13 TP_RAW_FMT(" %lx <-- %lx")
14); 14);
15 15
16TRACE_EVENT_FORMAT(funcgraph_entry, TRACE_GRAPH_ENT, 16TRACE_EVENT_FORMAT(funcgraph_entry, TRACE_GRAPH_ENT,
@@ -19,7 +19,7 @@ TRACE_EVENT_FORMAT(funcgraph_entry, TRACE_GRAPH_ENT,
19 TRACE_FIELD(unsigned long, graph_ent.func, func) 19 TRACE_FIELD(unsigned long, graph_ent.func, func)
20 TRACE_FIELD(int, graph_ent.depth, depth) 20 TRACE_FIELD(int, graph_ent.depth, depth)
21 ), 21 ),
22 TPRAWFMT("--> %lx (%d)") 22 TP_RAW_FMT("--> %lx (%d)")
23); 23);
24 24
25TRACE_EVENT_FORMAT(funcgraph_exit, TRACE_GRAPH_RET, 25TRACE_EVENT_FORMAT(funcgraph_exit, TRACE_GRAPH_RET,
@@ -28,7 +28,7 @@ TRACE_EVENT_FORMAT(funcgraph_exit, TRACE_GRAPH_RET,
28 TRACE_FIELD(unsigned long, ret.func, func) 28 TRACE_FIELD(unsigned long, ret.func, func)
29 TRACE_FIELD(int, ret.depth, depth) 29 TRACE_FIELD(int, ret.depth, depth)
30 ), 30 ),
31 TPRAWFMT("<-- %lx (%d)") 31 TP_RAW_FMT("<-- %lx (%d)")
32); 32);
33 33
34TRACE_EVENT_FORMAT(wakeup, TRACE_WAKE, ctx_switch_entry, ignore, 34TRACE_EVENT_FORMAT(wakeup, TRACE_WAKE, ctx_switch_entry, ignore,
@@ -41,7 +41,7 @@ TRACE_EVENT_FORMAT(wakeup, TRACE_WAKE, ctx_switch_entry, ignore,
41 TRACE_FIELD(unsigned char, next_state, next_state) 41 TRACE_FIELD(unsigned char, next_state, next_state)
42 TRACE_FIELD(unsigned int, next_cpu, next_cpu) 42 TRACE_FIELD(unsigned int, next_cpu, next_cpu)
43 ), 43 ),
44 TPRAWFMT("%u:%u:%u ==+ %u:%u:%u [%03u]") 44 TP_RAW_FMT("%u:%u:%u ==+ %u:%u:%u [%03u]")
45); 45);
46 46
47TRACE_EVENT_FORMAT(context_switch, TRACE_CTX, ctx_switch_entry, ignore, 47TRACE_EVENT_FORMAT(context_switch, TRACE_CTX, ctx_switch_entry, ignore,
@@ -54,7 +54,7 @@ TRACE_EVENT_FORMAT(context_switch, TRACE_CTX, ctx_switch_entry, ignore,
54 TRACE_FIELD(unsigned char, next_state, next_state) 54 TRACE_FIELD(unsigned char, next_state, next_state)
55 TRACE_FIELD(unsigned int, next_cpu, next_cpu) 55 TRACE_FIELD(unsigned int, next_cpu, next_cpu)
56 ), 56 ),
57 TPRAWFMT("%u:%u:%u ==+ %u:%u:%u [%03u]") 57 TP_RAW_FMT("%u:%u:%u ==+ %u:%u:%u [%03u]")
58); 58);
59 59
60TRACE_EVENT_FORMAT(special, TRACE_SPECIAL, special_entry, ignore, 60TRACE_EVENT_FORMAT(special, TRACE_SPECIAL, special_entry, ignore,
@@ -63,7 +63,7 @@ TRACE_EVENT_FORMAT(special, TRACE_SPECIAL, special_entry, ignore,
63 TRACE_FIELD(unsigned long, arg2, arg2) 63 TRACE_FIELD(unsigned long, arg2, arg2)
64 TRACE_FIELD(unsigned long, arg3, arg3) 64 TRACE_FIELD(unsigned long, arg3, arg3)
65 ), 65 ),
66 TPRAWFMT("(%08lx) (%08lx) (%08lx)") 66 TP_RAW_FMT("(%08lx) (%08lx) (%08lx)")
67); 67);
68 68
69/* 69/*
@@ -83,7 +83,7 @@ TRACE_EVENT_FORMAT(kernel_stack, TRACE_STACK, stack_entry, ignore,
83 TRACE_FIELD(unsigned long, caller[6], stack6) 83 TRACE_FIELD(unsigned long, caller[6], stack6)
84 TRACE_FIELD(unsigned long, caller[7], stack7) 84 TRACE_FIELD(unsigned long, caller[7], stack7)
85 ), 85 ),
86 TPRAWFMT("\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n" 86 TP_RAW_FMT("\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n"
87 "\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n") 87 "\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n")
88); 88);
89 89
@@ -98,7 +98,7 @@ TRACE_EVENT_FORMAT(user_stack, TRACE_USER_STACK, userstack_entry, ignore,
98 TRACE_FIELD(unsigned long, caller[6], stack6) 98 TRACE_FIELD(unsigned long, caller[6], stack6)
99 TRACE_FIELD(unsigned long, caller[7], stack7) 99 TRACE_FIELD(unsigned long, caller[7], stack7)
100 ), 100 ),
101 TPRAWFMT("\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n" 101 TP_RAW_FMT("\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n"
102 "\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n") 102 "\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n")
103); 103);
104 104
@@ -106,9 +106,10 @@ TRACE_EVENT_FORMAT(print, TRACE_PRINT, print_entry, ignore,
106 TRACE_STRUCT( 106 TRACE_STRUCT(
107 TRACE_FIELD(unsigned long, ip, ip) 107 TRACE_FIELD(unsigned long, ip, ip)
108 TRACE_FIELD(unsigned int, depth, depth) 108 TRACE_FIELD(unsigned int, depth, depth)
109 TRACE_FIELD(char *, fmt, fmt)
109 TRACE_FIELD_ZERO_CHAR(buf) 110 TRACE_FIELD_ZERO_CHAR(buf)
110 ), 111 ),
111 TPRAWFMT("%08lx (%d) %s") 112 TP_RAW_FMT("%08lx (%d) fmt:%p %s")
112); 113);
113 114
114TRACE_EVENT_FORMAT(branch, TRACE_BRANCH, trace_branch, ignore, 115TRACE_EVENT_FORMAT(branch, TRACE_BRANCH, trace_branch, ignore,
@@ -118,7 +119,7 @@ TRACE_EVENT_FORMAT(branch, TRACE_BRANCH, trace_branch, ignore,
118 TRACE_FIELD_SPECIAL(char file[TRACE_FUNC_SIZE+1], file, file) 119 TRACE_FIELD_SPECIAL(char file[TRACE_FUNC_SIZE+1], file, file)
119 TRACE_FIELD(char, correct, correct) 120 TRACE_FIELD(char, correct, correct)
120 ), 121 ),
121 TPRAWFMT("%u:%s:%s (%u)") 122 TP_RAW_FMT("%u:%s:%s (%u)")
122); 123);
123 124
124TRACE_EVENT_FORMAT(hw_branch, TRACE_HW_BRANCHES, hw_branch_entry, ignore, 125TRACE_EVENT_FORMAT(hw_branch, TRACE_HW_BRANCHES, hw_branch_entry, ignore,
@@ -126,7 +127,7 @@ TRACE_EVENT_FORMAT(hw_branch, TRACE_HW_BRANCHES, hw_branch_entry, ignore,
126 TRACE_FIELD(u64, from, from) 127 TRACE_FIELD(u64, from, from)
127 TRACE_FIELD(u64, to, to) 128 TRACE_FIELD(u64, to, to)
128 ), 129 ),
129 TPRAWFMT("from: %llx to: %llx") 130 TP_RAW_FMT("from: %llx to: %llx")
130); 131);
131 132
132TRACE_EVENT_FORMAT(power, TRACE_POWER, trace_power, ignore, 133TRACE_EVENT_FORMAT(power, TRACE_POWER, trace_power, ignore,
@@ -136,7 +137,7 @@ TRACE_EVENT_FORMAT(power, TRACE_POWER, trace_power, ignore,
136 TRACE_FIELD(int, state_data.type, type) 137 TRACE_FIELD(int, state_data.type, type)
137 TRACE_FIELD(int, state_data.state, state) 138 TRACE_FIELD(int, state_data.state, state)
138 ), 139 ),
139 TPRAWFMT("%llx->%llx type:%u state:%u") 140 TP_RAW_FMT("%llx->%llx type:%u state:%u")
140); 141);
141 142
142TRACE_EVENT_FORMAT(kmem_alloc, TRACE_KMEM_ALLOC, kmemtrace_alloc_entry, ignore, 143TRACE_EVENT_FORMAT(kmem_alloc, TRACE_KMEM_ALLOC, kmemtrace_alloc_entry, ignore,
@@ -149,7 +150,7 @@ TRACE_EVENT_FORMAT(kmem_alloc, TRACE_KMEM_ALLOC, kmemtrace_alloc_entry, ignore,
149 TRACE_FIELD(gfp_t, gfp_flags, gfp_flags) 150 TRACE_FIELD(gfp_t, gfp_flags, gfp_flags)
150 TRACE_FIELD(int, node, node) 151 TRACE_FIELD(int, node, node)
151 ), 152 ),
152 TPRAWFMT("type:%u call_site:%lx ptr:%p req:%lu alloc:%lu" 153 TP_RAW_FMT("type:%u call_site:%lx ptr:%p req:%lu alloc:%lu"
153 " flags:%x node:%d") 154 " flags:%x node:%d")
154); 155);
155 156
@@ -159,7 +160,7 @@ TRACE_EVENT_FORMAT(kmem_free, TRACE_KMEM_FREE, kmemtrace_free_entry, ignore,
159 TRACE_FIELD(unsigned long, call_site, call_site) 160 TRACE_FIELD(unsigned long, call_site, call_site)
160 TRACE_FIELD(const void *, ptr, ptr) 161 TRACE_FIELD(const void *, ptr, ptr)
161 ), 162 ),
162 TPRAWFMT("type:%u call_site:%lx ptr:%p") 163 TP_RAW_FMT("type:%u call_site:%lx ptr:%p")
163); 164);
164 165
165#undef TRACE_SYSTEM 166#undef TRACE_SYSTEM
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 4488d90e75ef..1880a6438097 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -59,22 +59,12 @@ static void ftrace_event_enable_disable(struct ftrace_event_call *call,
59 call->enabled = 0; 59 call->enabled = 0;
60 call->unregfunc(); 60 call->unregfunc();
61 } 61 }
62 if (call->raw_enabled) {
63 call->raw_enabled = 0;
64 call->raw_unreg();
65 }
66 break; 62 break;
67 case 1: 63 case 1:
68 if (!call->enabled && 64 if (!call->enabled) {
69 (call->type & TRACE_EVENT_TYPE_PRINTF)) {
70 call->enabled = 1; 65 call->enabled = 1;
71 call->regfunc(); 66 call->regfunc();
72 } 67 }
73 if (!call->raw_enabled &&
74 (call->type & TRACE_EVENT_TYPE_RAW)) {
75 call->raw_enabled = 1;
76 call->raw_reg();
77 }
78 break; 68 break;
79 } 69 }
80} 70}
@@ -300,7 +290,7 @@ event_enable_read(struct file *filp, char __user *ubuf, size_t cnt,
300 struct ftrace_event_call *call = filp->private_data; 290 struct ftrace_event_call *call = filp->private_data;
301 char *buf; 291 char *buf;
302 292
303 if (call->enabled || call->raw_enabled) 293 if (call->enabled)
304 buf = "1\n"; 294 buf = "1\n";
305 else 295 else
306 buf = "0\n"; 296 buf = "0\n";
@@ -346,110 +336,10 @@ event_enable_write(struct file *filp, const char __user *ubuf, size_t cnt,
346 return cnt; 336 return cnt;
347} 337}
348 338
349static ssize_t
350event_type_read(struct file *filp, char __user *ubuf, size_t cnt,
351 loff_t *ppos)
352{
353 struct ftrace_event_call *call = filp->private_data;
354 char buf[16];
355 int r = 0;
356
357 if (call->type & TRACE_EVENT_TYPE_PRINTF)
358 r += sprintf(buf, "printf\n");
359
360 if (call->type & TRACE_EVENT_TYPE_RAW)
361 r += sprintf(buf+r, "raw\n");
362
363 return simple_read_from_buffer(ubuf, cnt, ppos, buf, r);
364}
365
366static ssize_t
367event_type_write(struct file *filp, const char __user *ubuf, size_t cnt,
368 loff_t *ppos)
369{
370 struct ftrace_event_call *call = filp->private_data;
371 char buf[64];
372
373 /*
374 * If there's only one type, we can't change it.
375 * And currently we always have printf type, and we
376 * may or may not have raw type.
377 *
378 * This is a redundant check, the file should be read
379 * only if this is the case anyway.
380 */
381
382 if (!call->raw_init)
383 return -EPERM;
384
385 if (cnt >= sizeof(buf))
386 return -EINVAL;
387
388 if (copy_from_user(&buf, ubuf, cnt))
389 return -EFAULT;
390
391 buf[cnt] = 0;
392
393 if (!strncmp(buf, "printf", 6) &&
394 (!buf[6] || isspace(buf[6]))) {
395
396 call->type = TRACE_EVENT_TYPE_PRINTF;
397
398 /*
399 * If raw enabled, the disable it and enable
400 * printf type.
401 */
402 if (call->raw_enabled) {
403 call->raw_enabled = 0;
404 call->raw_unreg();
405
406 call->enabled = 1;
407 call->regfunc();
408 }
409
410 } else if (!strncmp(buf, "raw", 3) &&
411 (!buf[3] || isspace(buf[3]))) {
412
413 call->type = TRACE_EVENT_TYPE_RAW;
414
415 /*
416 * If printf enabled, the disable it and enable
417 * raw type.
418 */
419 if (call->enabled) {
420 call->enabled = 0;
421 call->unregfunc();
422
423 call->raw_enabled = 1;
424 call->raw_reg();
425 }
426 } else
427 return -EINVAL;
428
429 *ppos += cnt;
430
431 return cnt;
432}
433
434static ssize_t
435event_available_types_read(struct file *filp, char __user *ubuf, size_t cnt,
436 loff_t *ppos)
437{
438 struct ftrace_event_call *call = filp->private_data;
439 char buf[16];
440 int r = 0;
441
442 r += sprintf(buf, "printf\n");
443
444 if (call->raw_init)
445 r += sprintf(buf+r, "raw\n");
446
447 return simple_read_from_buffer(ubuf, cnt, ppos, buf, r);
448}
449
450#undef FIELD 339#undef FIELD
451#define FIELD(type, name) \ 340#define FIELD(type, name) \
452 #type, #name, offsetof(typeof(field), name), sizeof(field.name) 341 #type, #name, (unsigned int)offsetof(typeof(field), name), \
342 (unsigned int)sizeof(field.name)
453 343
454static int trace_write_header(struct trace_seq *s) 344static int trace_write_header(struct trace_seq *s)
455{ 345{
@@ -457,11 +347,11 @@ static int trace_write_header(struct trace_seq *s)
457 347
458 /* struct trace_entry */ 348 /* struct trace_entry */
459 return trace_seq_printf(s, 349 return trace_seq_printf(s,
460 "\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" 350 "\tfield:%s %s;\toffset:%u;\tsize:%u;\n"
461 "\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" 351 "\tfield:%s %s;\toffset:%u;\tsize:%u;\n"
462 "\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" 352 "\tfield:%s %s;\toffset:%u;\tsize:%u;\n"
463 "\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" 353 "\tfield:%s %s;\toffset:%u;\tsize:%u;\n"
464 "\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" 354 "\tfield:%s %s;\toffset:%u;\tsize:%u;\n"
465 "\n", 355 "\n",
466 FIELD(unsigned char, type), 356 FIELD(unsigned char, type),
467 FIELD(unsigned char, flags), 357 FIELD(unsigned char, flags),
@@ -469,6 +359,7 @@ static int trace_write_header(struct trace_seq *s)
469 FIELD(int, pid), 359 FIELD(int, pid),
470 FIELD(int, tgid)); 360 FIELD(int, tgid));
471} 361}
362
472static ssize_t 363static ssize_t
473event_format_read(struct file *filp, char __user *ubuf, size_t cnt, 364event_format_read(struct file *filp, char __user *ubuf, size_t cnt,
474 loff_t *ppos) 365 loff_t *ppos)
@@ -526,13 +417,6 @@ static const struct seq_operations show_set_event_seq_ops = {
526 .stop = t_stop, 417 .stop = t_stop,
527}; 418};
528 419
529static const struct file_operations ftrace_avail_fops = {
530 .open = ftrace_event_seq_open,
531 .read = seq_read,
532 .llseek = seq_lseek,
533 .release = seq_release,
534};
535
536static const struct file_operations ftrace_set_event_fops = { 420static const struct file_operations ftrace_set_event_fops = {
537 .open = ftrace_event_seq_open, 421 .open = ftrace_event_seq_open,
538 .read = seq_read, 422 .read = seq_read,
@@ -547,17 +431,6 @@ static const struct file_operations ftrace_enable_fops = {
547 .write = event_enable_write, 431 .write = event_enable_write,
548}; 432};
549 433
550static const struct file_operations ftrace_type_fops = {
551 .open = tracing_open_generic,
552 .read = event_type_read,
553 .write = event_type_write,
554};
555
556static const struct file_operations ftrace_available_types_fops = {
557 .open = tracing_open_generic,
558 .read = event_available_types_read,
559};
560
561static const struct file_operations ftrace_event_format_fops = { 434static const struct file_operations ftrace_event_format_fops = {
562 .open = tracing_open_generic, 435 .open = tracing_open_generic,
563 .read = event_format_read, 436 .read = event_format_read,
@@ -646,9 +519,6 @@ event_create_dir(struct ftrace_event_call *call, struct dentry *d_events)
646 } 519 }
647 } 520 }
648 521
649 /* default the output to printf */
650 call->type = TRACE_EVENT_TYPE_PRINTF;
651
652 call->dir = debugfs_create_dir(call->name, d_events); 522 call->dir = debugfs_create_dir(call->name, d_events);
653 if (!call->dir) { 523 if (!call->dir) {
654 pr_warning("Could not create debugfs " 524 pr_warning("Could not create debugfs "
@@ -664,21 +534,6 @@ event_create_dir(struct ftrace_event_call *call, struct dentry *d_events)
664 "'%s/enable' entry\n", call->name); 534 "'%s/enable' entry\n", call->name);
665 } 535 }
666 536
667 /* Only let type be writable, if we can change it */
668 entry = debugfs_create_file("type",
669 call->raw_init ? 0644 : 0444,
670 call->dir, call,
671 &ftrace_type_fops);
672 if (!entry)
673 pr_warning("Could not create debugfs "
674 "'%s/type' entry\n", call->name);
675
676 entry = debugfs_create_file("available_types", 0444, call->dir, call,
677 &ftrace_available_types_fops);
678 if (!entry)
679 pr_warning("Could not create debugfs "
680 "'%s/available_types' entry\n", call->name);
681
682 /* A trace may not want to export its format */ 537 /* A trace may not want to export its format */
683 if (!call->show_format) 538 if (!call->show_format)
684 return 0; 539 return 0;
@@ -703,13 +558,6 @@ static __init int event_trace_init(void)
703 if (!d_tracer) 558 if (!d_tracer)
704 return 0; 559 return 0;
705 560
706 entry = debugfs_create_file("available_events", 0444, d_tracer,
707 (void *)&show_event_seq_ops,
708 &ftrace_avail_fops);
709 if (!entry)
710 pr_warning("Could not create debugfs "
711 "'available_events' entry\n");
712
713 entry = debugfs_create_file("set_event", 0644, d_tracer, 561 entry = debugfs_create_file("set_event", 0644, d_tracer,
714 (void *)&show_set_event_seq_ops, 562 (void *)&show_set_event_seq_ops,
715 &ftrace_set_event_fops); 563 &ftrace_set_event_fops);
diff --git a/kernel/trace/trace_events_stage_1.h b/kernel/trace/trace_events_stage_1.h
index 3830a731424c..15e9bf965a18 100644
--- a/kernel/trace/trace_events_stage_1.h
+++ b/kernel/trace/trace_events_stage_1.h
@@ -17,20 +17,21 @@
17#undef TRACE_FORMAT 17#undef TRACE_FORMAT
18#define TRACE_FORMAT(call, proto, args, fmt) 18#define TRACE_FORMAT(call, proto, args, fmt)
19 19
20#undef TRACE_EVENT_FORMAT 20#undef __array
21#define TRACE_EVENT_FORMAT(name, proto, args, fmt, tstruct, tpfmt) \ 21#define __array(type, item, len) type item[len];
22 struct ftrace_raw_##name { \ 22
23 struct trace_entry ent; \ 23#undef __field
24 tstruct \ 24#define __field(type, item) type item;
25 }; \
26 static struct ftrace_event_call event_##name
27 25
28#undef TRACE_STRUCT 26#undef TP_STRUCT__entry
29#define TRACE_STRUCT(args...) args 27#define TP_STRUCT__entry(args...) args
30 28
31#define TRACE_FIELD(type, item, assign) \ 29#undef TRACE_EVENT
32 type item; 30#define TRACE_EVENT(name, proto, args, tstruct, print, assign) \
33#define TRACE_FIELD_SPECIAL(type_item, item, cmd) \ 31 struct ftrace_raw_##name { \
34 type_item; 32 struct trace_entry ent; \
33 tstruct \
34 }; \
35 static struct ftrace_event_call event_##name
35 36
36#include <trace/trace_event_types.h> 37#include <trace/trace_event_types.h>
diff --git a/kernel/trace/trace_events_stage_2.h b/kernel/trace/trace_events_stage_2.h
index d24a97e74aea..d91bf4c56661 100644
--- a/kernel/trace/trace_events_stage_2.h
+++ b/kernel/trace/trace_events_stage_2.h
@@ -20,7 +20,7 @@
20 * 20 *
21 * field = (typeof(field))entry; 21 * field = (typeof(field))entry;
22 * 22 *
23 * ret = trace_seq_printf(s, <TPRAWFMT> "%s", <ARGS> "\n"); 23 * ret = trace_seq_printf(s, <TP_RAW_FMT> "%s", <ARGS> "\n");
24 * if (!ret) 24 * if (!ret)
25 * return TRACE_TYPE_PARTIAL_LINE; 25 * return TRACE_TYPE_PARTIAL_LINE;
26 * 26 *
@@ -32,23 +32,14 @@
32 * in binary. 32 * in binary.
33 */ 33 */
34 34
35#undef TRACE_STRUCT 35#undef __entry
36#define TRACE_STRUCT(args...) args 36#define __entry field
37 37
38#undef TRACE_FIELD 38#undef TP_printk
39#define TRACE_FIELD(type, item, assign) \ 39#define TP_printk(fmt, args...) fmt "\n", args
40 field->item,
41 40
42#undef TRACE_FIELD_SPECIAL 41#undef TRACE_EVENT
43#define TRACE_FIELD_SPECIAL(type_item, item, cmd) \ 42#define TRACE_EVENT(call, proto, args, tstruct, print, assign) \
44 field->item,
45
46
47#undef TPRAWFMT
48#define TPRAWFMT(args...) args
49
50#undef TRACE_EVENT_FORMAT
51#define TRACE_EVENT_FORMAT(call, proto, args, fmt, tstruct, tpfmt) \
52enum print_line_t \ 43enum print_line_t \
53ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \ 44ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \
54{ \ 45{ \
@@ -66,14 +57,76 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \
66 \ 57 \
67 field = (typeof(field))entry; \ 58 field = (typeof(field))entry; \
68 \ 59 \
69 ret = trace_seq_printf(s, tpfmt "%s", tstruct "\n"); \ 60 ret = trace_seq_printf(s, print); \
70 if (!ret) \ 61 if (!ret) \
71 return TRACE_TYPE_PARTIAL_LINE; \ 62 return TRACE_TYPE_PARTIAL_LINE; \
72 \ 63 \
73 return TRACE_TYPE_HANDLED; \ 64 return TRACE_TYPE_HANDLED; \
74} 65}
75 66
76#include <trace/trace_event_types.h> 67#include <trace/trace_event_types.h>
77 68
78#include "trace_format.h" 69/*
70 * Setup the showing format of trace point.
71 *
72 * int
73 * ftrace_format_##call(struct trace_seq *s)
74 * {
75 * struct ftrace_raw_##call field;
76 * int ret;
77 *
78 * ret = trace_seq_printf(s, #type " " #item ";"
79 * " size:%d; offset:%d;\n",
80 * sizeof(field.type),
81 * offsetof(struct ftrace_raw_##call,
82 * item));
83 *
84 * }
85 */
86
87#undef TP_STRUCT__entry
88#define TP_STRUCT__entry(args...) args
89
90#undef __field
91#define __field(type, item) \
92 ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \
93 "offset:%u;\tsize:%u;\n", \
94 (unsigned int)offsetof(typeof(field), item), \
95 (unsigned int)sizeof(field.item)); \
96 if (!ret) \
97 return 0;
98
99#undef __array
100#define __array(type, item, len) \
101 ret = trace_seq_printf(s, "\tfield:" #type " " #item "[" #len "];\t" \
102 "offset:%u;\tsize:%u;\n", \
103 (unsigned int)offsetof(typeof(field), item), \
104 (unsigned int)sizeof(field.item)); \
105 if (!ret) \
106 return 0;
107
108#undef __entry
109#define __entry "REC"
110
111#undef TP_printk
112#define TP_printk(fmt, args...) "%s, %s\n", #fmt, #args
113
114#undef TP_fast_assign
115#define TP_fast_assign(args...) args
116
117#undef TRACE_EVENT
118#define TRACE_EVENT(call, proto, args, tstruct, print, func) \
119static int \
120ftrace_format_##call(struct trace_seq *s) \
121{ \
122 struct ftrace_raw_##call field; \
123 int ret; \
124 \
125 tstruct; \
126 \
127 trace_seq_printf(s, "\nprint fmt: " print); \
128 \
129 return ret; \
130}
131
79#include <trace/trace_event_types.h> 132#include <trace/trace_event_types.h>
diff --git a/kernel/trace/trace_events_stage_3.h b/kernel/trace/trace_events_stage_3.h
index 2c8d76c7dbed..3ba55d4ab073 100644
--- a/kernel/trace/trace_events_stage_3.h
+++ b/kernel/trace/trace_events_stage_3.h
@@ -35,7 +35,7 @@
35 * } 35 * }
36 * 36 *
37 * 37 *
38 * For those macros defined with TRACE_EVENT_FORMAT: 38 * For those macros defined with TRACE_EVENT:
39 * 39 *
40 * static struct ftrace_event_call event_<call>; 40 * static struct ftrace_event_call event_<call>;
41 * 41 *
@@ -106,8 +106,8 @@
106 * 106 *
107 */ 107 */
108 108
109#undef TPFMT 109#undef TP_FMT
110#define TPFMT(fmt, args...) fmt "\n", ##args 110#define TP_FMT(fmt, args...) fmt "\n", ##args
111 111
112#define _TRACE_FORMAT(call, proto, args, fmt) \ 112#define _TRACE_FORMAT(call, proto, args, fmt) \
113static void ftrace_event_##call(proto) \ 113static void ftrace_event_##call(proto) \
@@ -139,32 +139,16 @@ static struct ftrace_event_call __used \
139__attribute__((__aligned__(4))) \ 139__attribute__((__aligned__(4))) \
140__attribute__((section("_ftrace_events"))) event_##call = { \ 140__attribute__((section("_ftrace_events"))) event_##call = { \
141 .name = #call, \ 141 .name = #call, \
142 .system = STR(TRACE_SYSTEM), \ 142 .system = __stringify(TRACE_SYSTEM), \
143 .regfunc = ftrace_reg_event_##call, \ 143 .regfunc = ftrace_reg_event_##call, \
144 .unregfunc = ftrace_unreg_event_##call, \ 144 .unregfunc = ftrace_unreg_event_##call, \
145} 145}
146 146
147#undef TRACE_FIELD 147#undef __entry
148#define TRACE_FIELD(type, item, assign)\ 148#define __entry entry
149 entry->item = assign;
150 149
151#undef TRACE_FIELD 150#undef TRACE_EVENT
152#define TRACE_FIELD(type, item, assign)\ 151#define TRACE_EVENT(call, proto, args, tstruct, print, assign) \
153 entry->item = assign;
154
155#undef TPCMD
156#define TPCMD(cmd...) cmd
157
158#undef TRACE_ENTRY
159#define TRACE_ENTRY entry
160
161#undef TRACE_FIELD_SPECIAL
162#define TRACE_FIELD_SPECIAL(type_item, item, cmd) \
163 cmd;
164
165#undef TRACE_EVENT_FORMAT
166#define TRACE_EVENT_FORMAT(call, proto, args, fmt, tstruct, tpfmt) \
167_TRACE_FORMAT(call, PARAMS(proto), PARAMS(args), PARAMS(fmt)) \
168 \ 152 \
169static struct ftrace_event_call event_##call; \ 153static struct ftrace_event_call event_##call; \
170 \ 154 \
@@ -185,7 +169,7 @@ static void ftrace_raw_event_##call(proto) \
185 return; \ 169 return; \
186 entry = ring_buffer_event_data(event); \ 170 entry = ring_buffer_event_data(event); \
187 \ 171 \
188 tstruct; \ 172 assign; \
189 \ 173 \
190 trace_current_buffer_unlock_commit(event, irq_flags, pc); \ 174 trace_current_buffer_unlock_commit(event, irq_flags, pc); \
191} \ 175} \
@@ -225,11 +209,9 @@ static struct ftrace_event_call __used \
225__attribute__((__aligned__(4))) \ 209__attribute__((__aligned__(4))) \
226__attribute__((section("_ftrace_events"))) event_##call = { \ 210__attribute__((section("_ftrace_events"))) event_##call = { \
227 .name = #call, \ 211 .name = #call, \
228 .system = STR(TRACE_SYSTEM), \ 212 .system = __stringify(TRACE_SYSTEM), \
229 .regfunc = ftrace_reg_event_##call, \
230 .unregfunc = ftrace_unreg_event_##call, \
231 .raw_init = ftrace_raw_init_event_##call, \ 213 .raw_init = ftrace_raw_init_event_##call, \
232 .raw_reg = ftrace_raw_reg_event_##call, \ 214 .regfunc = ftrace_raw_reg_event_##call, \
233 .raw_unreg = ftrace_raw_unreg_event_##call, \ 215 .unregfunc = ftrace_raw_unreg_event_##call, \
234 .show_format = ftrace_format_##call, \ 216 .show_format = ftrace_format_##call, \
235} 217}
diff --git a/kernel/trace/trace_export.c b/kernel/trace/trace_export.c
index 0fb7be73e31c..23ae78430d58 100644
--- a/kernel/trace/trace_export.c
+++ b/kernel/trace/trace_export.c
@@ -15,19 +15,40 @@
15 15
16#include "trace_output.h" 16#include "trace_output.h"
17 17
18#include "trace_format.h" 18
19#undef TRACE_STRUCT
20#define TRACE_STRUCT(args...) args
21
22#undef TRACE_FIELD
23#define TRACE_FIELD(type, item, assign) \
24 ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \
25 "offset:%u;\tsize:%u;\n", \
26 (unsigned int)offsetof(typeof(field), item), \
27 (unsigned int)sizeof(field.item)); \
28 if (!ret) \
29 return 0;
30
31
32#undef TRACE_FIELD_SPECIAL
33#define TRACE_FIELD_SPECIAL(type_item, item, cmd) \
34 ret = trace_seq_printf(s, "\tfield special:" #type_item ";\t" \
35 "offset:%u;\tsize:%u;\n", \
36 (unsigned int)offsetof(typeof(field), item), \
37 (unsigned int)sizeof(field.item)); \
38 if (!ret) \
39 return 0;
19 40
20#undef TRACE_FIELD_ZERO_CHAR 41#undef TRACE_FIELD_ZERO_CHAR
21#define TRACE_FIELD_ZERO_CHAR(item) \ 42#define TRACE_FIELD_ZERO_CHAR(item) \
22 ret = trace_seq_printf(s, "\tfield: char " #item ";\t" \ 43 ret = trace_seq_printf(s, "\tfield: char " #item ";\t" \
23 "offset:%lu;\tsize:0;\n", \ 44 "offset:%u;\tsize:0;\n", \
24 offsetof(typeof(field), item)); \ 45 (unsigned int)offsetof(typeof(field), item)); \
25 if (!ret) \ 46 if (!ret) \
26 return 0; 47 return 0;
27 48
28 49
29#undef TPRAWFMT 50#undef TP_RAW_FMT
30#define TPRAWFMT(args...) args 51#define TP_RAW_FMT(args...) args
31 52
32#undef TRACE_EVENT_FORMAT 53#undef TRACE_EVENT_FORMAT
33#define TRACE_EVENT_FORMAT(call, proto, args, fmt, tstruct, tpfmt) \ 54#define TRACE_EVENT_FORMAT(call, proto, args, fmt, tstruct, tpfmt) \
@@ -57,8 +78,8 @@ ftrace_format_##call(struct trace_seq *s) \
57#define TRACE_FIELD(type, item, assign)\ 78#define TRACE_FIELD(type, item, assign)\
58 entry->item = assign; 79 entry->item = assign;
59 80
60#undef TPCMD 81#undef TP_CMD
61#define TPCMD(cmd...) cmd 82#define TP_CMD(cmd...) cmd
62 83
63#undef TRACE_ENTRY 84#undef TRACE_ENTRY
64#define TRACE_ENTRY entry 85#define TRACE_ENTRY entry
diff --git a/kernel/trace/trace_format.h b/kernel/trace/trace_format.h
deleted file mode 100644
index 03f9a4c165ca..000000000000
--- a/kernel/trace/trace_format.h
+++ /dev/null
@@ -1,55 +0,0 @@
1/*
2 * Setup the showing format of trace point.
3 *
4 * int
5 * ftrace_format_##call(struct trace_seq *s)
6 * {
7 * struct ftrace_raw_##call field;
8 * int ret;
9 *
10 * ret = trace_seq_printf(s, #type " " #item ";"
11 * " size:%d; offset:%d;\n",
12 * sizeof(field.type),
13 * offsetof(struct ftrace_raw_##call,
14 * item));
15 *
16 * }
17 */
18
19#undef TRACE_STRUCT
20#define TRACE_STRUCT(args...) args
21
22#undef TRACE_FIELD
23#define TRACE_FIELD(type, item, assign) \
24 ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \
25 "offset:%lu;\tsize:%lu;\n", \
26 offsetof(typeof(field), item), \
27 sizeof(field.item)); \
28 if (!ret) \
29 return 0;
30
31
32#undef TRACE_FIELD_SPECIAL
33#define TRACE_FIELD_SPECIAL(type_item, item, cmd) \
34 ret = trace_seq_printf(s, "\tfield special:" #type_item ";\t" \
35 "offset:%lu;\tsize:%lu;\n", \
36 offsetof(typeof(field), item), \
37 sizeof(field.item)); \
38 if (!ret) \
39 return 0;
40
41#undef TRACE_EVENT_FORMAT
42#define TRACE_EVENT_FORMAT(call, proto, args, fmt, tstruct, tpfmt) \
43static int \
44ftrace_format_##call(struct trace_seq *s) \
45{ \
46 struct ftrace_raw_##call field; \
47 int ret; \
48 \
49 tstruct; \
50 \
51 trace_seq_printf(s, "\nprint fmt: \"%s\"\n", tpfmt); \
52 \
53 return ret; \
54}
55
diff --git a/kernel/trace/trace_selftest.c b/kernel/trace/trace_selftest.c
index 7238646b8723..f907a2b29028 100644
--- a/kernel/trace/trace_selftest.c
+++ b/kernel/trace/trace_selftest.c
@@ -1,5 +1,6 @@
1/* Include in trace.c */ 1/* Include in trace.c */
2 2
3#include <linux/stringify.h>
3#include <linux/kthread.h> 4#include <linux/kthread.h>
4#include <linux/delay.h> 5#include <linux/delay.h>
5 6
@@ -100,9 +101,6 @@ static inline void warn_failed_init_tracer(struct tracer *trace, int init_ret)
100 101
101#ifdef CONFIG_DYNAMIC_FTRACE 102#ifdef CONFIG_DYNAMIC_FTRACE
102 103
103#define __STR(x) #x
104#define STR(x) __STR(x)
105
106/* Test dynamic code modification and ftrace filters */ 104/* Test dynamic code modification and ftrace filters */
107int trace_selftest_startup_dynamic_tracing(struct tracer *trace, 105int trace_selftest_startup_dynamic_tracing(struct tracer *trace,
108 struct trace_array *tr, 106 struct trace_array *tr,
@@ -130,7 +128,7 @@ int trace_selftest_startup_dynamic_tracing(struct tracer *trace,
130 * start of the function names. We simply put a '*' to 128 * start of the function names. We simply put a '*' to
131 * accommodate them. 129 * accommodate them.
132 */ 130 */
133 func_name = "*" STR(DYN_FTRACE_TEST_NAME); 131 func_name = "*" __stringify(DYN_FTRACE_TEST_NAME);
134 132
135 /* filter only on our function */ 133 /* filter only on our function */
136 ftrace_set_filter(func_name, strlen(func_name), 1); 134 ftrace_set_filter(func_name, strlen(func_name), 1);
diff --git a/samples/tracepoints/tp-samples-trace.h b/samples/tracepoints/tp-samples-trace.h
index 01724e04c556..dffdc49878af 100644
--- a/samples/tracepoints/tp-samples-trace.h
+++ b/samples/tracepoints/tp-samples-trace.h
@@ -5,9 +5,9 @@
5#include <linux/tracepoint.h> 5#include <linux/tracepoint.h>
6 6
7DECLARE_TRACE(subsys_event, 7DECLARE_TRACE(subsys_event,
8 TPPROTO(struct inode *inode, struct file *file), 8 TP_PROTO(struct inode *inode, struct file *file),
9 TPARGS(inode, file)); 9 TP_ARGS(inode, file));
10DECLARE_TRACE(subsys_eventb, 10DECLARE_TRACE(subsys_eventb,
11 TPPROTO(void), 11 TP_PROTO(void),
12 TPARGS()); 12 TP_ARGS());
13#endif 13#endif