tracing: Do not start benchmark on boot up
Trace events are enabled very early on boot up via the boot command line parameter. The benchmark tool creates a new thread to perform the trace event benchmarking. But at start up, it is called before scheduling is set up and because it creates a new thread before the init thread is created, this crashes the kernel. Have the benchmark fail to register when started via the kernel command line. Also, since the registering of a tracepoint now can handle failure cases, return -ENOMEM instead of warning if the thread cannot be created. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
This commit is contained in:
parent
8cf868affd
commit
1dd349ab74
|
@ -166,9 +166,18 @@ static int benchmark_event_kthread(void *arg)
|
||||||
*/
|
*/
|
||||||
int trace_benchmark_reg(void)
|
int trace_benchmark_reg(void)
|
||||||
{
|
{
|
||||||
|
if (system_state != SYSTEM_RUNNING) {
|
||||||
|
pr_warning("trace benchmark cannot be started via kernel command line\n");
|
||||||
|
return -EBUSY;
|
||||||
|
}
|
||||||
|
|
||||||
bm_event_thread = kthread_run(benchmark_event_kthread,
|
bm_event_thread = kthread_run(benchmark_event_kthread,
|
||||||
NULL, "event_benchmark");
|
NULL, "event_benchmark");
|
||||||
WARN_ON(!bm_event_thread);
|
if (!bm_event_thread) {
|
||||||
|
pr_warning("trace benchmark failed to create kernel thread\n");
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,6 +192,7 @@ void trace_benchmark_unreg(void)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
kthread_stop(bm_event_thread);
|
kthread_stop(bm_event_thread);
|
||||||
|
bm_event_thread = NULL;
|
||||||
|
|
||||||
strcpy(bm_str, "START");
|
strcpy(bm_str, "START");
|
||||||
bm_total = 0;
|
bm_total = 0;
|
||||||
|
|
Loading…
Reference in New Issue