Skip to content

Commit

Permalink
tracing: Don't display trigger file for events that can't be enabled
Browse files Browse the repository at this point in the history
Currently register functions for events will be called
through the 'reg' field of event class directly without
any check when seting up triggers.

Triggers for events that don't support register through
debug fs (events under events/ftrace are for trace-cmd to
read event format, and most of them don't have a register
function except events/ftrace/functionx) can't be enabled
at all, and an oops will be hit when setting up trigger
for those events, so just not creating them is an easy way
to avoid the oops.

Link: http://lkml.kernel.org/r/1462275274-3911-1-git-send-email-chuhu@redhat.com

Cc: stable@vger.kernel.org # 3.14+
Fixes: 85f2b08 ("tracing: Add basic event trigger framework")
Signed-off-by: Chunyu Hu <chuhu@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
  • Loading branch information
Chunyu Hu authored and Steven Rostedt committed May 3, 2016
1 parent 04974df commit 854145e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions kernel/trace/trace_events.c
Original file line number Diff line number Diff line change
Expand Up @@ -2095,8 +2095,13 @@ event_create_dir(struct dentry *parent, struct trace_event_file *file)
trace_create_file("filter", 0644, file->dir, file,
&ftrace_event_filter_fops);

trace_create_file("trigger", 0644, file->dir, file,
&event_trigger_fops);
/*
* Only event directories that can be enabled should have
* triggers.
*/
if (!(call->flags & TRACE_EVENT_FL_IGNORE_ENABLE))
trace_create_file("trigger", 0644, file->dir, file,
&event_trigger_fops);

trace_create_file("format", 0444, file->dir, call,
&ftrace_event_format_fops);
Expand Down

0 comments on commit 854145e

Please sign in to comment.