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>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Namhyung Kim <namhyung@kernel.org>
Subject: [PATCH 2/4] tracing: Do not start benchmark on boot up
Date: Tue, 29 Nov 2016 09:56:59 -0500 [thread overview]
Message-ID: <20161129145948.311248387@goodmis.org> (raw)
In-Reply-To: 20161129145657.483474913@goodmis.org
[-- Attachment #1: 0002-tracing-Do-not-start-benchmark-on-boot-up.patch --]
[-- Type: text/plain, Size: 1566 bytes --]
From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
Trace events are enabled every 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 this crashes the kerenl.
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 can not be created.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/trace_benchmark.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/kernel/trace/trace_benchmark.c b/kernel/trace/trace_benchmark.c
index f76d0416dd83..2bc7dc3e8ff8 100644
--- a/kernel/trace/trace_benchmark.c
+++ b/kernel/trace/trace_benchmark.c
@@ -166,9 +166,18 @@ static int benchmark_event_kthread(void *arg)
*/
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,
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;
}
@@ -183,6 +192,7 @@ void trace_benchmark_unreg(void)
return;
kthread_stop(bm_event_thread);
+ bm_event_thread = NULL;
strcpy(bm_str, "START");
bm_total = 0;
--
2.10.2
next prev parent reply other threads:[~2016-11-29 15:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-29 14:56 [PATCH 0/4] tracing: Have tracepoint reg functions allowed to fail Steven Rostedt
2016-11-29 14:56 ` [PATCH 1/4] tracing: Have the reg function allow " Steven Rostedt
2016-11-29 14:56 ` Steven Rostedt [this message]
2016-11-29 14:57 ` [PATCH 3/4] tracing: Have system enable return error if one of the events fail Steven Rostedt
2016-11-29 14:57 ` [PATCH 4/4] tracing: Allow benchmark to be enabled at early_initcall() 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=20161129145948.311248387@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@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