public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	"Joel Fernandes (Google)" <joel.opensrc@gmail.com>
Subject: [PATCH 4/4 v2] init: Have initcall_debug still work without CONFIG_TRACEPOINTS
Date: Fri, 06 Apr 2018 15:08:58 -0400	[thread overview]
Message-ID: <20180406191334.497702511@goodmis.org> (raw)
In-Reply-To: 20180406190854.875810797@goodmis.org

[-- Attachment #1: 0004-init-Have-initcall_debug-still-work-without-CONFIG_T.patch --]
[-- Type: text/plain, Size: 1721 bytes --]

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

Add macros around the initcall_debug tracepoint code to have the code to
default back to the old method if CONFIG_TRACEPOINTS is not enabled.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 init/main.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/init/main.c b/init/main.c
index 589d1226016e..07f56d667c33 100644
--- a/init/main.c
+++ b/init/main.c
@@ -832,6 +832,7 @@ trace_initcall_finish_cb(void *data, initcall_t fn, int ret)
 
 static ktime_t initcall_calltime;
 
+#ifdef TRACEPOINTS_ENABLED
 static void __init initcall_debug_enable(void)
 {
 	int ret;
@@ -842,6 +843,25 @@ static void __init initcall_debug_enable(void)
 					      &initcall_calltime);
 	WARN(ret, "Failed to register initcall tracepoints\n");
 }
+# define do_trace_initcall_start	trace_initcall_start
+# define do_trace_initcall_finish	trace_initcall_finish
+#else
+static inline initcall_debug_enable(void)
+{
+}
+static inline void do_trace_initcall_start(initcall_t fn)
+{
+	if (!initcall_debug)
+		return;
+	trace_initcall_start_cb(&initcall_calltime, fn);
+}
+static inline void do_trace_initcall_finish(initcall_t fn, int ret)
+{
+	if (!initcall_debug)
+		return;
+	trace_initcall_finish_cb(&initcall_calltime, fn, ret);
+}
+#endif /* !TRACEPOINTS_ENABLED */
 
 int __init_or_module do_one_initcall(initcall_t fn)
 {
@@ -852,9 +872,9 @@ int __init_or_module do_one_initcall(initcall_t fn)
 	if (initcall_blacklisted(fn))
 		return -EPERM;
 
-	trace_initcall_start(fn);
+	do_trace_initcall_start(fn);
 	ret = fn();
-	trace_initcall_finish(fn, ret);
+	do_trace_initcall_finish(fn, ret);
 
 	msgbuf[0] = 0;
 
-- 
2.15.1

  parent reply	other threads:[~2018-04-06 19:13 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-06 19:08 [PATCH 0/4 v2] init, tracing: Steven Rostedt
2018-04-06 19:08 ` [PATCH 1/4 v2] init, tracing: Add initcall trace events Steven Rostedt
2018-04-06 19:08 ` [PATCH 2/4 v2] init, tracing: instrument security and console " Steven Rostedt
2018-04-06 19:08 ` [PATCH 3/4 v2] init, tracing: Have printk come through the trace events for initcall_debug Steven Rostedt
2018-04-09  5:32   ` [lkp-robot] [init, tracing] 2580d6b795: BUG:kernel_reboot-without-warning_in_boot_stage kernel test robot
2018-04-09 22:04     ` Steven Rostedt
2018-04-10  1:23       ` Ye Xiaolong
2018-04-10  2:41         ` Steven Rostedt
2018-04-10  3:14           ` Ye Xiaolong
2018-04-06 19:08 ` Steven Rostedt [this message]
2018-04-07  8:18   ` [PATCH 4/4 v2] init: Have initcall_debug still work without CONFIG_TRACEPOINTS kbuild test robot
2018-04-06 19:16 ` [PATCH 0/4 v2] init, tracing: Add initcall trace events Steven Rostedt
2018-04-06 19:19 ` Steven Rostedt
2018-04-06 19:34   ` Peter Zijlstra
2018-04-06 19:46     ` 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=20180406191334.497702511@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=fweisbec@gmail.com \
    --cc=joel.opensrc@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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