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>,
	Frederic Weisbecker <fweisbec@gmail.com>
Subject: [PATCH 15/16] tracing: Have stack tracing set filtered functions at boot
Date: Wed, 21 Dec 2011 07:36:39 -0500	[thread overview]
Message-ID: <20111221123811.457975427@goodmis.org> (raw)
In-Reply-To: <20111221123624.193898256@goodmis.org>

[-- Attachment #1: Type: text/plain, Size: 2352 bytes --]

From: Steven Rostedt <srostedt@redhat.com>

Add stacktrace_filter= to the kernel command line that lets
the user pick specific functions to check the stack on.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 Documentation/kernel-parameters.txt |    8 ++++++++
 kernel/trace/trace_stack.c          |   11 +++++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index fd5c913..fde2ae0 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -2435,6 +2435,14 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
 	stacktrace	[FTRACE]
 			Enabled the stack tracer on boot up.
 
+	stacktrace_filter=[function-list]
+			[FTRACE] Limit the functions that the stack tracer
+			will trace at boot up. function-list is a comma separated
+			list of functions. This list can be changed at run
+			time by the stack_trace_filter file in the debugfs
+			tracing directory. Note, this enables stack tracing
+			and the stacktrace above is not needed.
+
 	sti=		[PARISC,HW]
 			Format: <num>
 			Set the STI (builtin display/keyboard on the HP-PARISC
diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c
index 0398b7c..d4545f4 100644
--- a/kernel/trace/trace_stack.c
+++ b/kernel/trace/trace_stack.c
@@ -13,6 +13,9 @@
 #include <linux/sysctl.h>
 #include <linux/init.h>
 #include <linux/fs.h>
+
+#include <asm/setup.h>
+
 #include "trace.h"
 
 #define STACK_TRACE_ENTRIES 500
@@ -352,8 +355,13 @@ stack_trace_sysctl(struct ctl_table *table, int write,
 	return ret;
 }
 
+static char stack_trace_filter_buf[COMMAND_LINE_SIZE+1] __initdata;
+
 static __init int enable_stacktrace(char *str)
 {
+	if (strncmp(str, "_filter=", 8) == 0)
+		strncpy(stack_trace_filter_buf, str+8, COMMAND_LINE_SIZE);
+
 	stack_tracer_enabled = 1;
 	last_stack_tracer_enabled = 1;
 	return 1;
@@ -375,6 +383,9 @@ static __init int stack_trace_init(void)
 	trace_create_file("stack_trace_filter", 0444, d_tracer,
 			NULL, &stack_trace_filter_fops);
 
+	if (stack_trace_filter_buf[0])
+		ftrace_set_early_filter(&trace_ops, stack_trace_filter_buf, 1);
+
 	if (stack_tracer_enabled)
 		register_ftrace_function(&trace_ops);
 
-- 
1.7.7.3



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  parent reply	other threads:[~2011-12-21 12:38 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-21 12:36 [PATCH 00/16] [GIT PULL] tracing: fixes/cleanups, no stop-machine, update stack tracer Steven Rostedt
2011-12-21 12:36 ` [PATCH 01/16] ftrace: Fix unregister ftrace_ops accounting Steven Rostedt
2011-12-21 12:36 ` [PATCH 02/16] ftrace: Do not function trace inlined functions Steven Rostedt
2011-12-21 12:36 ` [PATCH 03/16] ftrace: Allow archs to modify code without stop machine Steven Rostedt
2011-12-21 12:36 ` [PATCH 04/16] ftrace: Remove usage of "freed" records Steven Rostedt
2011-12-21 12:36 ` [PATCH 05/16] ftrace: Allocate the mcount record pages as groups Steven Rostedt
2011-12-21 12:36 ` [PATCH 06/16] ftrace: Replace record newlist with record page list Steven Rostedt
2011-12-21 12:36 ` [PATCH 07/16] ftrace: Sort the mcount records on each page Steven Rostedt
2011-12-21 12:36 ` [PATCH 08/16] ftrace: Use bsearch to find record ip Steven Rostedt
2011-12-21 12:36 ` [PATCH 09/16] ftrace: Fix ftrace hash record update with notrace Steven Rostedt
2011-12-21 12:36 ` [PATCH 10/16] ftrace: Create ftrace_hash_empty() helper routine Steven Rostedt
2011-12-21 12:36 ` [PATCH 11/16] ftrace: Allow other users of function tracing to use the output listing Steven Rostedt
2011-12-21 12:36 ` [PATCH 12/16] ftrace: Decouple hash items from showing filtered functions Steven Rostedt
2011-12-21 12:36 ` [PATCH 13/16] tracing: Have stack_tracer use a separate list of functions Steven Rostedt
2011-12-21 12:36 ` [PATCH 14/16] ftrace: Allow access to the boot time function enabling Steven Rostedt
2011-12-21 12:36 ` Steven Rostedt [this message]
2011-12-21 12:36 ` [PATCH 16/16] tracing: Factorize filter creation Steven Rostedt
2012-01-01 18:09 ` [PATCH 00/16] [GIT PULL] tracing: fixes/cleanups, no stop-machine, update stack tracer Ingo Molnar
2012-01-02 10:58   ` Ingo Molnar
2012-01-02 13:48     ` Ingo Molnar
2012-01-02 15:10       ` Ingo Molnar
2012-01-04  0:02       ` Steven Rostedt
2012-01-04  0:12         ` Steven Rostedt
2012-01-04  5:01           ` Steven Rostedt
2012-01-04 14:11             ` Ingo Molnar
2012-01-04 17:05               ` Steven Rostedt
2012-01-04 18:39                 ` Ingo Molnar
2012-01-05  9:19                 ` Ingo Molnar
2012-01-05 11:46                   ` Steven Rostedt
2012-01-05 12:16                     ` Steven Rostedt
2012-01-06  4:58                       ` Steven Rostedt
2012-01-06  8:51                         ` Ingo Molnar
2012-01-06 12:10                           ` Steven Rostedt
2012-01-06 15:29                             ` Steven Rostedt
2012-01-07 12:20                             ` Ingo Molnar
2012-01-07 12:25                     ` Ingo Molnar
2012-01-07 22:32                       ` Steven Rostedt
2012-01-08 11:38                         ` Ingo Molnar
2012-01-02 19:33   ` Steven Rostedt
2012-01-06  5:04   ` 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=20111221123811.457975427@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 \
    /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

Powered by JetHome