Commit af6af30c authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar

ftrace: Fix perf-tracepoint OOPS

Not all tracepoints are created equal, in specific the ftrace
tracepoints are created with TRACE_EVENT_FORMAT() which does
not generate the needed bits to tie them into perf counters.

For those events, don't create the 'id' file and fail
->profile_enable when their ID is specified through other
means.
Reported-by: default avatarChris Mason <chris.mason@oracle.com>
Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
LKML-Reference: <1249497664.5890.4.camel@laptop>
[ v2: fix build error in the !CONFIG_EVENT_PROFILE case ]
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 386c0b70
...@@ -119,11 +119,9 @@ struct ftrace_event_call { ...@@ -119,11 +119,9 @@ struct ftrace_event_call {
void *filter; void *filter;
void *mod; void *mod;
#ifdef CONFIG_EVENT_PROFILE atomic_t profile_count;
atomic_t profile_count; int (*profile_enable)(struct ftrace_event_call *);
int (*profile_enable)(struct ftrace_event_call *); void (*profile_disable)(struct ftrace_event_call *);
void (*profile_disable)(struct ftrace_event_call *);
#endif
}; };
#define MAX_FILTER_PRED 32 #define MAX_FILTER_PRED 32
......
...@@ -14,7 +14,7 @@ int ftrace_profile_enable(int event_id) ...@@ -14,7 +14,7 @@ int ftrace_profile_enable(int event_id)
mutex_lock(&event_mutex); mutex_lock(&event_mutex);
list_for_each_entry(event, &ftrace_events, list) { list_for_each_entry(event, &ftrace_events, list) {
if (event->id == event_id) { if (event->id == event_id && event->profile_enable) {
ret = event->profile_enable(event); ret = event->profile_enable(event);
break; break;
} }
......
...@@ -940,7 +940,7 @@ event_create_dir(struct ftrace_event_call *call, struct dentry *d_events, ...@@ -940,7 +940,7 @@ event_create_dir(struct ftrace_event_call *call, struct dentry *d_events,
entry = trace_create_file("enable", 0644, call->dir, call, entry = trace_create_file("enable", 0644, call->dir, call,
enable); enable);
if (call->id) if (call->id && call->profile_enable)
entry = trace_create_file("id", 0444, call->dir, call, entry = trace_create_file("id", 0444, call->dir, call,
id); id);
......
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