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


Groups > linux.kernel > #1532394

[PATCH 4/4] tracing: Allow benchmark to be enabled at early_initcall()

From Steven Rostedt <rostedt@goodmis.org>
Newsgroups linux.kernel
Subject [PATCH 4/4] tracing: Allow benchmark to be enabled at early_initcall()
Date 2016-11-29 16:10 +0100
Message-ID <sIScG-1DN-33@gated-at.bofh.it> (permalink)
References <sIScF-1DN-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

The trace event start up selftests fails when the trace benchmark is
enabled, because it is disabled during boot. It really only needs to be
disabled before scheduling is set up, as it creates a thread.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/trace_benchmark.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/trace_benchmark.c b/kernel/trace/trace_benchmark.c
index 2bc7dc3e8ff8..e3b488825ae3 100644
--- a/kernel/trace/trace_benchmark.c
+++ b/kernel/trace/trace_benchmark.c
@@ -21,6 +21,8 @@ static u64 bm_stddev;
 static unsigned int bm_avg;
 static unsigned int bm_std;
 
+static bool ok_to_run;
+
 /*
  * This gets called in a loop recording the time it took to write
  * the tracepoint. What it writes is the time statistics of the last
@@ -166,7 +168,7 @@ static int benchmark_event_kthread(void *arg)
  */
 int trace_benchmark_reg(void)
 {
-	if (system_state != SYSTEM_RUNNING) {
+	if (!ok_to_run) {
 		pr_warning("trace benchmark cannot be started via kernel command line\n");
 		return -EBUSY;
 	}
@@ -207,3 +209,12 @@ void trace_benchmark_unreg(void)
 	bm_avg = 0;
 	bm_stddev = 0;
 }
+
+static __init int ok_to_run_trace_benchmark(void)
+{
+	ok_to_run = true;
+
+	return 0;
+}
+
+early_initcall(ok_to_run_trace_benchmark);
-- 
2.10.2

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


Thread

[PATCH 0/4] tracing: Have tracepoint reg functions allowed to fail Steven Rostedt <rostedt@goodmis.org> - 2016-11-29 16:10 +0100
  [PATCH 4/4] tracing: Allow benchmark to be enabled at early_initcall() Steven Rostedt <rostedt@goodmis.org> - 2016-11-29 16:10 +0100
  [PATCH 3/4] tracing: Have system enable return error if one of the events fail Steven Rostedt <rostedt@goodmis.org> - 2016-11-29 16:10 +0100
  [PATCH 1/4] tracing: Have the reg function allow to fail Steven Rostedt <rostedt@goodmis.org> - 2016-11-29 16:10 +0100

csiph-web