Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1392232 > unrolled thread
| Started by | Chunyu Hu <chuhu@redhat.com> |
|---|---|
| First post | 2016-05-02 16:20 +0200 |
| Last post | 2016-05-03 13:30 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] tracing: Don't display trigger file for events that don't have register func Chunyu Hu <chuhu@redhat.com> - 2016-05-02 16:20 +0200
Re: [PATCH] tracing: Don't display trigger file for events that don't have register func Steven Rostedt <rostedt@goodmis.org> - 2016-05-03 04:50 +0200
Re: [PATCH] tracing: Don't display trigger file for events that don't have register func Chunyu Hu <chuhu@redhat.com> - 2016-05-03 13:30 +0200
| From | Chunyu Hu <chuhu@redhat.com> |
|---|---|
| Date | 2016-05-02 16:20 +0200 |
| Subject | [PATCH] tracing: Don't display trigger file for events that don't have register func |
| Message-ID | <rumRz-4OA-9@gated-at.bofh.it> |
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@redhat.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
[toc] | [next] | [standalone]
| From | Steven Rostedt <rostedt@goodmis.org> |
|---|---|
| Date | 2016-05-03 04:50 +0200 |
| Subject | Re: [PATCH] tracing: Don't display trigger file for events that don't have register func |
| Message-ID | <ruyzn-7UY-1@gated-at.bofh.it> |
| In reply to | #1392232 |
On Mon, 2 May 2016 22:14:14 +0800
Chunyu Hu <chuhu@redhat.com> wrote:
> 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
Actually, they were created for trace-cmd. I'm not even sure if perf
uses the ftrace event formats.
> 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@redhat.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);
> + }
As you stated, reg is there for function tracing, and is not a good
value to use as a check. Use the following check instead:
if (!(call->flags & TRACE_EVENT_FL_IGNORE_ENABLE))
trace_create_file("trigger", 0644, file->dir, file,
&event_trigger_fops);
And add a comment that states that only event directories that can be
enabled should have triggers.
-- Steve
> #ifdef CONFIG_HIST_TRIGGERS
> trace_create_file("hist", 0444, file->dir, file,
> &event_hist_fops);
[toc] | [prev] | [next] | [standalone]
| From | Chunyu Hu <chuhu@redhat.com> |
|---|---|
| Date | 2016-05-03 13:30 +0200 |
| Subject | Re: [PATCH] tracing: Don't display trigger file for events that don't have register func |
| Message-ID | <ruGGC-7g5-15@gated-at.bofh.it> |
| In reply to | #1392998 |
----- Original Message -----
> From: "Steven Rostedt" <rostedt@goodmis.org>
> To: "Chunyu Hu" <chuhu@redhat.com>
> Cc: linux-kernel@vger.kernel.org
> Sent: Tuesday, May 3, 2016 10:42:44 AM
> Subject: Re: [PATCH] tracing: Don't display trigger file for events that don't have register func
>
> On Mon, 2 May 2016 22:14:14 +0800
> Chunyu Hu <chuhu@redhat.com> wrote:
>
> > 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
>
> Actually, they were created for trace-cmd. I'm not even sure if perf
> uses the ftrace event formats.
Thanks for correcting me. I misunderstood it.
>
> > 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@redhat.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);
> > + }
>
> As you stated, reg is there for function tracing, and is not a good
> value to use as a check. Use the following check instead:
>
> if (!(call->flags & TRACE_EVENT_FL_IGNORE_ENABLE))
> trace_create_file("trigger", 0644, file->dir, file,
> &event_trigger_fops);
Thanks. Agree, will prepare v2 for this.
It looks like that checking both is safest way, like other parts
did in trace_events.c. but i didn't see other events using
TRACE_EVENT_FL_IGNORE_ENABLE, ftrace event sub system is the only user now.
and didn't see other events that don't have register func.
so i think it's safe to use only this flag to check it.
> And add a comment that states that only event directories that can be
> enabled should have triggers.
Ok.
> -- Steve
>
>
>
> > #ifdef CONFIG_HIST_TRIGGERS
> > trace_create_file("hist", 0444, file->dir, file,
> > &event_hist_fops);
>
>
--
Regards,
Chunyu Hu
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web