aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2011-02-04 13:02:53 -0500
committerIngo Molnar <mingo@elte.hu>2011-02-04 13:02:53 -0500
commit862b6f62bf0cd768910b087f6d051f420206c4d6 (patch)
treef646e5246679ca851baf54e888c0d59b66ecf324 /include
parent1ebdfa803dc5ced604ebadd26fcb8cdca8e09b85 (diff)
parent3d56e331b6537671c66f1b510bed0f1e0331dfc8 (diff)
Merge branch 'tip/perf/urgent-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into perf/urgent
Diffstat (limited to 'include')
-rw-r--r--include/asm-generic/vmlinux.lds.h24
-rw-r--r--include/linux/module.h4
-rw-r--r--include/linux/syscalls.h28
-rw-r--r--include/linux/tracepoint.h35
-rw-r--r--include/trace/ftrace.h24
5 files changed, 62 insertions, 53 deletions
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 6ebb81030d2d..fe77e3395b40 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -124,7 +124,8 @@
124#endif 124#endif
125 125
126#ifdef CONFIG_EVENT_TRACING 126#ifdef CONFIG_EVENT_TRACING
127#define FTRACE_EVENTS() VMLINUX_SYMBOL(__start_ftrace_events) = .; \ 127#define FTRACE_EVENTS() . = ALIGN(8); \
128 VMLINUX_SYMBOL(__start_ftrace_events) = .; \
128 *(_ftrace_events) \ 129 *(_ftrace_events) \
129 VMLINUX_SYMBOL(__stop_ftrace_events) = .; 130 VMLINUX_SYMBOL(__stop_ftrace_events) = .;
130#else 131#else
@@ -140,7 +141,8 @@
140#endif 141#endif
141 142
142#ifdef CONFIG_FTRACE_SYSCALLS 143#ifdef CONFIG_FTRACE_SYSCALLS
143#define TRACE_SYSCALLS() VMLINUX_SYMBOL(__start_syscalls_metadata) = .; \ 144#define TRACE_SYSCALLS() . = ALIGN(8); \
145 VMLINUX_SYMBOL(__start_syscalls_metadata) = .; \
144 *(__syscalls_metadata) \ 146 *(__syscalls_metadata) \
145 VMLINUX_SYMBOL(__stop_syscalls_metadata) = .; 147 VMLINUX_SYMBOL(__stop_syscalls_metadata) = .;
146#else 148#else
@@ -165,10 +167,8 @@
165 CPU_KEEP(exit.data) \ 167 CPU_KEEP(exit.data) \
166 MEM_KEEP(init.data) \ 168 MEM_KEEP(init.data) \
167 MEM_KEEP(exit.data) \ 169 MEM_KEEP(exit.data) \
168 . = ALIGN(32); \ 170 STRUCT_ALIGN(); \
169 VMLINUX_SYMBOL(__start___tracepoints) = .; \
170 *(__tracepoints) \ 171 *(__tracepoints) \
171 VMLINUX_SYMBOL(__stop___tracepoints) = .; \
172 /* implement dynamic printk debug */ \ 172 /* implement dynamic printk debug */ \
173 . = ALIGN(8); \ 173 . = ALIGN(8); \
174 VMLINUX_SYMBOL(__start___verbose) = .; \ 174 VMLINUX_SYMBOL(__start___verbose) = .; \
@@ -176,13 +176,7 @@
176 VMLINUX_SYMBOL(__stop___verbose) = .; \ 176 VMLINUX_SYMBOL(__stop___verbose) = .; \
177 LIKELY_PROFILE() \ 177 LIKELY_PROFILE() \
178 BRANCH_PROFILE() \ 178 BRANCH_PROFILE() \
179 TRACE_PRINTKS() \ 179 TRACE_PRINTKS()
180 \
181 STRUCT_ALIGN(); \
182 FTRACE_EVENTS() \
183 \
184 STRUCT_ALIGN(); \
185 TRACE_SYSCALLS()
186 180
187/* 181/*
188 * Data section helpers 182 * Data section helpers
@@ -220,6 +214,10 @@
220 VMLINUX_SYMBOL(__start_rodata) = .; \ 214 VMLINUX_SYMBOL(__start_rodata) = .; \
221 *(.rodata) *(.rodata.*) \ 215 *(.rodata) *(.rodata.*) \
222 *(__vermagic) /* Kernel version magic */ \ 216 *(__vermagic) /* Kernel version magic */ \
217 . = ALIGN(8); \
218 VMLINUX_SYMBOL(__start___tracepoints_ptrs) = .; \
219 *(__tracepoints_ptrs) /* Tracepoints: pointer array */\
220 VMLINUX_SYMBOL(__stop___tracepoints_ptrs) = .; \
223 *(__markers_strings) /* Markers: strings */ \ 221 *(__markers_strings) /* Markers: strings */ \
224 *(__tracepoints_strings)/* Tracepoints: strings */ \ 222 *(__tracepoints_strings)/* Tracepoints: strings */ \
225 } \ 223 } \
@@ -482,6 +480,8 @@
482 KERNEL_CTORS() \ 480 KERNEL_CTORS() \
483 *(.init.rodata) \ 481 *(.init.rodata) \
484 MCOUNT_REC() \ 482 MCOUNT_REC() \
483 FTRACE_EVENTS() \
484 TRACE_SYSCALLS() \
485 DEV_DISCARD(init.rodata) \ 485 DEV_DISCARD(init.rodata) \
486 CPU_DISCARD(init.rodata) \ 486 CPU_DISCARD(init.rodata) \
487 MEM_DISCARD(init.rodata) \ 487 MEM_DISCARD(init.rodata) \
diff --git a/include/linux/module.h b/include/linux/module.h
index e7c6385c6683..9bdf27c7615b 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -377,7 +377,7 @@ struct module
377 keeping pointers to this stuff */ 377 keeping pointers to this stuff */
378 char *args; 378 char *args;
379#ifdef CONFIG_TRACEPOINTS 379#ifdef CONFIG_TRACEPOINTS
380 struct tracepoint *tracepoints; 380 struct tracepoint * const *tracepoints_ptrs;
381 unsigned int num_tracepoints; 381 unsigned int num_tracepoints;
382#endif 382#endif
383#ifdef HAVE_JUMP_LABEL 383#ifdef HAVE_JUMP_LABEL
@@ -389,7 +389,7 @@ struct module
389 unsigned int num_trace_bprintk_fmt; 389 unsigned int num_trace_bprintk_fmt;
390#endif 390#endif
391#ifdef CONFIG_EVENT_TRACING 391#ifdef CONFIG_EVENT_TRACING
392 struct ftrace_event_call *trace_events; 392 struct ftrace_event_call **trace_events;
393 unsigned int num_trace_events; 393 unsigned int num_trace_events;
394#endif 394#endif
395#ifdef CONFIG_FTRACE_MCOUNT_RECORD 395#ifdef CONFIG_FTRACE_MCOUNT_RECORD
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 18cd0684fc4e..98664db1be47 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -125,39 +125,37 @@ extern struct trace_event_functions enter_syscall_print_funcs;
125extern struct trace_event_functions exit_syscall_print_funcs; 125extern struct trace_event_functions exit_syscall_print_funcs;
126 126
127#define SYSCALL_TRACE_ENTER_EVENT(sname) \ 127#define SYSCALL_TRACE_ENTER_EVENT(sname) \
128 static struct syscall_metadata \ 128 static struct syscall_metadata __syscall_meta_##sname; \
129 __attribute__((__aligned__(4))) __syscall_meta_##sname; \
130 static struct ftrace_event_call __used \ 129 static struct ftrace_event_call __used \
131 __attribute__((__aligned__(4))) \
132 __attribute__((section("_ftrace_events"))) \
133 event_enter_##sname = { \ 130 event_enter_##sname = { \
134 .name = "sys_enter"#sname, \ 131 .name = "sys_enter"#sname, \
135 .class = &event_class_syscall_enter, \ 132 .class = &event_class_syscall_enter, \
136 .event.funcs = &enter_syscall_print_funcs, \ 133 .event.funcs = &enter_syscall_print_funcs, \
137 .data = (void *)&__syscall_meta_##sname,\ 134 .data = (void *)&__syscall_meta_##sname,\
138 }; \ 135 }; \
136 static struct ftrace_event_call __used \
137 __attribute__((section("_ftrace_events"))) \
138 *__event_enter_##sname = &event_enter_##sname; \
139 __TRACE_EVENT_FLAGS(enter_##sname, TRACE_EVENT_FL_CAP_ANY) 139 __TRACE_EVENT_FLAGS(enter_##sname, TRACE_EVENT_FL_CAP_ANY)
140 140
141#define SYSCALL_TRACE_EXIT_EVENT(sname) \ 141#define SYSCALL_TRACE_EXIT_EVENT(sname) \
142 static struct syscall_metadata \ 142 static struct syscall_metadata __syscall_meta_##sname; \
143 __attribute__((__aligned__(4))) __syscall_meta_##sname; \
144 static struct ftrace_event_call __used \ 143 static struct ftrace_event_call __used \
145 __attribute__((__aligned__(4))) \
146 __attribute__((section("_ftrace_events"))) \
147 event_exit_##sname = { \ 144 event_exit_##sname = { \
148 .name = "sys_exit"#sname, \ 145 .name = "sys_exit"#sname, \
149 .class = &event_class_syscall_exit, \ 146 .class = &event_class_syscall_exit, \
150 .event.funcs = &exit_syscall_print_funcs, \ 147 .event.funcs = &exit_syscall_print_funcs, \
151 .data = (void *)&__syscall_meta_##sname,\ 148 .data = (void *)&__syscall_meta_##sname,\
152 }; \ 149 }; \
150 static struct ftrace_event_call __used \
151 __attribute__((section("_ftrace_events"))) \
152 *__event_exit_##sname = &event_exit_##sname; \
153 __TRACE_EVENT_FLAGS(exit_##sname, TRACE_EVENT_FL_CAP_ANY) 153 __TRACE_EVENT_FLAGS(exit_##sname, TRACE_EVENT_FL_CAP_ANY)
154 154
155#define SYSCALL_METADATA(sname, nb) \ 155#define SYSCALL_METADATA(sname, nb) \
156 SYSCALL_TRACE_ENTER_EVENT(sname); \ 156 SYSCALL_TRACE_ENTER_EVENT(sname); \
157 SYSCALL_TRACE_EXIT_EVENT(sname); \ 157 SYSCALL_TRACE_EXIT_EVENT(sname); \
158 static struct syscall_metadata __used \ 158 static struct syscall_metadata __used \
159 __attribute__((__aligned__(4))) \
160 __attribute__((section("__syscalls_metadata"))) \
161 __syscall_meta_##sname = { \ 159 __syscall_meta_##sname = { \
162 .name = "sys"#sname, \ 160 .name = "sys"#sname, \
163 .nb_args = nb, \ 161 .nb_args = nb, \
@@ -166,14 +164,15 @@ extern struct trace_event_functions exit_syscall_print_funcs;
166 .enter_event = &event_enter_##sname, \ 164 .enter_event = &event_enter_##sname, \
167 .exit_event = &event_exit_##sname, \ 165 .exit_event = &event_exit_##sname, \
168 .enter_fields = LIST_HEAD_INIT(__syscall_meta_##sname.enter_fields), \ 166 .enter_fields = LIST_HEAD_INIT(__syscall_meta_##sname.enter_fields), \
169 }; 167 }; \
168 static struct syscall_metadata __used \
169 __attribute__((section("__syscalls_metadata"))) \
170 *__p_syscall_meta_##sname = &__syscall_meta_##sname;
170 171
171#define SYSCALL_DEFINE0(sname) \ 172#define SYSCALL_DEFINE0(sname) \
172 SYSCALL_TRACE_ENTER_EVENT(_##sname); \ 173 SYSCALL_TRACE_ENTER_EVENT(_##sname); \
173 SYSCALL_TRACE_EXIT_EVENT(_##sname); \ 174 SYSCALL_TRACE_EXIT_EVENT(_##sname); \
174 static struct syscall_metadata __used \ 175 static struct syscall_metadata __used \
175 __attribute__((__aligned__(4))) \
176 __attribute__((section("__syscalls_metadata"))) \
177 __syscall_meta__##sname = { \ 176 __syscall_meta__##sname = { \
178 .name = "sys_"#sname, \ 177 .name = "sys_"#sname, \
179 .nb_args = 0, \ 178 .nb_args = 0, \
@@ -181,6 +180,9 @@ extern struct trace_event_functions exit_syscall_print_funcs;
181 .exit_event = &event_exit__##sname, \ 180 .exit_event = &event_exit__##sname, \
182 .enter_fields = LIST_HEAD_INIT(__syscall_meta__##sname.enter_fields), \ 181 .enter_fields = LIST_HEAD_INIT(__syscall_meta__##sname.enter_fields), \
183 }; \ 182 }; \
183 static struct syscall_metadata __used \
184 __attribute__((section("__syscalls_metadata"))) \
185 *__p_syscall_meta_##sname = &__syscall_meta__##sname; \
184 asmlinkage long sys_##sname(void) 186 asmlinkage long sys_##sname(void)
185#else 187#else
186#define SYSCALL_DEFINE0(name) asmlinkage long sys_##name(void) 188#define SYSCALL_DEFINE0(name) asmlinkage long sys_##name(void)
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index c6814616653b..97c84a58efb8 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -33,12 +33,7 @@ struct tracepoint {
33 void (*regfunc)(void); 33 void (*regfunc)(void);
34 void (*unregfunc)(void); 34 void (*unregfunc)(void);
35 struct tracepoint_func __rcu *funcs; 35 struct tracepoint_func __rcu *funcs;
36} __attribute__((aligned(32))); /* 36};
37 * Aligned on 32 bytes because it is
38 * globally visible and gcc happily
39 * align these on the structure size.
40 * Keep in sync with vmlinux.lds.h.
41 */
42 37
43/* 38/*
44 * Connect a probe to a tracepoint. 39 * Connect a probe to a tracepoint.
@@ -61,15 +56,15 @@ extern void tracepoint_probe_update_all(void);
61 56
62struct tracepoint_iter { 57struct tracepoint_iter {
63 struct module *module; 58 struct module *module;
64 struct tracepoint *tracepoint; 59 struct tracepoint * const *tracepoint;
65}; 60};
66 61
67extern void tracepoint_iter_start(struct tracepoint_iter *iter); 62extern void tracepoint_iter_start(struct tracepoint_iter *iter);
68extern void tracepoint_iter_next(struct tracepoint_iter *iter); 63extern void tracepoint_iter_next(struct tracepoint_iter *iter);
69extern void tracepoint_iter_stop(struct tracepoint_iter *iter); 64extern void tracepoint_iter_stop(struct tracepoint_iter *iter);
70extern void tracepoint_iter_reset(struct tracepoint_iter *iter); 65extern void tracepoint_iter_reset(struct tracepoint_iter *iter);
71extern int tracepoint_get_iter_range(struct tracepoint **tracepoint, 66extern int tracepoint_get_iter_range(struct tracepoint * const **tracepoint,
72 struct tracepoint *begin, struct tracepoint *end); 67 struct tracepoint * const *begin, struct tracepoint * const *end);
73 68
74/* 69/*
75 * tracepoint_synchronize_unregister must be called between the last tracepoint 70 * tracepoint_synchronize_unregister must be called between the last tracepoint
@@ -84,11 +79,13 @@ static inline void tracepoint_synchronize_unregister(void)
84#define PARAMS(args...) args 79#define PARAMS(args...) args
85 80
86#ifdef CONFIG_TRACEPOINTS 81#ifdef CONFIG_TRACEPOINTS
87extern void tracepoint_update_probe_range(struct tracepoint *begin, 82extern
88 struct tracepoint *end); 83void tracepoint_update_probe_range(struct tracepoint * const *begin,
84 struct tracepoint * const *end);
89#else 85#else
90static inline void tracepoint_update_probe_range(struct tracepoint *begin, 86static inline
91 struct tracepoint *end) 87void tracepoint_update_probe_range(struct tracepoint * const *begin,
88 struct tracepoint * const *end)
92{ } 89{ }
93#endif /* CONFIG_TRACEPOINTS */ 90#endif /* CONFIG_TRACEPOINTS */
94 91
@@ -174,12 +171,20 @@ do_trace: \
174 { \ 171 { \
175 } 172 }
176 173
174/*
175 * We have no guarantee that gcc and the linker won't up-align the tracepoint
176 * structures, so we create an array of pointers that will be used for iteration
177 * on the tracepoints.
178 */
177#define DEFINE_TRACE_FN(name, reg, unreg) \ 179#define DEFINE_TRACE_FN(name, reg, unreg) \
178 static const char __tpstrtab_##name[] \ 180 static const char __tpstrtab_##name[] \
179 __attribute__((section("__tracepoints_strings"))) = #name; \ 181 __attribute__((section("__tracepoints_strings"))) = #name; \
180 struct tracepoint __tracepoint_##name \ 182 struct tracepoint __tracepoint_##name \
181 __attribute__((section("__tracepoints"), aligned(32))) = \ 183 __attribute__((section("__tracepoints"))) = \
182 { __tpstrtab_##name, 0, reg, unreg, NULL } 184 { __tpstrtab_##name, 0, reg, unreg, NULL }; \
185 static struct tracepoint * const __tracepoint_ptr_##name __used \
186 __attribute__((section("__tracepoints_ptrs"))) = \
187 &__tracepoint_##name;
183 188
184#define DEFINE_TRACE(name) \ 189#define DEFINE_TRACE(name) \
185 DEFINE_TRACE_FN(name, NULL, NULL); 190 DEFINE_TRACE_FN(name, NULL, NULL);
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index e16610c208c9..3e68366d485a 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -446,14 +446,16 @@ static inline notrace int ftrace_get_offsets_##call( \
446 * .reg = ftrace_event_reg, 446 * .reg = ftrace_event_reg,
447 * }; 447 * };
448 * 448 *
449 * static struct ftrace_event_call __used 449 * static struct ftrace_event_call event_<call> = {
450 * __attribute__((__aligned__(4)))
451 * __attribute__((section("_ftrace_events"))) event_<call> = {
452 * .name = "<call>", 450 * .name = "<call>",
453 * .class = event_class_<template>, 451 * .class = event_class_<template>,
454 * .event = &ftrace_event_type_<call>, 452 * .event = &ftrace_event_type_<call>,
455 * .print_fmt = print_fmt_<call>, 453 * .print_fmt = print_fmt_<call>,
456 * }; 454 * };
455 * // its only safe to use pointers when doing linker tricks to
456 * // create an array.
457 * static struct ftrace_event_call __used
458 * __attribute__((section("_ftrace_events"))) *__event_<call> = &event_<call>;
457 * 459 *
458 */ 460 */
459 461
@@ -579,28 +581,28 @@ static struct ftrace_event_class __used event_class_##call = { \
579#undef DEFINE_EVENT 581#undef DEFINE_EVENT
580#define DEFINE_EVENT(template, call, proto, args) \ 582#define DEFINE_EVENT(template, call, proto, args) \
581 \ 583 \
582static struct ftrace_event_call __used \ 584static struct ftrace_event_call __used event_##call = { \
583__attribute__((__aligned__(4))) \
584__attribute__((section("_ftrace_events"))) event_##call = { \
585 .name = #call, \ 585 .name = #call, \
586 .class = &event_class_##template, \ 586 .class = &event_class_##template, \
587 .event.funcs = &ftrace_event_type_funcs_##template, \ 587 .event.funcs = &ftrace_event_type_funcs_##template, \
588 .print_fmt = print_fmt_##template, \ 588 .print_fmt = print_fmt_##template, \
589}; 589}; \
590static struct ftrace_event_call __used \
591__attribute__((section("_ftrace_events"))) *__event_##call = &event_##call
590 592
591#undef DEFINE_EVENT_PRINT 593#undef DEFINE_EVENT_PRINT
592#define DEFINE_EVENT_PRINT(template, call, proto, args, print) \ 594#define DEFINE_EVENT_PRINT(template, call, proto, args, print) \
593 \ 595 \
594static const char print_fmt_##call[] = print; \ 596static const char print_fmt_##call[] = print; \
595 \ 597 \
596static struct ftrace_event_call __used \ 598static struct ftrace_event_call __used event_##call = { \
597__attribute__((__aligned__(4))) \
598__attribute__((section("_ftrace_events"))) event_##call = { \
599 .name = #call, \ 599 .name = #call, \
600 .class = &event_class_##template, \ 600 .class = &event_class_##template, \
601 .event.funcs = &ftrace_event_type_funcs_##call, \ 601 .event.funcs = &ftrace_event_type_funcs_##call, \
602 .print_fmt = print_fmt_##call, \ 602 .print_fmt = print_fmt_##call, \
603} 603}; \
604static struct ftrace_event_call __used \
605__attribute__((section("_ftrace_events"))) *__event_##call = &event_##call
604 606
605#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) 607#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
606 608