Re: [tip:perfcounters/urgent] ftrace: Fix perf-tracepoint OOPS

Peter Zijlstra
2009-08-06T09:12:12Z

> [ v2: fix build error in the !CONFIG_EVENT_PROFILE case ]
> Signed-off-by: Ingo Molnar <mingo@elte.hu>
>
>
> ---
> include/linux/ftrace_event.h | 8 +++-----
> kernel/trace/trace_event_profile.c | 2 +-
> kernel/trace/trace_events.c | 2 +-
> 3 files changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
> index 5c093ff..d7cd193 100644
> --- a/include/linux/ftrace_event.h
> +++ b/include/linux/ftrace_event.h
> @@ -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 *);
> };

Ah, I would have added ifdefs around the below bit.

> diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
> index 23d2972..e75276a 100644
> --- a/kernel/trace/trace_events.c
> +++ b/kernel/trace/trace_events.c
> @@ -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)
#ifdef CONFIG_EVENT_PROFILE
> + if (call->id && call->profile_enable)
> entry = trace_create_file("id", 0444, call->dir, call,
> id);
#endif

Like that, but I guess this works too ;-)