From: Anton Vorontsov <anton.vorontsov@linaro.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Kees Cook <keescook@chromium.org>,
Colin Cross <ccross@android.com>, Tony Luck <tony.luck@intel.com>,
Steven Rostedt <rostedt@goodmis.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Ingo Molnar <mingo@redhat.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
John Stultz <john.stultz@linaro.org>,
Shuah Khan <shuahkhan@gmail.com>,
arve@android.com, Rebecca Schultz Zavin <rebecca@android.com>,
Jesper Juhl <jj@chaosbits.net>,
Randy Dunlap <rdunlap@xenotime.net>,
Stephen Boyd <sboyd@codeaurora.org>,
Thomas Meyer <thomas@m3y3r.de>,
Andrew Morton <akpm@linux-foundation.org>,
Marco Stornelli <marco.stornelli@gmail.com>,
WANG Cong <xiyou.wangcong@gmail.com>,
linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org,
linaro-kernel@lists.linaro.org, patches@linaro.org,
kernel-team@android.com
Subject: [PATCH 4/6] tracing/function: Introduce persistent trace option
Date: Fri, 15 Jun 2012 10:08:29 -0700 [thread overview]
Message-ID: <1339780111-12075-4-git-send-email-anton.vorontsov@linaro.org> (raw)
In-Reply-To: <20120615170659.GA4060@lizard>
This patch introduces 'func_ptrace' option, now available in
/sys/kernel/debug/tracing/options when function tracer
is selected.
The patch also adds some tiny code that calls back to pstore
to record the trace. The callback is no-op when PSTORE=n.
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
---
kernel/trace/trace_functions.c | 25 ++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c
index c7b0c6a..269627c 100644
--- a/kernel/trace/trace_functions.c
+++ b/kernel/trace/trace_functions.c
@@ -13,6 +13,7 @@
#include <linux/debugfs.h>
#include <linux/uaccess.h>
#include <linux/ftrace.h>
+#include <linux/pstore.h>
#include <linux/fs.h>
#include "trace.h"
@@ -74,6 +75,14 @@ function_trace_call_preempt_only(unsigned long ip, unsigned long parent_ip)
preempt_enable_notrace();
}
+/* Our two options */
+enum {
+ TRACE_FUNC_OPT_STACK = 0x1,
+ TRACE_FUNC_OPT_PSTORE = 0x2,
+};
+
+static struct tracer_flags func_flags;
+
static void
function_trace_call(unsigned long ip, unsigned long parent_ip)
{
@@ -97,6 +106,12 @@ function_trace_call(unsigned long ip, unsigned long parent_ip)
disabled = atomic_inc_return(&data->disabled);
if (likely(disabled == 1)) {
+ /*
+ * So far tracing doesn't support multiple buffers, so
+ * we make an explicit call for now.
+ */
+ if (unlikely(func_flags.val & TRACE_FUNC_OPT_PSTORE))
+ pstore_ftrace_call(ip, parent_ip);
pc = preempt_count();
trace_function(tr, ip, parent_ip, flags, pc);
}
@@ -158,15 +173,13 @@ static struct ftrace_ops trace_stack_ops __read_mostly =
.flags = FTRACE_OPS_FL_GLOBAL,
};
-/* Our two options */
-enum {
- TRACE_FUNC_OPT_STACK = 0x1,
-};
-
static struct tracer_opt func_opts[] = {
#ifdef CONFIG_STACKTRACE
{ TRACER_OPT(func_stack_trace, TRACE_FUNC_OPT_STACK) },
#endif
+#ifdef CONFIG_PSTORE_FTRACE
+ { TRACER_OPT(func_pstore, TRACE_FUNC_OPT_PSTORE) },
+#endif
{ } /* Always set a last empty entry */
};
@@ -219,6 +232,8 @@ static int func_set_flag(u32 old_flags, u32 bit, int set)
return 0;
}
+ if (bit == TRACE_FUNC_OPT_PSTORE)
+ return 0;
return -EINVAL;
}
--
1.7.10.4
next prev parent reply other threads:[~2012-06-15 17:11 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-15 17:07 [PATCH v2 0/6] Function tracing support for pstore Anton Vorontsov
2012-06-15 17:08 ` [PATCH 1/6] tracing: Fix initialization failure path in tracing_set_tracer() Anton Vorontsov
2012-06-15 22:00 ` Steven Rostedt
2012-06-15 17:08 ` [PATCH 2/6] pstore: Introduce write_buf backend callback Anton Vorontsov
2012-06-15 17:08 ` [PATCH 3/6] pstore: Add persistent function tracing Anton Vorontsov
2012-06-15 21:40 ` Luck, Tony
2012-06-15 21:55 ` Steven Rostedt
2012-06-15 22:00 ` Luck, Tony
2012-06-15 22:09 ` Colin Cross
2012-06-15 22:10 ` Steven Rostedt
2012-06-15 22:19 ` Luck, Tony
2012-06-15 22:23 ` Colin Cross
2012-06-15 22:37 ` Luck, Tony
2012-06-15 22:42 ` Steven Rostedt
2012-06-15 22:28 ` Steven Rostedt
2012-06-15 17:08 ` Anton Vorontsov [this message]
2012-06-15 17:08 ` [PATCH 5/6] pstore/ram: Convert to write_buf callback Anton Vorontsov
2012-06-15 17:08 ` [PATCH 6/6] pstore/ram: Add ftrace messages handling Anton Vorontsov
2012-06-15 21:28 ` [PATCH v2 0/6] Function tracing support for pstore Greg Kroah-Hartman
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=1339780111-12075-4-git-send-email-anton.vorontsov@linaro.org \
--to=anton.vorontsov@linaro.org \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=arve@android.com \
--cc=ccross@android.com \
--cc=devel@driverdev.osuosl.org \
--cc=fweisbec@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jj@chaosbits.net \
--cc=john.stultz@linaro.org \
--cc=keescook@chromium.org \
--cc=kernel-team@android.com \
--cc=linaro-kernel@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marco.stornelli@gmail.com \
--cc=mingo@redhat.com \
--cc=patches@linaro.org \
--cc=rdunlap@xenotime.net \
--cc=rebecca@android.com \
--cc=rostedt@goodmis.org \
--cc=sboyd@codeaurora.org \
--cc=shuahkhan@gmail.com \
--cc=thomas@m3y3r.de \
--cc=tony.luck@intel.com \
--cc=xiyou.wangcong@gmail.com \
/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®