linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Tom Zanussi <tom.zanussi@linux.intel.com>,
	Clark Williams <williams@redhat.com>,
	Karim Yaghmour <karim.yaghmour@opersys.com>,
	Brendan Gregg <bgregg@netflix.com>,
	Joel Fernandes <joelaf@google.com>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	linux-rt-users@vger.kernel.org
Subject: [RFC][PATCH 02/10] tracing: Add __find_event_file() to find event files without restrictions
Date: Fri, 11 May 2018 15:49:29 -0400	[thread overview]
Message-ID: <20180511195340.297584458@goodmis.org> (raw)
In-Reply-To: 20180511194927.190877137@goodmis.org

[-- Attachment #1: 0002-tracing-Add-__find_event_file-to-find-event-files-wi.patch --]
[-- Type: text/plain, Size: 2943 bytes --]

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

By adding the function __find_event_file() that can search for files without
restrictions, such as if the event associated with the file has a reg
function, or if it has the "ignore" flag set, the files that are associated
to ftrace internal events (like trace_marker and function events) can be
found and used.

find_event_file() still returns a "filtered" file, as most callers need a
valid trace event file. One created by the trace_events.h macros and not one
created for parsing ftrace specific events.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 kernel/trace/trace.h        |  3 +++
 kernel/trace/trace_events.c | 22 +++++++++++++++++-----
 2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 24b666891eaf..8ecca43d6aea 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -1454,6 +1454,9 @@ extern void trace_event_enable_tgid_record(bool enable);
 extern int event_trace_add_tracer(struct dentry *parent, struct trace_array *tr);
 extern int event_trace_del_tracer(struct trace_array *tr);
 
+extern struct trace_event_file *__find_event_file(struct trace_array *tr,
+						  const char *system,
+						  const char *event);
 extern struct trace_event_file *find_event_file(struct trace_array *tr,
 						const char *system,
 						const char *event);
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 05c7172c6667..caf76355f0a3 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -2473,8 +2473,9 @@ __trace_add_event_dirs(struct trace_array *tr)
 	}
 }
 
+/* Returns any file that matches the system and event */
 struct trace_event_file *
-find_event_file(struct trace_array *tr, const char *system,  const char *event)
+__find_event_file(struct trace_array *tr, const char *system, const char *event)
 {
 	struct trace_event_file *file;
 	struct trace_event_call *call;
@@ -2485,10 +2486,7 @@ find_event_file(struct trace_array *tr, const char *system,  const char *event)
 		call = file->event_call;
 		name = trace_event_name(call);
 
-		if (!name || !call->class || !call->class->reg)
-			continue;
-
-		if (call->flags & TRACE_EVENT_FL_IGNORE_ENABLE)
+		if (!name || !call->class)
 			continue;
 
 		if (strcmp(event, name) == 0 &&
@@ -2498,6 +2496,20 @@ find_event_file(struct trace_array *tr, const char *system,  const char *event)
 	return NULL;
 }
 
+/* Returns valid trace event files that match system and event */
+struct trace_event_file *
+find_event_file(struct trace_array *tr, const char *system, const char *event)
+{
+	struct trace_event_file *file;
+
+	file = __find_event_file(tr, system, event);
+	if (!file || !file->event_call->class->reg ||
+	    file->event_call->flags & TRACE_EVENT_FL_IGNORE_ENABLE)
+		return NULL;
+
+	return file;
+}
+
 #ifdef CONFIG_DYNAMIC_FTRACE
 
 /* Avoid typos */
-- 
2.17.0

  parent reply	other threads:[~2018-05-11 19:53 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-11 19:49 [RFC][PATCH 00/10] tracing: Add triggers to trace_marker writes Steven Rostedt
2018-05-11 19:49 ` [RFC][PATCH 01/10] tracing: Do not reference event data in post call triggers Steven Rostedt
2018-05-12 12:04   ` Masami Hiramatsu
2018-05-11 19:49 ` Steven Rostedt [this message]
2018-05-11 19:49 ` [RFC][PATCH 03/10] tracing: Have event_trace_init() called by trace_init_tracefs() Steven Rostedt
2018-05-11 19:49 ` [RFC][PATCH 04/10] tracing: Add brackets in ftrace event dynamic arrays Steven Rostedt
2018-05-11 19:49 ` [RFC][PATCH 05/10] tracing: Do not show filter file for ftrace internal events Steven Rostedt
2018-05-11 19:49 ` [RFC][PATCH 06/10] tracing: Add trigger file for trace_markers tracefs/ftrace/print Steven Rostedt
2018-05-14  3:13   ` Namhyung Kim
2018-05-14 15:04     ` Steven Rostedt
2018-05-16  7:49       ` Namhyung Kim
2018-05-16 10:37         ` Steven Rostedt
2018-05-11 19:49 ` [RFC][PATCH 07/10] tracing: Have zero size length in filter logic be full string Steven Rostedt
2018-05-12 12:40   ` Masami Hiramatsu
2018-05-12 17:27     ` Steven Rostedt
2018-05-12 18:32   ` Yann Ylavic
2018-05-14  2:23     ` Namhyung Kim
2018-05-14 14:12     ` Steven Rostedt
2018-05-11 19:49 ` [RFC][PATCH 08/10] tracing: Prevent further users of zero size static arrays in trace events Steven Rostedt
2018-05-11 19:49 ` [RFC][PATCH 09/10] tracing: Allow histogram triggers to access ftrace internal events Steven Rostedt
2018-05-11 19:49 ` [RFC][PATCH 10/10] tracing: Document trace_marker triggers Steven Rostedt

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=20180511195340.297584458@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=bgregg@netflix.com \
    --cc=joelaf@google.com \
    --cc=karim.yaghmour@opersys.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=tom.zanussi@linux.intel.com \
    --cc=williams@redhat.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).