Commit f744bd57 authored by Jason Baron's avatar Jason Baron Committed by Frederic Weisbecker

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: default avatarJason 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: default avatarFrederic Weisbecker <fweisbec@gmail.com>
parent 9daa77e2
...@@ -925,15 +925,6 @@ event_create_dir(struct ftrace_event_call *call, struct dentry *d_events, ...@@ -925,15 +925,6 @@ event_create_dir(struct ftrace_event_call *call, struct dentry *d_events,
if (strcmp(call->system, TRACE_SYSTEM) != 0) if (strcmp(call->system, TRACE_SYSTEM) != 0)
d_events = event_subsystem_dir(call->system, d_events); d_events = event_subsystem_dir(call->system, d_events);
if (call->raw_init) {
ret = call->raw_init();
if (ret < 0) {
pr_warning("Could not initialize trace point"
" events/%s\n", call->name);
return ret;
}
}
call->dir = debugfs_create_dir(call->name, d_events); call->dir = debugfs_create_dir(call->name, d_events);
if (!call->dir) { if (!call->dir) {
pr_warning("Could not create debugfs " pr_warning("Could not create debugfs "
...@@ -1058,6 +1049,7 @@ static void trace_module_add_events(struct module *mod) ...@@ -1058,6 +1049,7 @@ static void trace_module_add_events(struct module *mod)
struct ftrace_module_file_ops *file_ops = NULL; struct ftrace_module_file_ops *file_ops = NULL;
struct ftrace_event_call *call, *start, *end; struct ftrace_event_call *call, *start, *end;
struct dentry *d_events; struct dentry *d_events;
int ret;
start = mod->trace_events; start = mod->trace_events;
end = mod->trace_events + mod->num_trace_events; end = mod->trace_events + mod->num_trace_events;
...@@ -1073,7 +1065,15 @@ static void trace_module_add_events(struct module *mod) ...@@ -1073,7 +1065,15 @@ static void trace_module_add_events(struct module *mod)
/* The linker may leave blanks */ /* The linker may leave blanks */
if (!call->name) if (!call->name)
continue; continue;
if (call->raw_init) {
ret = call->raw_init();
if (ret < 0) {
if (ret != -ENOSYS)
pr_warning("Could not initialize trace "
"point events/%s\n", call->name);
continue;
}
}
/* /*
* This module has events, create file ops for this module * This module has events, create file ops for this module
* if not already done. * if not already done.
...@@ -1225,6 +1225,15 @@ static __init int event_trace_init(void) ...@@ -1225,6 +1225,15 @@ static __init int event_trace_init(void)
/* The linker may leave blanks */ /* The linker may leave blanks */
if (!call->name) if (!call->name)
continue; continue;
if (call->raw_init) {
ret = call->raw_init();
if (ret < 0) {
if (ret != -ENOSYS)
pr_warning("Could not initialize trace "
"point events/%s\n", call->name);
continue;
}
}
list_add(&call->list, &ftrace_events); list_add(&call->list, &ftrace_events);
event_create_dir(call, d_events, &ftrace_event_id_fops, event_create_dir(call, d_events, &ftrace_event_id_fops,
&ftrace_enable_fops, &ftrace_event_filter_fops, &ftrace_enable_fops, &ftrace_event_filter_fops,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment