aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_syscalls.c
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2009-09-02 14:17:06 -0400
committerSteven Rostedt <rostedt@goodmis.org>2009-09-04 18:59:39 -0400
commite77405ad80f53966524b5c31244e13fbbbecbd84 (patch)
tree65c05f9e1573e9958e52bb72655e00c8592aacd2 /kernel/trace/trace_syscalls.c
parentf633903af2ceb0cec07d45e499a072b6593d0ed1 (diff)
tracing: pass around ring buffer instead of tracer
The latency tracers (irqsoff and wakeup) can swap trace buffers on the fly. If an event is happening and has reserved data on one of the buffers, and the latency tracer swaps the global buffer with the max buffer, the result is that the event may commit the data to the wrong buffer. This patch changes the API to the trace recording to be recieve the buffer that was used to reserve a commit. Then this buffer can be passed in to the commit. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace_syscalls.c')
-rw-r--r--kernel/trace/trace_syscalls.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c
index 4f5fae6fad90..8712ce3c6a0e 100644
--- a/kernel/trace/trace_syscalls.c
+++ b/kernel/trace/trace_syscalls.c
@@ -223,6 +223,7 @@ void ftrace_syscall_enter(struct pt_regs *regs, long id)
223 struct syscall_trace_enter *entry; 223 struct syscall_trace_enter *entry;
224 struct syscall_metadata *sys_data; 224 struct syscall_metadata *sys_data;
225 struct ring_buffer_event *event; 225 struct ring_buffer_event *event;
226 struct ring_buffer *buffer;
226 int size; 227 int size;
227 int syscall_nr; 228 int syscall_nr;
228 229
@@ -238,8 +239,8 @@ void ftrace_syscall_enter(struct pt_regs *regs, long id)
238 239
239 size = sizeof(*entry) + sizeof(unsigned long) * sys_data->nb_args; 240 size = sizeof(*entry) + sizeof(unsigned long) * sys_data->nb_args;
240 241
241 event = trace_current_buffer_lock_reserve(sys_data->enter_id, size, 242 event = trace_current_buffer_lock_reserve(&buffer, sys_data->enter_id,
242 0, 0); 243 size, 0, 0);
243 if (!event) 244 if (!event)
244 return; 245 return;
245 246
@@ -247,8 +248,9 @@ void ftrace_syscall_enter(struct pt_regs *regs, long id)
247 entry->nr = syscall_nr; 248 entry->nr = syscall_nr;
248 syscall_get_arguments(current, regs, 0, sys_data->nb_args, entry->args); 249 syscall_get_arguments(current, regs, 0, sys_data->nb_args, entry->args);
249 250
250 if (!filter_current_check_discard(sys_data->enter_event, entry, event)) 251 if (!filter_current_check_discard(buffer, sys_data->enter_event,
251 trace_current_buffer_unlock_commit(event, 0, 0); 252 entry, event))
253 trace_current_buffer_unlock_commit(buffer, event, 0, 0);
252} 254}
253 255
254void ftrace_syscall_exit(struct pt_regs *regs, long ret) 256void ftrace_syscall_exit(struct pt_regs *regs, long ret)
@@ -256,6 +258,7 @@ void ftrace_syscall_exit(struct pt_regs *regs, long ret)
256 struct syscall_trace_exit *entry; 258 struct syscall_trace_exit *entry;
257 struct syscall_metadata *sys_data; 259 struct syscall_metadata *sys_data;
258 struct ring_buffer_event *event; 260 struct ring_buffer_event *event;
261 struct ring_buffer *buffer;
259 int syscall_nr; 262 int syscall_nr;
260 263
261 syscall_nr = syscall_get_nr(current, regs); 264 syscall_nr = syscall_get_nr(current, regs);
@@ -268,7 +271,7 @@ void ftrace_syscall_exit(struct pt_regs *regs, long ret)
268 if (!sys_data) 271 if (!sys_data)
269 return; 272 return;
270 273
271 event = trace_current_buffer_lock_reserve(sys_data->exit_id, 274 event = trace_current_buffer_lock_reserve(&buffer, sys_data->exit_id,
272 sizeof(*entry), 0, 0); 275 sizeof(*entry), 0, 0);
273 if (!event) 276 if (!event)
274 return; 277 return;
@@ -277,8 +280,9 @@ void ftrace_syscall_exit(struct pt_regs *regs, long ret)
277 entry->nr = syscall_nr; 280 entry->nr = syscall_nr;
278 entry->ret = syscall_get_return_value(current, regs); 281 entry->ret = syscall_get_return_value(current, regs);
279 282
280 if (!filter_current_check_discard(sys_data->exit_event, entry, event)) 283 if (!filter_current_check_discard(buffer, sys_data->exit_event,
281 trace_current_buffer_unlock_commit(event, 0, 0); 284 entry, event))
285 trace_current_buffer_unlock_commit(buffer, event, 0, 0);
282} 286}
283 287
284int reg_event_syscall_enter(void *ptr) 288int reg_event_syscall_enter(void *ptr)