Re: [PATCH] ftrace: fix perf-tracepoint OOPS

Steven Rostedt
2009-08-05T18:53:25Z

On Wed, 5 Aug 2009, Peter Zijlstra wrote:

> 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>

Acked-by: Steven Rostedt <rostedt@goodmis.org>

-- Steve

> ---
> kernel/trace/trace_event_profile.c | 2 +-
> kernel/trace/trace_events.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/trace/trace_event_profile.c b/kernel/trace/trace_event_profile.c
> index 5b5895a..11ba5bb 100644
> --- a/kernel/trace/trace_event_profile.c
> +++ b/kernel/trace/trace_event_profile.c
> @@ -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;
> }
> diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
> index 90cdec5..e2b301d 100644
> --- a/kernel/trace/trace_events.c
> +++ b/kernel/trace/trace_events.c
> @@ -971,7 +971,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);
>
>
>
>