mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Frederic Weisbecker <fweisbec@gmail.com>
Subject: [RFC][PATCH 3/3] ftrace: Add extend-notrace-debug to see what is not traced
Date: Tue, 12 Jul 2011 14:51:34 -0400	[thread overview]
Message-ID: <20110712190302.751355888@goodmis.org> (raw)
In-Reply-To: <20110712185131.698851699@goodmis.org>

[-- Attachment #1: 0003-ftrace-Add-extend-notrace-debug-to-see-what-is-not-t.patch --]
[-- Type: text/plain, Size: 3143 bytes --]

From: Steven Rostedt <srostedt@redhat.com>

Enabling extend-notrace causes functions not to be traced if it
is determined that its calling function is not traced. To be able
to debug this, the option extend-notrace-debug is added. It only
takes affect when extend-notrace is enabled.

When extend-notrace-debug is enabled, the functions traced when
extend-notrace is enabled is only the functions that would have
not been traced. In other words, extend-notrace-debug causes extend-notrace
to do the inverse of what it usually does. This allows the user
to see what functions may be missing when they enable extend-notrace.

It does not enable "notrace" functions themselves. It only traces
the functions that would have normally been traced if extend-notrace
was not enabled, but were skipped because of extend-notrace.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/trace.c           |    1 +
 kernel/trace/trace.h           |    1 +
 kernel/trace/trace_functions.c |   21 ++++++++++++++++-----
 3 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index dc8b945..3294549 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -425,6 +425,7 @@ static const char *trace_options[] = {
 	"record-cmd",
 	"overwrite",
 	"extend-notrace",
+	"extend-notrace-debug",
 	NULL
 };
 
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index bbef5a5..739eaf2 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -618,6 +618,7 @@ enum trace_iterator_flags {
 	TRACE_ITER_RECORD_CMD		= 0x100000,
 	TRACE_ITER_OVERWRITE		= 0x200000,
 	TRACE_ITER_EXTEND_NOTRACE	= 0x400000,
+	TRACE_ITER_DEBUG_EXTEND_NOTRACE	= 0x800000,
 };
 
 /*
diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c
index 73cf336..ff6c793 100644
--- a/kernel/trace/trace_functions.c
+++ b/kernel/trace/trace_functions.c
@@ -70,7 +70,7 @@ void trace_extend_notrace(int enable)
 /* 64 words depth to reset stack */
 #define STACK_OFFSET	(THREAD_SIZE - (64 * BITS_PER_LONG/8))
 
-static inline int skip_notrace(unsigned long ip, unsigned long parent_ip)
+static int __skip_notrace(unsigned long ip, unsigned long parent_ip)
 {
 	unsigned long offset;
 	unsigned long size;
@@ -79,10 +79,6 @@ static inline int skip_notrace(unsigned long ip, unsigned long parent_ip)
 	int curr_ret;
 	int i;
 
-	/* Optimize for this case to be off */
-	if (likely(!(trace_flags & TRACE_ITER_EXTEND_NOTRACE)))
-		return 0;
-
 	/*
 	 * We always trace NMIs, and do not update anything.
 	 * This code requires interrupts disabled.
@@ -189,6 +185,21 @@ static inline int skip_notrace(unsigned long ip, unsigned long parent_ip)
 	return 0;
 }
 
+static inline int skip_notrace(unsigned long ip, unsigned long parent_ip)
+{
+	int ret;
+
+	/* Optimize for this case to be off */
+	if (likely(!(trace_flags & TRACE_ITER_EXTEND_NOTRACE)))
+		return 0;
+
+	ret = __skip_notrace(ip, parent_ip);
+
+	if (trace_flags & TRACE_ITER_DEBUG_EXTEND_NOTRACE)
+		return !ret;
+	return ret;
+}
+
 static void
 function_trace_call_preempt_only(unsigned long ip, unsigned long parent_ip)
 {
-- 
1.7.5.4



      parent reply	other threads:[~2011-07-12 19:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-12 18:51 [RFC][PATCH 0/3] ftrace: entend notrace to notrace called functions Steven Rostedt
2011-07-12 18:51 ` [RFC][PATCH 1/3] ftrace: Make ret_stack usable by other than function graph Steven Rostedt
2011-07-12 18:51 ` [RFC][PATCH 2/3] ftrace: Add extend-notrace to not trace sub funcs of notrace funcs Steven Rostedt
2011-07-12 19:45   ` Peter Zijlstra
2011-07-12 20:30     ` Steven Rostedt
2011-07-12 18:51 ` Steven Rostedt [this message]

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=20110712190302.751355888@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --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

all inboxes | Powered by JetHome®