diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-03-10 04:57:16 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-03-10 04:57:16 -0400 |
commit | 9a1043d19c4edc4ff1d80081a39809a506a62e4d (patch) | |
tree | a8ba7bdb2ebe8e486f018d55969727abf14e7e33 /kernel | |
parent | 12e87e36e0141c08dbc8b2177c93c75fb18ad7e5 (diff) | |
parent | 157587d7ac555458da9f682e3250135e468470a6 (diff) |
Merge branch 'tip/tracing/ftrace' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into tracing/ftrace
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/trace/events.c | 4 | ||||
-rw-r--r-- | kernel/trace/trace.h | 5 | ||||
-rw-r--r-- | kernel/trace/trace_event_types.h | 29 | ||||
-rw-r--r-- | kernel/trace/trace_events.c | 174 | ||||
-rw-r--r-- | kernel/trace/trace_events_stage_1.h | 27 | ||||
-rw-r--r-- | kernel/trace/trace_events_stage_2.h | 91 | ||||
-rw-r--r-- | kernel/trace/trace_events_stage_3.h | 42 | ||||
-rw-r--r-- | kernel/trace/trace_export.c | 41 | ||||
-rw-r--r-- | kernel/trace/trace_format.h | 55 | ||||
-rw-r--r-- | kernel/trace/trace_selftest.c | 6 |
10 files changed, 158 insertions, 316 deletions
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 | ||
16 | TRACE_EVENT_FORMAT(funcgraph_entry, TRACE_GRAPH_ENT, | 16 | TRACE_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 | ||
25 | TRACE_EVENT_FORMAT(funcgraph_exit, TRACE_GRAPH_RET, | 25 | TRACE_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 | ||
34 | TRACE_EVENT_FORMAT(wakeup, TRACE_WAKE, ctx_switch_entry, ignore, | 34 | TRACE_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 | ||
47 | TRACE_EVENT_FORMAT(context_switch, TRACE_CTX, ctx_switch_entry, ignore, | 47 | TRACE_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 | ||
60 | TRACE_EVENT_FORMAT(special, TRACE_SPECIAL, special_entry, ignore, | 60 | TRACE_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 | ||
114 | TRACE_EVENT_FORMAT(branch, TRACE_BRANCH, trace_branch, ignore, | 115 | TRACE_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 | ||
124 | TRACE_EVENT_FORMAT(hw_branch, TRACE_HW_BRANCHES, hw_branch_entry, ignore, | 125 | TRACE_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 | ||
132 | TRACE_EVENT_FORMAT(power, TRACE_POWER, trace_power, ignore, | 133 | TRACE_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 | ||
142 | TRACE_EVENT_FORMAT(kmem_alloc, TRACE_KMEM_ALLOC, kmemtrace_alloc_entry, ignore, | 143 | TRACE_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 | ||
349 | static ssize_t | ||
350 | event_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 | |||
366 | static ssize_t | ||
367 | event_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 | |||
434 | static ssize_t | ||
435 | event_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 | ||
454 | static int trace_write_header(struct trace_seq *s) | 344 | static 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 | |||
472 | static ssize_t | 363 | static ssize_t |
473 | event_format_read(struct file *filp, char __user *ubuf, size_t cnt, | 364 | event_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 | ||
529 | static 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 | |||
536 | static const struct file_operations ftrace_set_event_fops = { | 420 | static 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 | ||
550 | static const struct file_operations ftrace_type_fops = { | ||
551 | .open = tracing_open_generic, | ||
552 | .read = event_type_read, | ||
553 | .write = event_type_write, | ||
554 | }; | ||
555 | |||
556 | static const struct file_operations ftrace_available_types_fops = { | ||
557 | .open = tracing_open_generic, | ||
558 | .read = event_available_types_read, | ||
559 | }; | ||
560 | |||
561 | static const struct file_operations ftrace_event_format_fops = { | 434 | static 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) \ | ||
52 | enum print_line_t \ | 43 | enum print_line_t \ |
53 | ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \ | 44 | ftrace_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) \ | ||
119 | static int \ | ||
120 | ftrace_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) \ |
113 | static void ftrace_event_##call(proto) \ | 113 | static 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 | \ |
169 | static struct ftrace_event_call event_##call; \ | 153 | static 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) \ | ||
43 | static int \ | ||
44 | ftrace_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 */ |
107 | int trace_selftest_startup_dynamic_tracing(struct tracer *trace, | 105 | int 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); |