Commit 9c1f6bb8 authored by Steven Rostedt (Red Hat)'s avatar Steven Rostedt (Red Hat) Committed by Steven Rostedt

tracing: Allow benchmark to be enabled at early_initcall()

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: default avatarSteven Rostedt <rostedt@goodmis.org>
parent 989a0a3d
...@@ -21,6 +21,8 @@ static u64 bm_stddev; ...@@ -21,6 +21,8 @@ static u64 bm_stddev;
static unsigned int bm_avg; static unsigned int bm_avg;
static unsigned int bm_std; static unsigned int bm_std;
static bool ok_to_run;
/* /*
* This gets called in a loop recording the time it took to write * 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 * the tracepoint. What it writes is the time statistics of the last
...@@ -166,7 +168,7 @@ static int benchmark_event_kthread(void *arg) ...@@ -166,7 +168,7 @@ static int benchmark_event_kthread(void *arg)
*/ */
int trace_benchmark_reg(void) 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"); pr_warning("trace benchmark cannot be started via kernel command line\n");
return -EBUSY; return -EBUSY;
} }
...@@ -207,3 +209,12 @@ void trace_benchmark_unreg(void) ...@@ -207,3 +209,12 @@ void trace_benchmark_unreg(void)
bm_avg = 0; bm_avg = 0;
bm_stddev = 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);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment