Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1237352

[for-next][PATCH 24/25] tracing: Add trace options for core options to instances

From Steven Rostedt <rostedt@goodmis.org>
Newsgroups linux.kernel
Subject [for-next][PATCH 24/25] tracing: Add trace options for core options to instances
Date 2015-10-01 14:10 +0200
Message-ID <qeKQr-3yE-49@gated-at.bofh.it> (permalink)
References <qeKGK-383-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Allow instances to have their own options, at least for the core options
(non tracer specific ones). There are a few global options that should not
be added to instances, like enabling of trace_printk, and the sched comm
recording, which do not have a specific trace instance associated to them.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/trace.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 51697b41f5d4..7b99e36b8973 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -258,6 +258,11 @@ unsigned long long ns2usecs(cycle_t nsec)
 	 TRACE_ITER_RECORD_CMD | TRACE_ITER_OVERWRITE |			\
 	 TRACE_ITER_IRQ_INFO | TRACE_ITER_MARKERS)
 
+/* trace_options that are only supported by global_trace */
+#define TOP_LEVEL_TRACE_FLAGS (TRACE_ITER_PRINTK |			\
+	       TRACE_ITER_PRINTK_MSGONLY | TRACE_ITER_RECORD_CMD)
+
+
 /*
  * The global_trace is the descriptor that holds the tracing
  * buffers for the live tracing. For each CPU, it contains
@@ -6387,17 +6392,21 @@ create_trace_option_core_file(struct trace_array *tr,
 				 &trace_options_core_fops);
 }
 
-static __init void create_trace_options_dir(struct trace_array *tr)
+static void create_trace_options_dir(struct trace_array *tr)
 {
 	struct dentry *t_options;
+	bool top_level = tr == &global_trace;
 	int i;
 
 	t_options = trace_options_init_dentry(tr);
 	if (!t_options)
 		return;
 
-	for (i = 0; trace_options[i]; i++)
-		create_trace_option_core_file(tr, trace_options[i], i);
+	for (i = 0; trace_options[i]; i++) {
+		if (top_level ||
+		    !((1 << i) & TOP_LEVEL_TRACE_FLAGS))
+			create_trace_option_core_file(tr, trace_options[i], i);
+	}
 }
 
 static ssize_t
@@ -6707,6 +6716,8 @@ init_tracer_tracefs(struct trace_array *tr, struct dentry *d_tracer)
 	trace_create_file("tracing_on", 0644, d_tracer,
 			  tr, &rb_simple_fops);
 
+	create_trace_options_dir(tr);
+
 #ifdef CONFIG_TRACER_MAX_TRACE
 	trace_create_file("tracing_max_latency", 0644, d_tracer,
 			&tr->max_latency, &tracing_max_lat_fops);
@@ -6903,8 +6914,6 @@ static __init int tracer_init_tracefs(void)
 
 	create_trace_instances(d_tracer);
 
-	create_trace_options_dir(&global_trace);
-
 	mutex_lock(&trace_types_lock);
 	for (t = trace_types; t; t = t->next)
 		add_tracer_options(&global_trace, t);
-- 
2.5.1


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[for-next][PATCH 00/25] tracing: Have instances have their own options + clean ups Steven Rostedt <rostedt@goodmis.org> - 2015-10-01 14:10 +0200
  [for-next][PATCH 03/25] tracing: Remove ftrace_trace_stack_regs() Steven Rostedt <rostedt@goodmis.org> - 2015-10-01 14:10 +0200
  [for-next][PATCH 18/25] tracing: Add build bug if we have more trace_flags than bits Steven Rostedt <rostedt@goodmis.org> - 2015-10-01 14:10 +0200
  [for-next][PATCH 24/25] tracing: Add trace options for core options to instances Steven Rostedt <rostedt@goodmis.org> - 2015-10-01 14:10 +0200
  [for-next][PATCH 04/25] tracing: Remove unused function trace_current_buffer_lock_reserve() Steven Rostedt <rostedt@goodmis.org> - 2015-10-01 14:10 +0200
  [for-next][PATCH 02/25] tracing: Move non perf code out of perf.h Steven Rostedt <rostedt@goodmis.org> - 2015-10-01 14:10 +0200
  [for-next][PATCH 17/25] tracing: Always show all tracer options in the options directory Steven Rostedt <rostedt@goodmis.org> - 2015-10-01 14:10 +0200

csiph-web