aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/trace.h6
-rw-r--r--kernel/trace/trace_syscalls.c26
2 files changed, 16 insertions, 16 deletions
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index d682357e4b1f..300ef788c976 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -34,8 +34,6 @@ enum trace_type {
34 TRACE_GRAPH_ENT, 34 TRACE_GRAPH_ENT,
35 TRACE_USER_STACK, 35 TRACE_USER_STACK,
36 TRACE_HW_BRANCHES, 36 TRACE_HW_BRANCHES,
37 TRACE_SYSCALL_ENTER,
38 TRACE_SYSCALL_EXIT,
39 TRACE_KMEM_ALLOC, 37 TRACE_KMEM_ALLOC,
40 TRACE_KMEM_FREE, 38 TRACE_KMEM_FREE,
41 TRACE_POWER, 39 TRACE_POWER,
@@ -319,10 +317,6 @@ extern void __ftrace_bad_type(void);
319 TRACE_KMEM_ALLOC); \ 317 TRACE_KMEM_ALLOC); \
320 IF_ASSIGN(var, ent, struct kmemtrace_free_entry, \ 318 IF_ASSIGN(var, ent, struct kmemtrace_free_entry, \
321 TRACE_KMEM_FREE); \ 319 TRACE_KMEM_FREE); \
322 IF_ASSIGN(var, ent, struct syscall_trace_enter, \
323 TRACE_SYSCALL_ENTER); \
324 IF_ASSIGN(var, ent, struct syscall_trace_exit, \
325 TRACE_SYSCALL_EXIT); \
326 __ftrace_bad_type(); \ 320 __ftrace_bad_type(); \
327 } while (0) 321 } while (0)
328 322
diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c
index c7ae25ee95d8..e58a9c11ba85 100644
--- a/kernel/trace/trace_syscalls.c
+++ b/kernel/trace/trace_syscalls.c
@@ -36,14 +36,18 @@ print_syscall_enter(struct trace_iterator *iter, int flags)
36 struct syscall_metadata *entry; 36 struct syscall_metadata *entry;
37 int i, ret, syscall; 37 int i, ret, syscall;
38 38
39 trace_assign_type(trace, ent); 39 trace = (typeof(trace))ent;
40
41 syscall = trace->nr; 40 syscall = trace->nr;
42
43 entry = syscall_nr_to_meta(syscall); 41 entry = syscall_nr_to_meta(syscall);
42
44 if (!entry) 43 if (!entry)
45 goto end; 44 goto end;
46 45
46 if (entry->enter_id != ent->type) {
47 WARN_ON_ONCE(1);
48 goto end;
49 }
50
47 ret = trace_seq_printf(s, "%s(", entry->name); 51 ret = trace_seq_printf(s, "%s(", entry->name);
48 if (!ret) 52 if (!ret)
49 return TRACE_TYPE_PARTIAL_LINE; 53 return TRACE_TYPE_PARTIAL_LINE;
@@ -78,16 +82,20 @@ print_syscall_exit(struct trace_iterator *iter, int flags)
78 struct syscall_metadata *entry; 82 struct syscall_metadata *entry;
79 int ret; 83 int ret;
80 84
81 trace_assign_type(trace, ent); 85 trace = (typeof(trace))ent;
82
83 syscall = trace->nr; 86 syscall = trace->nr;
84
85 entry = syscall_nr_to_meta(syscall); 87 entry = syscall_nr_to_meta(syscall);
88
86 if (!entry) { 89 if (!entry) {
87 trace_seq_printf(s, "\n"); 90 trace_seq_printf(s, "\n");
88 return TRACE_TYPE_HANDLED; 91 return TRACE_TYPE_HANDLED;
89 } 92 }
90 93
94 if (entry->exit_id != ent->type) {
95 WARN_ON_ONCE(1);
96 return TRACE_TYPE_UNHANDLED;
97 }
98
91 ret = trace_seq_printf(s, "%s -> 0x%lx\n", entry->name, 99 ret = trace_seq_printf(s, "%s -> 0x%lx\n", entry->name,
92 trace->ret); 100 trace->ret);
93 if (!ret) 101 if (!ret)
@@ -114,7 +122,7 @@ void ftrace_syscall_enter(struct pt_regs *regs, long id)
114 122
115 size = sizeof(*entry) + sizeof(unsigned long) * sys_data->nb_args; 123 size = sizeof(*entry) + sizeof(unsigned long) * sys_data->nb_args;
116 124
117 event = trace_current_buffer_lock_reserve(TRACE_SYSCALL_ENTER, size, 125 event = trace_current_buffer_lock_reserve(sys_data->enter_id, size,
118 0, 0); 126 0, 0);
119 if (!event) 127 if (!event)
120 return; 128 return;
@@ -142,7 +150,7 @@ void ftrace_syscall_exit(struct pt_regs *regs, long ret)
142 if (!sys_data) 150 if (!sys_data)
143 return; 151 return;
144 152
145 event = trace_current_buffer_lock_reserve(TRACE_SYSCALL_EXIT, 153 event = trace_current_buffer_lock_reserve(sys_data->exit_id,
146 sizeof(*entry), 0, 0); 154 sizeof(*entry), 0, 0);
147 if (!event) 155 if (!event)
148 return; 156 return;
@@ -239,10 +247,8 @@ void unreg_event_syscall_exit(void *ptr)
239 247
240struct trace_event event_syscall_enter = { 248struct trace_event event_syscall_enter = {
241 .trace = print_syscall_enter, 249 .trace = print_syscall_enter,
242 .type = TRACE_SYSCALL_ENTER
243}; 250};
244 251
245struct trace_event event_syscall_exit = { 252struct trace_event event_syscall_exit = {
246 .trace = print_syscall_exit, 253 .trace = print_syscall_exit,
247 .type = TRACE_SYSCALL_EXIT
248}; 254};