Skip to contentSkip to conversation

tracing/core updates

GIT PULL In review Frederic Weisbecker 4 participants 10 messages Oct 13, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Ingo,

Please pull the tracing/core branch that can be found at

git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing.git
tracing/core

Thanks.

Frederic Weisbecker (2):
tracing: Rename set_ftrace to set_bootup_ftrace
tracing: Remove unused ftrace_trace_addr helper

Stefan Assmann (1):
ftrace: add kernel command line graph function filtering

 Documentation/kernel-parameters.txt |    7 +++++++
 kernel/trace/ftrace.c               |   34 ++++++++++++++++++++++++++++++++++
 kernel/trace/trace.c                |    4 ++--
 kernel/trace/trace.h                |    4 ----
 4 files changed, 43 insertions(+), 6 deletions(-)
#1 lore raw

PATCH 1/3 ftrace: add kernel command line graph function filtering

From: Stefan Assmann <[email protected]>

Add a command line parameter to allow limiting the function graphs that are traced on boot up from the given top-level callers , when ftrace=function_graph is specified.

This patch adds the following command line option:
ftrace_graph_filter=function-list

Where function-list is a comma separated list of functions to filter.

[[email protected]: picked the documentation changes from the v2 patch]

LKML-Reference: <[email protected]>

---
 Documentation/kernel-parameters.txt |    7 +++++++
 kernel/trace/ftrace.c               |   34 ++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+), 0 deletions(-)
Documentation/kernel-parameters.txt +7 -0
index 6fa7292..1dc4b9c 100644
@@ -778,6 +778,13 @@ and is between 256 and 4096 characters. It is defined in the file
 			by the set_ftrace_notrace file in the debugfs
 			tracing directory.
 
+	ftrace_graph_filter=[function-list]
+			[FTRACE] Limit the top level callers functions traced
+			by the function graph tracer at boot up.
+			function-list is a comma separated list of functions
+			that can be changed at run time by the
+			set_graph_function file in the debugfs tracing directory.
+
 	gamecon.map[2|3]=
 			[HW,JOY] Multisystem joystick and NES/SNES/PSX pad
 			support via parallel port (up to 5 devices per port)
