Skip to content

Commit

Permalink
ftrace: Fix perf-tracepoint OOPS
Browse files Browse the repository at this point in the history
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: Chris Mason <chris.mason@oracle.com>
Signed-off-by: Peter 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: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Aug 6, 2009
1 parent 386c0b7 commit af6af30
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions include/linux/ftrace_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,9 @@ struct ftrace_event_call {
void *filter;
void *mod;

#ifdef CONFIG_EVENT_PROFILE
atomic_t profile_count;
int (*profile_enable)(struct ftrace_event_call *);
void (*profile_disable)(struct ftrace_event_call *);
#endif
atomic_t profile_count;
int (*profile_enable)(struct ftrace_event_call *);
void (*profile_disable)(struct ftrace_event_call *);
};

#define MAX_FILTER_PRED 32
Expand Down
2 changes: 1 addition & 1 deletion kernel/trace/trace_event_profile.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ int ftrace_profile_enable(int event_id)

mutex_lock(&event_mutex);
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);
break;
}
Expand Down
2 changes: 1 addition & 1 deletion kernel/trace/trace_events.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
enable);

if (call->id)
if (call->id && call->profile_enable)
entry = trace_create_file("id", 0444, call->dir, call,
id);

Expand Down

0 comments on commit af6af30

Please sign in to comment.