linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Yordan Karadzhov <y.karadz@gmail.com>
Subject: [GIT PULL] tracing: Fix output of top level event "enable" file
Date: Mon, 8 Feb 2021 14:22:58 -0500	[thread overview]
Message-ID: <20210208142258.643b54a3@gandalf.local.home> (raw)

Steven Rostedt (VMware) <rostedt@goodmis.org>

Linus,

tracing: Fix output of top level event "enable" file

When writing a tool for enabling events in the tracing system,
an anomaly was discovered. The top level event "enable" file would
never show "1" when all events were enabled. The system and event
"enable" files worked as expected. The reason was because the top
level event "enable" file included the "ftrace" tracer events,
which are not controlled by the "enable" file and would cause the
output to be wrong. This appears to have been a bug since it was created.


Please pull the latest trace-v5.11-rc7 tree, which can be found at:


  git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
trace-v5.11-rc7

Tag SHA1: 3587b86427167a0380d98a8d744a2beb1fa8a9d6
Head SHA1: 256cfdd6fdf70c6fcf0f7c8ddb0ebd73ce8f3bc9


Steven Rostedt (VMware) (1):
      tracing: Do not count ftrace events in top level enable output

----
 kernel/trace/trace_events.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---------------------------
commit 256cfdd6fdf70c6fcf0f7c8ddb0ebd73ce8f3bc9
Author: Steven Rostedt (VMware) <rostedt@goodmis.org>
Date:   Fri Feb 5 15:40:04 2021 -0500

    tracing: Do not count ftrace events in top level enable output
    
    The file /sys/kernel/tracing/events/enable is used to enable all events by
    echoing in "1", or disabling all events when echoing in "0". To know if all
    events are enabled, disabled, or some are enabled but not all of them,
    cating the file should show either "1" (all enabled), "0" (all disabled), or
    "X" (some enabled but not all of them). This works the same as the "enable"
    files in the individule system directories (like tracing/events/sched/enable).
    
    But when all events are enabled, the top level "enable" file shows "X". The
    reason is that its checking the "ftrace" events, which are special events
    that only exist for their format files. These include the format for the
    function tracer events, that are enabled when the function tracer is
    enabled, but not by the "enable" file. The check includes these events,
    which will always be disabled, and even though all true events are enabled,
    the top level "enable" file will show "X" instead of "1".
    
    To fix this, have the check test the event's flags to see if it has the
    "IGNORE_ENABLE" flag set, and if so, not test it.
    
    Cc: stable@vger.kernel.org
    Fixes: 553552ce1796c ("tracing: Combine event filter_active and enable into single flags field")
    Reported-by: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
    Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index e9d28eeccb7e..d387b774ceeb 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -1212,7 +1212,8 @@ system_enable_read(struct file *filp, char __user *ubuf, size_t cnt,
 	mutex_lock(&event_mutex);
 	list_for_each_entry(file, &tr->events, list) {
 		call = file->event_call;
-		if (!trace_event_name(call) || !call->class || !call->class->reg)
+		if ((call->flags & TRACE_EVENT_FL_IGNORE_ENABLE) ||
+		    !trace_event_name(call) || !call->class || !call->class->reg)
 			continue;
 
 		if (system && strcmp(call->class->system, system->name) != 0)

             reply	other threads:[~2021-02-08 20:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-08 19:22 Steven Rostedt [this message]
2021-02-08 20:50 ` [GIT PULL] tracing: Fix output of top level event "enable" file pr-tracker-bot

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=20210208142258.643b54a3@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=y.karadz@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).