kernel/trace/ftrace.c +34 -0
index 9a72853..91283d4 100644
@@ -78,6 +78,10 @@ ftrace_func_t ftrace_trace_function __read_mostly = ftrace_stub;
 ftrace_func_t __ftrace_trace_function __read_mostly = ftrace_stub;
 ftrace_func_t ftrace_pid_function __read_mostly = ftrace_stub;
 
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
+static int ftrace_set_func(unsigned long *array, int *idx, char *buffer);
+#endif
+
 static void ftrace_list_func(unsigned long ip, unsigned long parent_ip)
 {
 	struct ftrace_ops *op = ftrace_list;
@@ -2248,6 +2252,7 @@ void ftrace_set_notrace(unsigned char *buf, int len, int reset)
 #define FTRACE_FILTER_SIZE		COMMAND_LINE_SIZE
 static char ftrace_notrace_buf[FTRACE_FILTER_SIZE] __initdata;
 static char ftrace_filter_buf[FTRACE_FILTER_SIZE] __initdata;
+static char ftrace_graph_buf[FTRACE_FILTER_SIZE] __initdata;
 
 static int __init set_ftrace_notrace(char *str)
 {
@@ -2263,6 +2268,31 @@ static int __init set_ftrace_filter(char *str)
 }
 __setup("ftrace_filter=", set_ftrace_filter);
 
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
+static int __init set_graph_function(char *str)
+{
+	strncpy(ftrace_graph_buf, str, FTRACE_FILTER_SIZE);
+	return 1;
+}
+__setup("ftrace_graph_filter=", set_graph_function);
+
+static void __init set_ftrace_early_graph(char *buf)
+{
+	int ret;
+	char *func;
+
+	while (buf) {
+		func = strsep(&buf, ",");
+		/* we allow only one expression at a time */
+		ret = ftrace_set_func(ftrace_graph_funcs, &ftrace_graph_count,
+				      func);
+		if (ret)
+			printk(KERN_DEBUG "ftrace: function %s not "
+					  "traceable\n", func);
+	}
+}
+#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
+
 static void __init set_ftrace_early_filter(char *buf, int enable)
 {
 	char *func;
@@ -2279,6 +2309,10 @@ static void __init set_ftrace_early_filters(void)
 		set_ftrace_early_filter(ftrace_filter_buf, 1);
 	if (ftrace_notrace_buf[0])
 		set_ftrace_early_filter(ftrace_notrace_buf, 0);
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
+	if (ftrace_graph_buf[0])
+		set_ftrace_early_graph(ftrace_graph_buf);
+#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
 }
 
 static int
Signature · 1 line
1.6.2.3
#2 lore raw

Re: [PATCH 1/3] ftrace: add kernel command line graph function filtering

kernel/trace/ftrace.c static int __init set_ftrace_filter(char *str) · line 2274

Quoted 4 lines
kernel/trace/ftrace.c +4 -0
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
+static int __init set_graph_function(char *str)
+{
+	strncpy(ftrace_graph_buf, str, FTRACE_FILTER_SIZE);

should use strlcpy().

Quoted 2 lines
(quoted diff) +2 -0
+	return 1;
+}
#3 lore raw

Re: [PATCH 1/3] ftrace: add kernel command line graph function filtering

2009/10/13 Li Zefan <[email protected]>:

Quoted 7 lines

kernel/trace/ftrace.c static int __init set_ftrace_filter(char *str) · line 2274

Quoted 4 lines
kernel/trace/ftrace.c +4 -0
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
+static int __init set_graph_function(char *str)
+{
+     strncpy(ftrace_graph_buf, str, FTRACE_FILTER_SIZE);

should use strlcpy().

Right, I'll fix, thanks.

#4 lore raw

PATCH 2/3 tracing: Rename set_ftrace to set_bootup_ftrace

In reply to Frederic Weisbecker

Do this rename because set_ftrace is too much generic and not enough self-explainable as a name.

---
 kernel/trace/trace.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
kernel/trace/trace.c +2 -2
index 4506826..866daf8 100644
@@ -129,7 +129,7 @@ static int tracing_set_tracer(const char *buf);
 static char bootup_tracer_buf[MAX_TRACER_SIZE] __initdata;
 static char *default_bootup_tracer;
 
-static int __init set_ftrace(char *str)
+static int __init set_bootup_ftrace(char *str)
 {
 	strncpy(bootup_tracer_buf, str, MAX_TRACER_SIZE);
 	default_bootup_tracer = bootup_tracer_buf;
@@ -137,7 +137,7 @@ static int __init set_ftrace(char *str)
 	ring_buffer_expanded = 1;
 	return 1;
 }
-__setup("ftrace=", set_ftrace);
+__setup("ftrace=", set_bootup_ftrace);
 
 static int __init set_ftrace_dump_on_oops(char *str)
 {
Signature · 1 line
1.6.2.3
maintainer
#5 lore raw

Re: [PATCH 2/3] tracing: Rename set_ftrace to set_bootup_ftrace

Quoted 24 lines · Frederic Weisbecker

Do this rename because set_ftrace is too much generic and not enough self-explainable as a name.

---
 kernel/trace/trace.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
kernel/trace/trace.c +1 -1
index 4506826..866daf8 100644
@@ -129,7 +129,7 @@ static int tracing_set_tracer(const char *buf);
 static char bootup_tracer_buf[MAX_TRACER_SIZE] __initdata;
 static char *default_bootup_tracer;
 
-static int __init set_ftrace(char *str)
+static int __init set_bootup_ftrace(char *str)
 {
 	strncpy(bootup_tracer_buf, str, MAX_TRACER_SIZE);
 	default_bootup_tracer = bootup_tracer_buf;

kernel/trace/trace.c static int __init set_ftrace(char *str) · line 140

Quoted 5 lines
kernel/trace/trace.c +1 -1
@@ -137,7 +137,7 @@ static int __init set_ftrace(char *str)
 	ring_buffer_expanded = 1;
 	return 1;
 }
-__setup("ftrace=", set_ftrace);
+__setup("ftrace=", set_bootup_ftrace);

Actually, it probably should be called, set_cmdline_ftrace. Since it came from the command line, and that is what is matching.

-- Steve

Quoted 3 lines
kernel/trace/trace.c +0 -0
 static int __init set_ftrace_dump_on_oops(char *str)
 {
#6 lore raw

Re: [PATCH 2/3] tracing: Rename set_ftrace to set_bootup_ftrace

2009/10/13 Steven Rostedt <[email protected]>:

Quoted 34 lines · Frederic Weisbecker
Quoted 24 lines

Do this rename because set_ftrace is too much generic and not enough self-explainable as a name.

---
 kernel/trace/trace.c |    4 ++--

 1 files changed, 2 insertions(+), 2 deletions(-)
kernel/trace/trace.c +1 -1
index 4506826..866daf8 100644
@@ -129,7 +129,7 @@ static int tracing_set_tracer(const char *buf);
  static char bootup_tracer_buf[MAX_TRACER_SIZE] __initdata;
  static char *default_bootup_tracer;
 
-static int __init set_ftrace(char *str)
+static int __init set_bootup_ftrace(char *str)
  {
       strncpy(bootup_tracer_buf, str, MAX_TRACER_SIZE);
       default_bootup_tracer = bootup_tracer_buf;

kernel/trace/trace.c static int __init set_ftrace(char *str) · line 140

Quoted 5 lines
kernel/trace/trace.c +1 -1
@@ -137,7 +137,7 @@ static int __init set_ftrace(char *str)
       ring_buffer_expanded = 1;
       return 1;
  }
-__setup("ftrace=", set_ftrace);
+__setup("ftrace=", set_bootup_ftrace);

Actually, it probably should be called, set_cmdline_ftrace. Since it came from the command line, and that is what is matching.

Quoted 1 line

-- Steve

No problem, I can change that in another request that also addresses Li's suggestion.

maintainer
#7 lore raw

Re: [PATCH 2/3] tracing: Rename set_ftrace to set_bootup_ftrace

Quoted 8 lines · Frederic Weisbecker

2009/10/13 Steven Rostedt <[email protected]>:

Quoted 6 lines

kernel/trace/trace.c static int __init set_ftrace(char *str) · line 140

Quoted 2 lines
kernel/trace/trace.c +1 -1
-__setup("ftrace=", set_ftrace);
+__setup("ftrace=", set_bootup_ftrace);

Actually, it probably should be called, set_cmdline_ftrace. Since it came from the command line, and that is what is matching.

Quoted 4 lines
Quoted 1 line

-- Steve

No problem, I can change that in another request that also addresses Li's suggestion.

Yeah, I would label this as an extreme NON-critical change ;-)

-- Steve

#8 lore raw

PATCH 3/3 tracing: Remove unused ftrace_trace_addr helper

In reply to Frederic Weisbecker

Remove the ftrace_trace_addr() function as only its off-case is implemented and there are no users of it currently.

But we keep ftrace_graph_addr() off-case, in case someone come to use the function graph tracer to profit from top-level callers filtering.

---
 kernel/trace/trace.h |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)
kernel/trace/trace.h +0 -4
index 365fb19..f22a7ac 100644
@@ -483,10 +483,6 @@ static inline int ftrace_graph_addr(unsigned long addr)
 	return 0;
 }
 #else
-static inline int ftrace_trace_addr(unsigned long addr)
-{
-	return 1;
-}
 static inline int ftrace_graph_addr(unsigned long addr)
 {
 	return 1;
Signature · 1 line
1.6.2.3
#9 lore raw
In reply to Frederic Weisbecker
Quoted 13 lines · Frederic Weisbecker

Ingo,

Please pull the tracing/core branch that can be found at

git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing.git
tracing/core

Thanks.

Frederic Weisbecker (2):
tracing: Rename set_ftrace to set_bootup_ftrace
tracing: Remove unused ftrace_trace_addr helper

Quoted 8 lines

Stefan Assmann (1):
ftrace: add kernel command line graph function filtering

 Documentation/kernel-parameters.txt |    7 +++++++
 kernel/trace/ftrace.c               |   34 ++++++++++++++++++++++++++++++++++
 kernel/trace/trace.c                |    4 ++--
 kernel/trace/trace.h                |    4 ----
 4 files changed, 43 insertions(+), 6 deletions(-)

Pulled, thanks Frederic!

Ingo