diff options
author | Jason Baron <jbaron@redhat.com> | 2009-08-10 16:52:39 -0400 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2009-08-11 14:35:27 -0400 |
commit | f744bd576a827c5b02e756b81fc2578edf8179b8 (patch) | |
tree | d2e1242d87953476ee6cacb7e34e0f791b641c02 /kernel/trace/trace_events.c | |
parent | 9daa77e2e9a6b8b859660d5e24d0f8cd77c2af39 (diff) |
tracing: Raw_init() bailout in trace event register fail case
Allow the return value of raw_init() trace event callback to bail us out
of creating a trace event file, in case we fail to register our
event.
Also, we plan to return -ENOSYS for syscall events that don't match any
syscalls listed in our arch tracing syscall table, we don't want to warn
in that case, we just want this event to be invisible in debugfs and
ignored.
Signed-off-by: Jason Baron <jbaron@redhat.com>
Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: Jiaying Zhang <jiayingz@google.com>
Cc: Martin Bligh <mbligh@google.com>
Cc: Li Zefan <lizf@cn.fujitsu.com>
Cc: Masami Hiramatsu <mhiramat@redhat.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Diffstat (limited to 'kernel/trace/trace_events.c')
-rw-r--r-- | kernel/trace/trace_events.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index e0cbede96783..f95f8470dd38 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
@@ -925,15 +925,6 @@ event_create_dir(struct ftrace_event_call *call, struct dentry *d_events, | |||
925 | if (strcmp(call->system, TRACE_SYSTEM) != 0) | 925 | if (strcmp(call->system, TRACE_SYSTEM) != 0) |
926 | d_events = event_subsystem_dir(call->system, d_events); | 926 | d_events = event_subsystem_dir(call->system, d_events); |
927 | 927 | ||
928 | if (call->raw_init) { | ||
929 | ret = call->raw_init(); | ||
930 | if (ret < 0) { | ||
931 | pr_warning("Could not initialize trace point" | ||
932 | " events/%s\n", call->name); | ||
933 | return ret; | ||
934 | } | ||
935 | } | ||
936 | |||
937 | call->dir = debugfs_create_dir(call->name, d_events); | 928 | call->dir = debugfs_create_dir(call->name, d_events); |
938 | if (!call->dir) { | 929 | if (!call->dir) { |
939 | pr_warning("Could not create debugfs " | 930 | pr_warning("Could not create debugfs " |
@@ -1058,6 +1049,7 @@ static void trace_module_add_events(struct module *mod) | |||
1058 | struct ftrace_module_file_ops *file_ops = NULL; | 1049 | struct ftrace_module_file_ops *file_ops = NULL; |
1059 | struct ftrace_event_call *call, *start, *end; | 1050 | struct ftrace_event_call *call, *start, *end; |
1060 | struct dentry *d_events; | 1051 | struct dentry *d_events; |
1052 | int ret; | ||
1061 | 1053 | ||
1062 | start = mod->trace_events; | 1054 | start = mod->trace_events; |
1063 | end = mod->trace_events + mod->num_trace_events; | 1055 | end = mod->trace_events + mod->num_trace_events; |
@@ -1073,7 +1065,15 @@ static void trace_module_add_events(struct module *mod) | |||
1073 | /* The linker may leave blanks */ | 1065 | /* The linker may leave blanks */ |
1074 | if (!call->name) | 1066 | if (!call->name) |
1075 | continue; | 1067 | continue; |
1076 | 1068 | if (call->raw_init) { | |
1069 | ret = call->raw_init(); | ||
1070 | if (ret < 0) { | ||
1071 | if (ret != -ENOSYS) | ||
1072 | pr_warning("Could not initialize trace " | ||
1073 | "point events/%s\n", call->name); | ||
1074 | continue; | ||
1075 | } | ||
1076 | } | ||
1077 | /* | 1077 | /* |
1078 | * This module has events, create file ops for this module | 1078 | * This module has events, create file ops for this module |
1079 | * if not already done. | 1079 | * if not already done. |
@@ -1225,6 +1225,15 @@ static __init int event_trace_init(void) | |||
1225 | /* The linker may leave blanks */ | 1225 | /* The linker may leave blanks */ |
1226 | if (!call->name) | 1226 | if (!call->name) |
1227 | continue; | 1227 | continue; |
1228 | if (call->raw_init) { | ||
1229 | ret = call->raw_init(); | ||
1230 | if (ret < 0) { | ||
1231 | if (ret != -ENOSYS) | ||
1232 | pr_warning("Could not initialize trace " | ||
1233 | "point events/%s\n", call->name); | ||
1234 | continue; | ||
1235 | } | ||
1236 | } | ||
1228 | list_add(&call->list, &ftrace_events); | 1237 | list_add(&call->list, &ftrace_events); |
1229 | event_create_dir(call, d_events, &ftrace_event_id_fops, | 1238 | event_create_dir(call, d_events, &ftrace_event_id_fops, |
1230 | &ftrace_enable_fops, &ftrace_event_filter_fops, | 1239 | &ftrace_enable_fops, &ftrace_event_filter_fops, |