Commit 15ccb7b429d341605296b6a654b414f2b3ae9fd3
Exists in
master
and in
4 other branches
Merge branch 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
…/git/tip/linux-2.6-tip * 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: perf stat: Fix aggreate counter reading accounting tracing: Replace syscall_meta_data struct array with pointer array tracepoints: Fix section alignment using pointer array tracing: Replace trace_event struct array with pointer array
Showing 11 changed files Side-by-side Diff
include/asm-generic/vmlinux.lds.h
... | ... | @@ -124,7 +124,8 @@ |
124 | 124 | #endif |
125 | 125 | |
126 | 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 | 129 | *(_ftrace_events) \ |
129 | 130 | VMLINUX_SYMBOL(__stop_ftrace_events) = .; |
130 | 131 | #else |
... | ... | @@ -140,7 +141,8 @@ |
140 | 141 | #endif |
141 | 142 | |
142 | 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 | 146 | *(__syscalls_metadata) \ |
145 | 147 | VMLINUX_SYMBOL(__stop_syscalls_metadata) = .; |
146 | 148 | #else |
147 | 149 | |
... | ... | @@ -165,10 +167,8 @@ |
165 | 167 | CPU_KEEP(exit.data) \ |
166 | 168 | MEM_KEEP(init.data) \ |
167 | 169 | MEM_KEEP(exit.data) \ |
168 | - . = ALIGN(32); \ | |
169 | - VMLINUX_SYMBOL(__start___tracepoints) = .; \ | |
170 | + STRUCT_ALIGN(); \ | |
170 | 171 | *(__tracepoints) \ |
171 | - VMLINUX_SYMBOL(__stop___tracepoints) = .; \ | |
172 | 172 | /* implement dynamic printk debug */ \ |
173 | 173 | . = ALIGN(8); \ |
174 | 174 | VMLINUX_SYMBOL(__start___verbose) = .; \ |
... | ... | @@ -176,13 +176,7 @@ |
176 | 176 | VMLINUX_SYMBOL(__stop___verbose) = .; \ |
177 | 177 | LIKELY_PROFILE() \ |
178 | 178 | BRANCH_PROFILE() \ |
179 | - TRACE_PRINTKS() \ | |
180 | - \ | |
181 | - STRUCT_ALIGN(); \ | |
182 | - FTRACE_EVENTS() \ | |
183 | - \ | |
184 | - STRUCT_ALIGN(); \ | |
185 | - TRACE_SYSCALLS() | |
179 | + TRACE_PRINTKS() | |
186 | 180 | |
187 | 181 | /* |
188 | 182 | * Data section helpers |
... | ... | @@ -220,6 +214,10 @@ |
220 | 214 | VMLINUX_SYMBOL(__start_rodata) = .; \ |
221 | 215 | *(.rodata) *(.rodata.*) \ |
222 | 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 | 221 | *(__markers_strings) /* Markers: strings */ \ |
224 | 222 | *(__tracepoints_strings)/* Tracepoints: strings */ \ |
225 | 223 | } \ |
... | ... | @@ -482,6 +480,8 @@ |
482 | 480 | KERNEL_CTORS() \ |
483 | 481 | *(.init.rodata) \ |
484 | 482 | MCOUNT_REC() \ |
483 | + FTRACE_EVENTS() \ | |
484 | + TRACE_SYSCALLS() \ | |
485 | 485 | DEV_DISCARD(init.rodata) \ |
486 | 486 | CPU_DISCARD(init.rodata) \ |
487 | 487 | MEM_DISCARD(init.rodata) \ |
include/linux/module.h
... | ... | @@ -377,7 +377,7 @@ |
377 | 377 | keeping pointers to this stuff */ |
378 | 378 | char *args; |
379 | 379 | #ifdef CONFIG_TRACEPOINTS |
380 | - struct tracepoint *tracepoints; | |
380 | + struct tracepoint * const *tracepoints_ptrs; | |
381 | 381 | unsigned int num_tracepoints; |
382 | 382 | #endif |
383 | 383 | #ifdef HAVE_JUMP_LABEL |
... | ... | @@ -389,7 +389,7 @@ |
389 | 389 | unsigned int num_trace_bprintk_fmt; |
390 | 390 | #endif |
391 | 391 | #ifdef CONFIG_EVENT_TRACING |
392 | - struct ftrace_event_call *trace_events; | |
392 | + struct ftrace_event_call **trace_events; | |
393 | 393 | unsigned int num_trace_events; |
394 | 394 | #endif |
395 | 395 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD |
include/linux/syscalls.h
... | ... | @@ -125,39 +125,37 @@ |
125 | 125 | extern struct trace_event_functions exit_syscall_print_funcs; |
126 | 126 | |
127 | 127 | #define SYSCALL_TRACE_ENTER_EVENT(sname) \ |
128 | - static struct syscall_metadata \ | |
129 | - __attribute__((__aligned__(4))) __syscall_meta_##sname; \ | |
128 | + static struct syscall_metadata __syscall_meta_##sname; \ | |
130 | 129 | static struct ftrace_event_call __used \ |
131 | - __attribute__((__aligned__(4))) \ | |
132 | - __attribute__((section("_ftrace_events"))) \ | |
133 | 130 | event_enter_##sname = { \ |
134 | 131 | .name = "sys_enter"#sname, \ |
135 | 132 | .class = &event_class_syscall_enter, \ |
136 | 133 | .event.funcs = &enter_syscall_print_funcs, \ |
137 | 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 | 139 | __TRACE_EVENT_FLAGS(enter_##sname, TRACE_EVENT_FL_CAP_ANY) |
140 | 140 | |
141 | 141 | #define SYSCALL_TRACE_EXIT_EVENT(sname) \ |
142 | - static struct syscall_metadata \ | |
143 | - __attribute__((__aligned__(4))) __syscall_meta_##sname; \ | |
142 | + static struct syscall_metadata __syscall_meta_##sname; \ | |
144 | 143 | static struct ftrace_event_call __used \ |
145 | - __attribute__((__aligned__(4))) \ | |
146 | - __attribute__((section("_ftrace_events"))) \ | |
147 | 144 | event_exit_##sname = { \ |
148 | 145 | .name = "sys_exit"#sname, \ |
149 | 146 | .class = &event_class_syscall_exit, \ |
150 | 147 | .event.funcs = &exit_syscall_print_funcs, \ |
151 | 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 | 153 | __TRACE_EVENT_FLAGS(exit_##sname, TRACE_EVENT_FL_CAP_ANY) |
154 | 154 | |
155 | 155 | #define SYSCALL_METADATA(sname, nb) \ |
156 | 156 | SYSCALL_TRACE_ENTER_EVENT(sname); \ |
157 | 157 | SYSCALL_TRACE_EXIT_EVENT(sname); \ |
158 | 158 | static struct syscall_metadata __used \ |
159 | - __attribute__((__aligned__(4))) \ | |
160 | - __attribute__((section("__syscalls_metadata"))) \ | |
161 | 159 | __syscall_meta_##sname = { \ |
162 | 160 | .name = "sys"#sname, \ |
163 | 161 | .nb_args = nb, \ |
164 | 162 | |
... | ... | @@ -166,14 +164,15 @@ |
166 | 164 | .enter_event = &event_enter_##sname, \ |
167 | 165 | .exit_event = &event_exit_##sname, \ |
168 | 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 | 172 | #define SYSCALL_DEFINE0(sname) \ |
172 | 173 | SYSCALL_TRACE_ENTER_EVENT(_##sname); \ |
173 | 174 | SYSCALL_TRACE_EXIT_EVENT(_##sname); \ |
174 | 175 | static struct syscall_metadata __used \ |
175 | - __attribute__((__aligned__(4))) \ | |
176 | - __attribute__((section("__syscalls_metadata"))) \ | |
177 | 176 | __syscall_meta__##sname = { \ |
178 | 177 | .name = "sys_"#sname, \ |
179 | 178 | .nb_args = 0, \ |
... | ... | @@ -181,6 +180,9 @@ |
181 | 180 | .exit_event = &event_exit__##sname, \ |
182 | 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 | 186 | asmlinkage long sys_##sname(void) |
185 | 187 | #else |
186 | 188 | #define SYSCALL_DEFINE0(name) asmlinkage long sys_##name(void) |
include/linux/tracepoint.h
... | ... | @@ -33,12 +33,7 @@ |
33 | 33 | void (*regfunc)(void); |
34 | 34 | void (*unregfunc)(void); |
35 | 35 | struct tracepoint_func __rcu *funcs; |
36 | -} __attribute__((aligned(32))); /* | |
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 | - */ | |
36 | +}; | |
42 | 37 | |
43 | 38 | /* |
44 | 39 | * Connect a probe to a tracepoint. |
45 | 40 | |
... | ... | @@ -61,15 +56,15 @@ |
61 | 56 | |
62 | 57 | struct tracepoint_iter { |
63 | 58 | struct module *module; |
64 | - struct tracepoint *tracepoint; | |
59 | + struct tracepoint * const *tracepoint; | |
65 | 60 | }; |
66 | 61 | |
67 | 62 | extern void tracepoint_iter_start(struct tracepoint_iter *iter); |
68 | 63 | extern void tracepoint_iter_next(struct tracepoint_iter *iter); |
69 | 64 | extern void tracepoint_iter_stop(struct tracepoint_iter *iter); |
70 | 65 | extern void tracepoint_iter_reset(struct tracepoint_iter *iter); |
71 | -extern int tracepoint_get_iter_range(struct tracepoint **tracepoint, | |
72 | - struct tracepoint *begin, struct tracepoint *end); | |
66 | +extern int tracepoint_get_iter_range(struct tracepoint * const **tracepoint, | |
67 | + struct tracepoint * const *begin, struct tracepoint * const *end); | |
73 | 68 | |
74 | 69 | /* |
75 | 70 | * tracepoint_synchronize_unregister must be called between the last tracepoint |
76 | 71 | |
... | ... | @@ -84,11 +79,13 @@ |
84 | 79 | #define PARAMS(args...) args |
85 | 80 | |
86 | 81 | #ifdef CONFIG_TRACEPOINTS |
87 | -extern void tracepoint_update_probe_range(struct tracepoint *begin, | |
88 | - struct tracepoint *end); | |
82 | +extern | |
83 | +void tracepoint_update_probe_range(struct tracepoint * const *begin, | |
84 | + struct tracepoint * const *end); | |
89 | 85 | #else |
90 | -static inline void tracepoint_update_probe_range(struct tracepoint *begin, | |
91 | - struct tracepoint *end) | |
86 | +static inline | |
87 | +void tracepoint_update_probe_range(struct tracepoint * const *begin, | |
88 | + struct tracepoint * const *end) | |
92 | 89 | { } |
93 | 90 | #endif /* CONFIG_TRACEPOINTS */ |
94 | 91 | |
95 | 92 | |
... | ... | @@ -174,12 +171,20 @@ |
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 | 179 | #define DEFINE_TRACE_FN(name, reg, unreg) \ |
178 | 180 | static const char __tpstrtab_##name[] \ |
179 | 181 | __attribute__((section("__tracepoints_strings"))) = #name; \ |
180 | 182 | struct tracepoint __tracepoint_##name \ |
181 | - __attribute__((section("__tracepoints"), aligned(32))) = \ | |
182 | - { __tpstrtab_##name, 0, reg, unreg, NULL } | |
183 | + __attribute__((section("__tracepoints"))) = \ | |
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 | 189 | #define DEFINE_TRACE(name) \ |
185 | 190 | DEFINE_TRACE_FN(name, NULL, NULL); |
include/trace/ftrace.h
... | ... | @@ -446,14 +446,16 @@ |
446 | 446 | * .reg = ftrace_event_reg, |
447 | 447 | * }; |
448 | 448 | * |
449 | - * static struct ftrace_event_call __used | |
450 | - * __attribute__((__aligned__(4))) | |
451 | - * __attribute__((section("_ftrace_events"))) event_<call> = { | |
449 | + * static struct ftrace_event_call event_<call> = { | |
452 | 450 | * .name = "<call>", |
453 | 451 | * .class = event_class_<template>, |
454 | 452 | * .event = &ftrace_event_type_<call>, |
455 | 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 | |
460 | 462 | |
461 | 463 | |
462 | 464 | |
... | ... | @@ -579,28 +581,28 @@ |
579 | 581 | #undef DEFINE_EVENT |
580 | 582 | #define DEFINE_EVENT(template, call, proto, args) \ |
581 | 583 | \ |
582 | -static struct ftrace_event_call __used \ | |
583 | -__attribute__((__aligned__(4))) \ | |
584 | -__attribute__((section("_ftrace_events"))) event_##call = { \ | |
584 | +static struct ftrace_event_call __used event_##call = { \ | |
585 | 585 | .name = #call, \ |
586 | 586 | .class = &event_class_##template, \ |
587 | 587 | .event.funcs = &ftrace_event_type_funcs_##template, \ |
588 | 588 | .print_fmt = print_fmt_##template, \ |
589 | -}; | |
589 | +}; \ | |
590 | +static struct ftrace_event_call __used \ | |
591 | +__attribute__((section("_ftrace_events"))) *__event_##call = &event_##call | |
590 | 592 | |
591 | 593 | #undef DEFINE_EVENT_PRINT |
592 | 594 | #define DEFINE_EVENT_PRINT(template, call, proto, args, print) \ |
593 | 595 | \ |
594 | 596 | static const char print_fmt_##call[] = print; \ |
595 | 597 | \ |
596 | -static struct ftrace_event_call __used \ | |
597 | -__attribute__((__aligned__(4))) \ | |
598 | -__attribute__((section("_ftrace_events"))) event_##call = { \ | |
598 | +static struct ftrace_event_call __used event_##call = { \ | |
599 | 599 | .name = #call, \ |
600 | 600 | .class = &event_class_##template, \ |
601 | 601 | .event.funcs = &ftrace_event_type_funcs_##call, \ |
602 | 602 | .print_fmt = print_fmt_##call, \ |
603 | -} | |
603 | +}; \ | |
604 | +static struct ftrace_event_call __used \ | |
605 | +__attribute__((section("_ftrace_events"))) *__event_##call = &event_##call | |
604 | 606 | |
605 | 607 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
606 | 608 |
kernel/module.c
... | ... | @@ -2460,9 +2460,9 @@ |
2460 | 2460 | #endif |
2461 | 2461 | |
2462 | 2462 | #ifdef CONFIG_TRACEPOINTS |
2463 | - mod->tracepoints = section_objs(info, "__tracepoints", | |
2464 | - sizeof(*mod->tracepoints), | |
2465 | - &mod->num_tracepoints); | |
2463 | + mod->tracepoints_ptrs = section_objs(info, "__tracepoints_ptrs", | |
2464 | + sizeof(*mod->tracepoints_ptrs), | |
2465 | + &mod->num_tracepoints); | |
2466 | 2466 | #endif |
2467 | 2467 | #ifdef HAVE_JUMP_LABEL |
2468 | 2468 | mod->jump_entries = section_objs(info, "__jump_table", |
... | ... | @@ -3393,7 +3393,7 @@ |
3393 | 3393 | struct modversion_info *ver, |
3394 | 3394 | struct kernel_param *kp, |
3395 | 3395 | struct kernel_symbol *ks, |
3396 | - struct tracepoint *tp) | |
3396 | + struct tracepoint * const *tp) | |
3397 | 3397 | { |
3398 | 3398 | } |
3399 | 3399 | EXPORT_SYMBOL(module_layout); |
... | ... | @@ -3407,8 +3407,8 @@ |
3407 | 3407 | mutex_lock(&module_mutex); |
3408 | 3408 | list_for_each_entry(mod, &modules, list) |
3409 | 3409 | if (!mod->taints) |
3410 | - tracepoint_update_probe_range(mod->tracepoints, | |
3411 | - mod->tracepoints + mod->num_tracepoints); | |
3410 | + tracepoint_update_probe_range(mod->tracepoints_ptrs, | |
3411 | + mod->tracepoints_ptrs + mod->num_tracepoints); | |
3412 | 3412 | mutex_unlock(&module_mutex); |
3413 | 3413 | } |
3414 | 3414 | |
... | ... | @@ -3432,8 +3432,8 @@ |
3432 | 3432 | else if (iter_mod > iter->module) |
3433 | 3433 | iter->tracepoint = NULL; |
3434 | 3434 | found = tracepoint_get_iter_range(&iter->tracepoint, |
3435 | - iter_mod->tracepoints, | |
3436 | - iter_mod->tracepoints | |
3435 | + iter_mod->tracepoints_ptrs, | |
3436 | + iter_mod->tracepoints_ptrs | |
3437 | 3437 | + iter_mod->num_tracepoints); |
3438 | 3438 | if (found) { |
3439 | 3439 | iter->module = iter_mod; |
kernel/trace/trace_events.c
... | ... | @@ -1284,7 +1284,7 @@ |
1284 | 1284 | static void trace_module_add_events(struct module *mod) |
1285 | 1285 | { |
1286 | 1286 | struct ftrace_module_file_ops *file_ops = NULL; |
1287 | - struct ftrace_event_call *call, *start, *end; | |
1287 | + struct ftrace_event_call **call, **start, **end; | |
1288 | 1288 | |
1289 | 1289 | start = mod->trace_events; |
1290 | 1290 | end = mod->trace_events + mod->num_trace_events; |
... | ... | @@ -1297,7 +1297,7 @@ |
1297 | 1297 | return; |
1298 | 1298 | |
1299 | 1299 | for_each_event(call, start, end) { |
1300 | - __trace_add_event_call(call, mod, | |
1300 | + __trace_add_event_call(*call, mod, | |
1301 | 1301 | &file_ops->id, &file_ops->enable, |
1302 | 1302 | &file_ops->filter, &file_ops->format); |
1303 | 1303 | } |
... | ... | @@ -1367,8 +1367,8 @@ |
1367 | 1367 | .priority = 0, |
1368 | 1368 | }; |
1369 | 1369 | |
1370 | -extern struct ftrace_event_call __start_ftrace_events[]; | |
1371 | -extern struct ftrace_event_call __stop_ftrace_events[]; | |
1370 | +extern struct ftrace_event_call *__start_ftrace_events[]; | |
1371 | +extern struct ftrace_event_call *__stop_ftrace_events[]; | |
1372 | 1372 | |
1373 | 1373 | static char bootup_event_buf[COMMAND_LINE_SIZE] __initdata; |
1374 | 1374 | |
... | ... | @@ -1384,7 +1384,7 @@ |
1384 | 1384 | |
1385 | 1385 | static __init int event_trace_init(void) |
1386 | 1386 | { |
1387 | - struct ftrace_event_call *call; | |
1387 | + struct ftrace_event_call **call; | |
1388 | 1388 | struct dentry *d_tracer; |
1389 | 1389 | struct dentry *entry; |
1390 | 1390 | struct dentry *d_events; |
... | ... | @@ -1430,7 +1430,7 @@ |
1430 | 1430 | pr_warning("tracing: Failed to allocate common fields"); |
1431 | 1431 | |
1432 | 1432 | for_each_event(call, __start_ftrace_events, __stop_ftrace_events) { |
1433 | - __trace_add_event_call(call, NULL, &ftrace_event_id_fops, | |
1433 | + __trace_add_event_call(*call, NULL, &ftrace_event_id_fops, | |
1434 | 1434 | &ftrace_enable_fops, |
1435 | 1435 | &ftrace_event_filter_fops, |
1436 | 1436 | &ftrace_event_format_fops); |
kernel/trace/trace_export.c
... | ... | @@ -161,14 +161,14 @@ |
161 | 161 | .fields = LIST_HEAD_INIT(event_class_ftrace_##call.fields),\ |
162 | 162 | }; \ |
163 | 163 | \ |
164 | -struct ftrace_event_call __used \ | |
165 | -__attribute__((__aligned__(4))) \ | |
166 | -__attribute__((section("_ftrace_events"))) event_##call = { \ | |
164 | +struct ftrace_event_call __used event_##call = { \ | |
167 | 165 | .name = #call, \ |
168 | 166 | .event.type = etype, \ |
169 | 167 | .class = &event_class_ftrace_##call, \ |
170 | 168 | .print_fmt = print, \ |
171 | 169 | }; \ |
170 | +struct ftrace_event_call __used \ | |
171 | +__attribute__((section("_ftrace_events"))) *__event_##call = &event_##call; | |
172 | 172 | |
173 | 173 | #include "trace_entries.h" |
kernel/trace/trace_syscalls.c
... | ... | @@ -55,20 +55,21 @@ |
55 | 55 | .raw_init = init_syscall_trace, |
56 | 56 | }; |
57 | 57 | |
58 | -extern unsigned long __start_syscalls_metadata[]; | |
59 | -extern unsigned long __stop_syscalls_metadata[]; | |
58 | +extern struct syscall_metadata *__start_syscalls_metadata[]; | |
59 | +extern struct syscall_metadata *__stop_syscalls_metadata[]; | |
60 | 60 | |
61 | 61 | static struct syscall_metadata **syscalls_metadata; |
62 | 62 | |
63 | -static struct syscall_metadata *find_syscall_meta(unsigned long syscall) | |
63 | +static __init struct syscall_metadata * | |
64 | +find_syscall_meta(unsigned long syscall) | |
64 | 65 | { |
65 | - struct syscall_metadata *start; | |
66 | - struct syscall_metadata *stop; | |
66 | + struct syscall_metadata **start; | |
67 | + struct syscall_metadata **stop; | |
67 | 68 | char str[KSYM_SYMBOL_LEN]; |
68 | 69 | |
69 | 70 | |
70 | - start = (struct syscall_metadata *)__start_syscalls_metadata; | |
71 | - stop = (struct syscall_metadata *)__stop_syscalls_metadata; | |
71 | + start = __start_syscalls_metadata; | |
72 | + stop = __stop_syscalls_metadata; | |
72 | 73 | kallsyms_lookup(syscall, NULL, NULL, NULL, str); |
73 | 74 | |
74 | 75 | for ( ; start < stop; start++) { |
... | ... | @@ -78,8 +79,8 @@ |
78 | 79 | * with "SyS" instead of "sys", leading to an unwanted |
79 | 80 | * mismatch. |
80 | 81 | */ |
81 | - if (start->name && !strcmp(start->name + 3, str + 3)) | |
82 | - return start; | |
82 | + if ((*start)->name && !strcmp((*start)->name + 3, str + 3)) | |
83 | + return *start; | |
83 | 84 | } |
84 | 85 | return NULL; |
85 | 86 | } |
kernel/tracepoint.c
... | ... | @@ -27,8 +27,8 @@ |
27 | 27 | #include <linux/sched.h> |
28 | 28 | #include <linux/jump_label.h> |
29 | 29 | |
30 | -extern struct tracepoint __start___tracepoints[]; | |
31 | -extern struct tracepoint __stop___tracepoints[]; | |
30 | +extern struct tracepoint * const __start___tracepoints_ptrs[]; | |
31 | +extern struct tracepoint * const __stop___tracepoints_ptrs[]; | |
32 | 32 | |
33 | 33 | /* Set to 1 to enable tracepoint debug output */ |
34 | 34 | static const int tracepoint_debug; |
35 | 35 | |
... | ... | @@ -298,10 +298,10 @@ |
298 | 298 | * |
299 | 299 | * Updates the probe callback corresponding to a range of tracepoints. |
300 | 300 | */ |
301 | -void | |
302 | -tracepoint_update_probe_range(struct tracepoint *begin, struct tracepoint *end) | |
301 | +void tracepoint_update_probe_range(struct tracepoint * const *begin, | |
302 | + struct tracepoint * const *end) | |
303 | 303 | { |
304 | - struct tracepoint *iter; | |
304 | + struct tracepoint * const *iter; | |
305 | 305 | struct tracepoint_entry *mark_entry; |
306 | 306 | |
307 | 307 | if (!begin) |
308 | 308 | |
309 | 309 | |
... | ... | @@ -309,12 +309,12 @@ |
309 | 309 | |
310 | 310 | mutex_lock(&tracepoints_mutex); |
311 | 311 | for (iter = begin; iter < end; iter++) { |
312 | - mark_entry = get_tracepoint(iter->name); | |
312 | + mark_entry = get_tracepoint((*iter)->name); | |
313 | 313 | if (mark_entry) { |
314 | - set_tracepoint(&mark_entry, iter, | |
314 | + set_tracepoint(&mark_entry, *iter, | |
315 | 315 | !!mark_entry->refcount); |
316 | 316 | } else { |
317 | - disable_tracepoint(iter); | |
317 | + disable_tracepoint(*iter); | |
318 | 318 | } |
319 | 319 | } |
320 | 320 | mutex_unlock(&tracepoints_mutex); |
... | ... | @@ -326,8 +326,8 @@ |
326 | 326 | static void tracepoint_update_probes(void) |
327 | 327 | { |
328 | 328 | /* Core kernel tracepoints */ |
329 | - tracepoint_update_probe_range(__start___tracepoints, | |
330 | - __stop___tracepoints); | |
329 | + tracepoint_update_probe_range(__start___tracepoints_ptrs, | |
330 | + __stop___tracepoints_ptrs); | |
331 | 331 | /* tracepoints in modules. */ |
332 | 332 | module_update_tracepoints(); |
333 | 333 | } |
... | ... | @@ -514,8 +514,8 @@ |
514 | 514 | * Will return the first tracepoint in the range if the input tracepoint is |
515 | 515 | * NULL. |
516 | 516 | */ |
517 | -int tracepoint_get_iter_range(struct tracepoint **tracepoint, | |
518 | - struct tracepoint *begin, struct tracepoint *end) | |
517 | +int tracepoint_get_iter_range(struct tracepoint * const **tracepoint, | |
518 | + struct tracepoint * const *begin, struct tracepoint * const *end) | |
519 | 519 | { |
520 | 520 | if (!*tracepoint && begin != end) { |
521 | 521 | *tracepoint = begin; |
... | ... | @@ -534,7 +534,8 @@ |
534 | 534 | /* Core kernel tracepoints */ |
535 | 535 | if (!iter->module) { |
536 | 536 | found = tracepoint_get_iter_range(&iter->tracepoint, |
537 | - __start___tracepoints, __stop___tracepoints); | |
537 | + __start___tracepoints_ptrs, | |
538 | + __stop___tracepoints_ptrs); | |
538 | 539 | if (found) |
539 | 540 | goto end; |
540 | 541 | } |
... | ... | @@ -585,8 +586,8 @@ |
585 | 586 | switch (val) { |
586 | 587 | case MODULE_STATE_COMING: |
587 | 588 | case MODULE_STATE_GOING: |
588 | - tracepoint_update_probe_range(mod->tracepoints, | |
589 | - mod->tracepoints + mod->num_tracepoints); | |
589 | + tracepoint_update_probe_range(mod->tracepoints_ptrs, | |
590 | + mod->tracepoints_ptrs + mod->num_tracepoints); | |
590 | 591 | break; |
591 | 592 | } |
592 | 593 | return 0; |
tools/perf/util/evsel.c