mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Chunyu Hu <chuhu@redhat.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tracing: Don't display trigger file for events that don't have register func
Date: Mon, 2 May 2016 22:42:44 -0400	[thread overview]
Message-ID: <20160502224244.1b17428c@grimm.local.home> (raw)
In-Reply-To: <1462198454-17342-1-git-send-email-chuhu@redhat.com>

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

  reply	other threads:[~2016-05-03  2:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-02 14:14 Chunyu Hu
2016-05-03  2:42 ` Steven Rostedt [this message]
2016-05-03 11:29   ` Chunyu Hu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160502224244.1b17428c@grimm.local.home \
    --to=rostedt@goodmis.org \
    --cc=chuhu@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®