[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1462198454-17342-1-git-send-email-chuhu@redhat.com>
Date: Mon, 2 May 2016 22:14:14 +0800
From: Chunyu Hu <chuhu@...hat.com>
To: rostedt@...dmis.org
Cc: linux-kernel@...r.kernel.org
Subject: [PATCH] tracing: Don't display trigger file for events that don't have register func
Currently register function of the event 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 perf to
read event format, and most of them don't have regisgter
function except events/ftrace/function.) can't be enabled
at all, and an oops will be hit when setting up trigger
for those events, so just not showing them is an easy way
to avoid the oops.
Signed-off-by: Chunyu Hu <chuhu@...hat.com>
---
kernel/trace/trace_events.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index da1eeb6..9fb99fd 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -2138,9 +2138,10 @@ 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);
-
+ if (call->class->reg) {
+ trace_create_file("trigger", 0644, file->dir, file,
+ &event_trigger_fops);
+ }
#ifdef CONFIG_HIST_TRIGGERS
trace_create_file("hist", 0444, file->dir, file,
&event_hist_fops);
--
1.8.3.1
Powered by blists - more mailing lists