summaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_syscalls.c
diff options
context:
space:
mode:
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>2014-01-07 03:32:10 +0100
committerSteven Rostedt <rostedt@goodmis.org>2014-01-10 03:20:07 +0100
commit13a1e4aef53b2a7684ddee374e749999ba103b4a (patch)
tree74acb760b6d12d4faaae4c4c76a146855e8352a5 /kernel/trace/trace_syscalls.c
parenttracing: Fix counter for traceon/off event triggers (diff)
downloadlinux-13a1e4aef53b2a7684ddee374e749999ba103b4a.tar.xz
linux-13a1e4aef53b2a7684ddee374e749999ba103b4a.zip
tracing: Consolidate event trigger code
The event trigger code that checks for callback triggers before and after recording of an event has lots of flags checks. This code is duplicated throughout the ftrace events, kprobes and system calls. They all do the exact same checks against the event flags. Added helper functions ftrace_trigger_soft_disabled(), event_trigger_unlock_commit() and event_trigger_unlock_commit_regs() that consolidated the code and these are used instead. Link: http://lkml.kernel.org/r/20140106222703.5e7dbba2@gandalf.local.home Acked-by: Tom Zanussi <tom.zanussi@linux.intel.com> Tested-by: Tom Zanussi <tom.zanussi@linux.intel.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace_syscalls.c')
-rw-r--r--kernel/trace/trace_syscalls.c48
1 files changed, 8 insertions, 40 deletions
diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c
index a4acf9bbffa7..759d5e004517 100644
--- a/kernel/trace/trace_syscalls.c
+++ b/kernel/trace/trace_syscalls.c
@@ -306,10 +306,8 @@ static void ftrace_syscall_enter(void *data, struct pt_regs *regs, long id)
struct syscall_trace_enter *entry;
struct syscall_metadata *sys_data;
struct ring_buffer_event *event;
- enum event_trigger_type tt = ETT_NONE;
struct ring_buffer *buffer;
unsigned long irq_flags;
- unsigned long eflags;
int pc;
int syscall_nr;
int size;
@@ -323,14 +321,8 @@ static void ftrace_syscall_enter(void *data, struct pt_regs *regs, long id)
if (!ftrace_file)
return;
- eflags = ftrace_file->flags;
-
- if (!(eflags & FTRACE_EVENT_FL_TRIGGER_COND)) {
- if (eflags & FTRACE_EVENT_FL_TRIGGER_MODE)
- event_triggers_call(ftrace_file, NULL);
- if (eflags & FTRACE_EVENT_FL_SOFT_DISABLED)
- return;
- }
+ if (ftrace_trigger_soft_disabled(ftrace_file))
+ return;
sys_data = syscall_nr_to_meta(syscall_nr);
if (!sys_data)
@@ -351,16 +343,8 @@ static void ftrace_syscall_enter(void *data, struct pt_regs *regs, long id)
entry->nr = syscall_nr;
syscall_get_arguments(current, regs, 0, sys_data->nb_args, entry->args);
- if (eflags & FTRACE_EVENT_FL_TRIGGER_COND)
- tt = event_triggers_call(ftrace_file, entry);
-
- if (test_bit(FTRACE_EVENT_FL_SOFT_DISABLED_BIT, &ftrace_file->flags))
- ring_buffer_discard_commit(buffer, event);
- else if (!filter_check_discard(ftrace_file, entry, buffer, event))
- trace_current_buffer_unlock_commit(buffer, event,
- irq_flags, pc);
- if (tt)
- event_triggers_post_call(ftrace_file, tt);
+ event_trigger_unlock_commit(ftrace_file, buffer, event, entry,
+ irq_flags, pc);
}
static void ftrace_syscall_exit(void *data, struct pt_regs *regs, long ret)
@@ -370,10 +354,8 @@ static void ftrace_syscall_exit(void *data, struct pt_regs *regs, long ret)
struct syscall_trace_exit *entry;
struct syscall_metadata *sys_data;
struct ring_buffer_event *event;
- enum event_trigger_type tt = ETT_NONE;
struct ring_buffer *buffer;
unsigned long irq_flags;
- unsigned long eflags;
int pc;
int syscall_nr;
@@ -386,14 +368,8 @@ static void ftrace_syscall_exit(void *data, struct pt_regs *regs, long ret)
if (!ftrace_file)
return;
- eflags = ftrace_file->flags;
-
- if (!(eflags & FTRACE_EVENT_FL_TRIGGER_COND)) {
- if (eflags & FTRACE_EVENT_FL_TRIGGER_MODE)
- event_triggers_call(ftrace_file, NULL);
- if (eflags & FTRACE_EVENT_FL_SOFT_DISABLED)
- return;
- }
+ if (ftrace_trigger_soft_disabled(ftrace_file))
+ return;
sys_data = syscall_nr_to_meta(syscall_nr);
if (!sys_data)
@@ -413,16 +389,8 @@ static void ftrace_syscall_exit(void *data, struct pt_regs *regs, long ret)
entry->nr = syscall_nr;
entry->ret = syscall_get_return_value(current, regs);
- if (eflags & FTRACE_EVENT_FL_TRIGGER_COND)
- tt = event_triggers_call(ftrace_file, entry);
-
- if (test_bit(FTRACE_EVENT_FL_SOFT_DISABLED_BIT, &ftrace_file->flags))
- ring_buffer_discard_commit(buffer, event);
- else if (!filter_check_discard(ftrace_file, entry, buffer, event))
- trace_current_buffer_unlock_commit(buffer, event,
- irq_flags, pc);
- if (tt)
- event_triggers_post_call(ftrace_file, tt);
+ event_trigger_unlock_commit(ftrace_file, buffer, event, entry,
+ irq_flags, pc);
}
static int reg_event_syscall_enter(struct ftrace_event_file *file,