diff options
-rw-r--r-- | include/linux/syscalls.h | 2 | ||||
-rw-r--r-- | include/trace/syscall.h | 6 | ||||
-rw-r--r-- | kernel/trace/trace_syscalls.c | 30 |
3 files changed, 10 insertions, 28 deletions
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index d3c9fd01a110..b9af87560adb 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
@@ -168,7 +168,6 @@ static void prof_sysexit_disable_##sname(struct ftrace_event_call *unused) \ | |||
168 | if (!id) \ | 168 | if (!id) \ |
169 | return -ENODEV; \ | 169 | return -ENODEV; \ |
170 | event_enter_##sname.id = id; \ | 170 | event_enter_##sname.id = id; \ |
171 | set_syscall_enter_id(num, id); \ | ||
172 | INIT_LIST_HEAD(&event_enter_##sname.fields); \ | 171 | INIT_LIST_HEAD(&event_enter_##sname.fields); \ |
173 | return 0; \ | 172 | return 0; \ |
174 | } \ | 173 | } \ |
@@ -205,7 +204,6 @@ static void prof_sysexit_disable_##sname(struct ftrace_event_call *unused) \ | |||
205 | if (!id) \ | 204 | if (!id) \ |
206 | return -ENODEV; \ | 205 | return -ENODEV; \ |
207 | event_exit_##sname.id = id; \ | 206 | event_exit_##sname.id = id; \ |
208 | set_syscall_exit_id(num, id); \ | ||
209 | INIT_LIST_HEAD(&event_exit_##sname.fields); \ | 207 | INIT_LIST_HEAD(&event_exit_##sname.fields); \ |
210 | return 0; \ | 208 | return 0; \ |
211 | } \ | 209 | } \ |
diff --git a/include/trace/syscall.h b/include/trace/syscall.h index c5265c81c4e7..ca09561cd578 100644 --- a/include/trace/syscall.h +++ b/include/trace/syscall.h | |||
@@ -15,8 +15,6 @@ | |||
15 | * @nb_args: number of parameters it takes | 15 | * @nb_args: number of parameters it takes |
16 | * @types: list of types as strings | 16 | * @types: list of types as strings |
17 | * @args: list of args as strings (args[i] matches types[i]) | 17 | * @args: list of args as strings (args[i] matches types[i]) |
18 | * @enter_id: associated ftrace enter event id | ||
19 | * @exit_id: associated ftrace exit event id | ||
20 | * @enter_event: associated syscall_enter trace event | 18 | * @enter_event: associated syscall_enter trace event |
21 | * @exit_event: associated syscall_exit trace event | 19 | * @exit_event: associated syscall_exit trace event |
22 | */ | 20 | */ |
@@ -25,8 +23,6 @@ struct syscall_metadata { | |||
25 | int nb_args; | 23 | int nb_args; |
26 | const char **types; | 24 | const char **types; |
27 | const char **args; | 25 | const char **args; |
28 | int enter_id; | ||
29 | int exit_id; | ||
30 | 26 | ||
31 | struct ftrace_event_call *enter_event; | 27 | struct ftrace_event_call *enter_event; |
32 | struct ftrace_event_call *exit_event; | 28 | struct ftrace_event_call *exit_event; |
@@ -35,8 +31,6 @@ struct syscall_metadata { | |||
35 | #ifdef CONFIG_FTRACE_SYSCALLS | 31 | #ifdef CONFIG_FTRACE_SYSCALLS |
36 | extern unsigned long arch_syscall_addr(int nr); | 32 | extern unsigned long arch_syscall_addr(int nr); |
37 | extern int syscall_name_to_nr(const char *name); | 33 | extern int syscall_name_to_nr(const char *name); |
38 | void set_syscall_enter_id(int num, int id); | ||
39 | void set_syscall_exit_id(int num, int id); | ||
40 | 34 | ||
41 | extern int syscall_enter_format(struct ftrace_event_call *call, | 35 | extern int syscall_enter_format(struct ftrace_event_call *call, |
42 | struct trace_seq *s); | 36 | struct trace_seq *s); |
diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c index 39649b1675dd..27eb18d69222 100644 --- a/kernel/trace/trace_syscalls.c +++ b/kernel/trace/trace_syscalls.c | |||
@@ -67,16 +67,6 @@ int syscall_name_to_nr(const char *name) | |||
67 | return -1; | 67 | return -1; |
68 | } | 68 | } |
69 | 69 | ||
70 | void set_syscall_enter_id(int num, int id) | ||
71 | { | ||
72 | syscalls_metadata[num]->enter_id = id; | ||
73 | } | ||
74 | |||
75 | void set_syscall_exit_id(int num, int id) | ||
76 | { | ||
77 | syscalls_metadata[num]->exit_id = id; | ||
78 | } | ||
79 | |||
80 | enum print_line_t | 70 | enum print_line_t |
81 | print_syscall_enter(struct trace_iterator *iter, int flags) | 71 | print_syscall_enter(struct trace_iterator *iter, int flags) |
82 | { | 72 | { |
@@ -93,7 +83,7 @@ print_syscall_enter(struct trace_iterator *iter, int flags) | |||
93 | if (!entry) | 83 | if (!entry) |
94 | goto end; | 84 | goto end; |
95 | 85 | ||
96 | if (entry->enter_id != ent->type) { | 86 | if (entry->enter_event->id != ent->type) { |
97 | WARN_ON_ONCE(1); | 87 | WARN_ON_ONCE(1); |
98 | goto end; | 88 | goto end; |
99 | } | 89 | } |
@@ -148,7 +138,7 @@ print_syscall_exit(struct trace_iterator *iter, int flags) | |||
148 | return TRACE_TYPE_HANDLED; | 138 | return TRACE_TYPE_HANDLED; |
149 | } | 139 | } |
150 | 140 | ||
151 | if (entry->exit_id != ent->type) { | 141 | if (entry->exit_event->id != ent->type) { |
152 | WARN_ON_ONCE(1); | 142 | WARN_ON_ONCE(1); |
153 | return TRACE_TYPE_UNHANDLED; | 143 | return TRACE_TYPE_UNHANDLED; |
154 | } | 144 | } |
@@ -302,8 +292,8 @@ void ftrace_syscall_enter(struct pt_regs *regs, long id) | |||
302 | 292 | ||
303 | size = sizeof(*entry) + sizeof(unsigned long) * sys_data->nb_args; | 293 | size = sizeof(*entry) + sizeof(unsigned long) * sys_data->nb_args; |
304 | 294 | ||
305 | event = trace_current_buffer_lock_reserve(&buffer, sys_data->enter_id, | 295 | event = trace_current_buffer_lock_reserve(&buffer, |
306 | size, 0, 0); | 296 | sys_data->enter_event->id, size, 0, 0); |
307 | if (!event) | 297 | if (!event) |
308 | return; | 298 | return; |
309 | 299 | ||
@@ -334,8 +324,8 @@ void ftrace_syscall_exit(struct pt_regs *regs, long ret) | |||
334 | if (!sys_data) | 324 | if (!sys_data) |
335 | return; | 325 | return; |
336 | 326 | ||
337 | event = trace_current_buffer_lock_reserve(&buffer, sys_data->exit_id, | 327 | event = trace_current_buffer_lock_reserve(&buffer, |
338 | sizeof(*entry), 0, 0); | 328 | sys_data->exit_event->id, sizeof(*entry), 0, 0); |
339 | if (!event) | 329 | if (!event) |
340 | return; | 330 | return; |
341 | 331 | ||
@@ -510,11 +500,11 @@ static void prof_syscall_enter(struct pt_regs *regs, long id) | |||
510 | 500 | ||
511 | rec = (struct syscall_trace_enter *) raw_data; | 501 | rec = (struct syscall_trace_enter *) raw_data; |
512 | tracing_generic_entry_update(&rec->ent, 0, 0); | 502 | tracing_generic_entry_update(&rec->ent, 0, 0); |
513 | rec->ent.type = sys_data->enter_id; | 503 | rec->ent.type = sys_data->enter_event->id; |
514 | rec->nr = syscall_nr; | 504 | rec->nr = syscall_nr; |
515 | syscall_get_arguments(current, regs, 0, sys_data->nb_args, | 505 | syscall_get_arguments(current, regs, 0, sys_data->nb_args, |
516 | (unsigned long *)&rec->args); | 506 | (unsigned long *)&rec->args); |
517 | perf_tp_event(sys_data->enter_id, 0, 1, rec, size); | 507 | perf_tp_event(sys_data->enter_event->id, 0, 1, rec, size); |
518 | 508 | ||
519 | end: | 509 | end: |
520 | perf_swevent_put_recursion_context(rctx); | 510 | perf_swevent_put_recursion_context(rctx); |
@@ -615,11 +605,11 @@ static void prof_syscall_exit(struct pt_regs *regs, long ret) | |||
615 | rec = (struct syscall_trace_exit *)raw_data; | 605 | rec = (struct syscall_trace_exit *)raw_data; |
616 | 606 | ||
617 | tracing_generic_entry_update(&rec->ent, 0, 0); | 607 | tracing_generic_entry_update(&rec->ent, 0, 0); |
618 | rec->ent.type = sys_data->exit_id; | 608 | rec->ent.type = sys_data->exit_event->id; |
619 | rec->nr = syscall_nr; | 609 | rec->nr = syscall_nr; |
620 | rec->ret = syscall_get_return_value(current, regs); | 610 | rec->ret = syscall_get_return_value(current, regs); |
621 | 611 | ||
622 | perf_tp_event(sys_data->exit_id, 0, 1, rec, size); | 612 | perf_tp_event(sys_data->exit_event->id, 0, 1, rec, size); |
623 | 613 | ||
624 | end: | 614 | end: |
625 | perf_swevent_put_recursion_context(rctx); | 615 | perf_swevent_put_recursion_context(rctx); |