public inbox for linux-kernel@vger.kernel.org
 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>,
	Masami Hiramatsu <mhiramat@kernel.org>
Subject: [for-next][PATCH 09/11] tracing/boot: Add per-group/all events enablement
Date: Wed, 09 Jun 2021 21:01:39 -0400	[thread overview]
Message-ID: <20210610010158.315830915@goodmis.org> (raw)
In-Reply-To: 20210610010130.069460694@goodmis.org

From: Masami Hiramatsu <mhiramat@kernel.org>

Add ftrace.event.<GROUP>.enable and ftrace.event.enable
boot-time tracing, which enables all events under
given GROUP and all events respectivly.

Link: https://lkml.kernel.org/r/162264438005.302580.12019174481201855444.stgit@devnote2

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 kernel/trace/trace_boot.c | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/trace_boot.c b/kernel/trace/trace_boot.c
index a82f03f385f8..94ef2d099e32 100644
--- a/kernel/trace/trace_boot.c
+++ b/kernel/trace/trace_boot.c
@@ -225,14 +225,37 @@ static void __init
 trace_boot_init_events(struct trace_array *tr, struct xbc_node *node)
 {
 	struct xbc_node *gnode, *enode;
+	bool enable, enable_all = false;
+	const char *data;
 
 	node = xbc_node_find_child(node, "event");
 	if (!node)
 		return;
 	/* per-event key starts with "event.GROUP.EVENT" */
-	xbc_node_for_each_child(node, gnode)
-		xbc_node_for_each_child(gnode, enode)
+	xbc_node_for_each_child(node, gnode) {
+		data = xbc_node_get_data(gnode);
+		if (!strcmp(data, "enable")) {
+			enable_all = true;
+			continue;
+		}
+		enable = false;
+		xbc_node_for_each_child(gnode, enode) {
+			data = xbc_node_get_data(enode);
+			if (!strcmp(data, "enable")) {
+				enable = true;
+				continue;
+			}
 			trace_boot_init_one_event(tr, gnode, enode);
+		}
+		/* Event enablement must be done after event settings */
+		if (enable) {
+			data = xbc_node_get_data(gnode);
+			trace_array_set_clr_event(tr, data, NULL, true);
+		}
+	}
+	/* Ditto */
+	if (enable_all)
+		trace_array_set_clr_event(tr, NULL, NULL, true);
 }
 #else
 #define trace_boot_enable_events(tr, node) do {} while (0)
-- 
2.30.2

  parent reply	other threads:[~2021-06-10  1:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-10  1:01 [for-next][PATCH 00/11] tracing: Updates for 5.14 Steven Rostedt
2021-06-10  1:01 ` [for-next][PATCH 01/11] tools/bootconfig: Simplify expression Steven Rostedt
2021-06-10  1:01 ` [for-next][PATCH 02/11] sched/tracing: Remove the redundant success in the sched tracepoint Steven Rostedt
2021-06-10  1:01 ` [for-next][PATCH 03/11] tracing: Remove redundant assignment to event_var Steven Rostedt
2021-06-10  1:01 ` [for-next][PATCH 04/11] ring-buffer: Use fallthrough pseudo-keyword Steven Rostedt
2021-06-10  1:01 ` [for-next][PATCH 05/11] trace: replace WB_REASON_FOREIGN_FLUSH with a string Steven Rostedt
2021-06-10  1:01 ` [for-next][PATCH 06/11] tracing: Remove redundant initialization of variable ret Steven Rostedt
2021-06-10  1:01 ` [for-next][PATCH 07/11] tracing: Fix set_named_trigger_data() kernel-doc comment Steven Rostedt
2021-06-10  1:01 ` [for-next][PATCH 08/11] tracing: Add WARN_ON_ONCE when returned value is negative Steven Rostedt
2021-06-10  1:01 ` Steven Rostedt [this message]
2021-06-10  1:01 ` [for-next][PATCH 10/11] Documentation: tracing: Add per-group/all events enablement desciption Steven Rostedt
2021-06-10  1:01 ` [for-next][PATCH 11/11] treewide: Add missing semicolons to __assign_str uses Steven Rostedt
2021-06-10  2:46   ` Joe Perches
2021-06-10 14:33     ` 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=20210610010158.315830915@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@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