ftrace: add kernel command line graph function filtering
Subsystems (3)
PATCH 1/1 ftrace: add kernel command line graph function filtering
Quoted 1 line
From
894e934e782ddaa33eb6d156d8326cdf479b5f62Mon Sep 17 00:00:00 2001
From: Stefan Assmann <[email protected]>
Date: Mon, 12 Oct 2009 09:11:47 +0200
Subject: [PATCH] ftrace: add kernel command line graph function filtering
Add a command line parameter to allow limiting the function graphs that are traced on boot up, 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.
--- Documentation/kernel-parameters.txt | 9 ++++++++- kernel/trace/ftrace.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletions(-)
Documentation/kernel-parameters.txt +8 -1
@@ -771,7 +771,14 @@ and is between 256 and 4096 characters. It is defined in the file tracer at boot up. function-list is a comma separated list of functions. This list can be changed at run time by the set_ftrace_filter file in the debugfs - tracing directory. + tracing directory. + + ftrace_graph_filter=[function-list] + [FTRACE] Limit the functions traced by the function + graph tracer at boot up. function-list is a comma + separated list of functions. This list can be changed + at run time by the set_graph_function file in the + debugfs tracing directory. ftrace_notrace=[function-list] [FTRACE] Do not trace the functions specified in
kernel/trace/ftrace.c +34 -0
@@ -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;
@@ -2302,6 +2306,7 @@ void ftrace_set_notrace(unsigned char *buf, int len, int reset)#define FTRACE_FILTER_SIZE COMMAND_LINE_SIZEstatic 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) {
@@ -2317,6 +2322,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;
@@ -2333,6 +2363,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.5
2009/10/12 Stefan Assmann <[email protected]>:
Quoted 10 lines
From
894e934e782ddaa33eb6d156d8326cdf479b5f62Mon Sep 17 00:00:00 2001
From: Stefan Assmann <[email protected]>
Date: Mon, 12 Oct 2009 09:11:47 +0200
Subject: [PATCH] ftrace: add kernel command line graph function filteringAdd a command line parameter to allow limiting the function graphs that are traced on boot up, when ftrace=function_graph is specified.
This patch adds the following command line option:
ftrace_graph_filter=function-list
If we use this parameter, we undoubtedly want to launch the function graph tracer.
I'd then suggest to arm ftrace=function_graph automatically if we have ftrace_graph_filter
set.
Quoted 18 lines
Where function-list is a comma separated list of functions to filter.
Signed-off-by Stefan Assmann <[email protected]>---
Documentation/kernel-parameters.txt | 9 ++++++++-kernel/trace/ftrace.c| 34 ++++++++++++++++++++++++++++++++++2 files changed, 42 insertions(+), 1 deletions(-)Documentation/kernel-parameters.txt +0
-0@@ -771,7 +771,14 @@ and is between 256 and 4096 characters. It is defined in the filetracer at boot up. function-list is a comma separated list of functions. This list can be changed at run time by the
set_ftrace_filterfile in the debugfs
- tracing directory.
Quoted 8 lines
+ tracing directory.
+
+ ftrace_graph_filter=[function-list]
+ [FTRACE] Limit the functions traced by the function
+ graph tracer at boot up. function-list is a comma
+ separated list of functions. This list can be changed
+ at run time by theset_graph_functionfile in the
+ debugfs tracing directory.
May be you should use a more detailed definition of this parameter. Limiting a function traced by the function graph tracer is ambiguous.
It means we can have either:
function_to_trace();
or:
function_to_trace() {
foo() {
bar();
}
}We want the second thing.
May be instead you can write:
"Limit the top level callers functions traced by the function
graph tracer at boot up."
Otherwise, looks good to me:
Thanks.
Quoted 72 lines
ftrace_notrace=[function-list]
[FTRACE] Do not trace the functions specified inkernel/trace/ftrace.c +34
-0@@ -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;@@ -2302,6 +2306,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) {@@ -2317,6 +2322,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;@@ -2333,6 +2363,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
--
1.6.2.5
Quoted 67 lines · Frédéric Weisbecker
2009/10/12 Stefan Assmann <[email protected]>:
Quoted 10 lines
From
894e934e782ddaa33eb6d156d8326cdf479b5f62Mon Sep 17 00:00:00 2001
From: Stefan Assmann <[email protected]>
Date: Mon, 12 Oct 2009 09:11:47 +0200
Subject: [PATCH] ftrace: add kernel command line graph function filteringAdd a command line parameter to allow limiting the function graphs that are traced on boot up, when ftrace=function_graph is specified.
This patch adds the following command line option:
ftrace_graph_filter=function-listIf we use this parameter, we undoubtedly want to launch the function graph tracer.
I'd then suggest to arm ftrace=function_graph automatically if we haveftrace_graph_filter
set.Quoted 16 lines
Where function-list is a comma separated list of functions to filter.
Signed-off-by Stefan Assmann <[email protected]>--- Documentation/kernel-parameters.txt | 9 ++++++++- kernel/trace/ftrace.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletions(-)Documentation/kernel-parameters.txt +0
-0@@ -771,7 +771,14 @@ and is between 256 and 4096 characters. It is defined in the file tracer at boot up. function-list is a comma separated list of functions. This list can be changed at runDocumentation/kernel-parameters.txt and is between 256 and 4096 characters. It is defined in the file · line 781
Quoted 10 lines
Documentation/kernel-parameters.txt +8
-1time by the set_ftrace_filter file in the debugfs - tracing directory. + tracing directory. + + ftrace_graph_filter=[function-list] + [FTRACE] Limit the functions traced by the function + graph tracer at boot up. function-list is a comma + separated list of functions. This list can be changed + at run time by the set_graph_function file in the + debugfs tracing directory.May be you should use a more detailed definition of this parameter. Limiting a function traced by the function graph tracer is ambiguous.
It means we can have either:
function_to_trace();or:
function_to_trace() { foo() { bar(); } }We want the second thing.
May be instead you can write:
Quoted 8 lines
"Limit the top level callers functions traced by the function
graph tracer at boot up."Otherwise, looks good to me:
Thanks.
Thanks for reviewing Frédéric!
I hope the following is what you had in mind.
Stefan
Quoted 1 line
From
edeb75ce9c9a35d5905d45954f66a0e05d5fe8abMon Sep 17 00:00:00 2001
From: Stefan Assmann <[email protected]>
Date: Mon, 12 Oct 2009 09:11:47 +0200
Subject: [PATCH] ftrace: add kernel command line graph function filtering
Add a command line parameter to allow limiting the top level callers functions traced by the function graph tracer at boot up.
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.
--- Documentation/kernel-parameters.txt | 9 ++++++++- kernel/trace/ftrace.c | 35 +++++++++++++++++++++++++++++++++++ kernel/trace/trace.c | 2 +- kernel/trace/trace.h | 1 + 4 files changed, 45 insertions(+), 2 deletions(-)
Documentation/kernel-parameters.txt +8 -1
@@ -771,7 +771,14 @@ and is between 256 and 4096 characters. It is defined in the file tracer at boot up. function-list is a comma separated list of functions. This list can be changed at run time by the set_ftrace_filter file in the debugfs - tracing directory. + 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. ftrace_notrace=[function-list] [FTRACE] Do not trace the functions specified in
kernel/trace/ftrace.c +35 -0
@@ -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;
@@ -2302,6 +2306,7 @@ void ftrace_set_notrace(unsigned char *buf, int len, int reset)#define FTRACE_FILTER_SIZE COMMAND_LINE_SIZEstatic 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) {
@@ -2317,6 +2322,32 @@ 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; + +set_ftrace ("function_graph" ); +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;
@@ -2333,6 +2364,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
kernel/trace/trace.c +1 -1
@@ -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) +int __init set_ftrace (char *str) {strncpy (bootup_tracer_buf, str,MAX_TRACER_SIZE ); default_bootup_tracer = bootup_tracer_buf;
kernel/trace/trace.h +1 -0
@@ -461,6 +461,7 @@ extern int trace_clock_id;extern enum print_line_t print_graph_function (struct trace_iterator *iter);extern enum print_line_t trace_print_graph_duration (unsigned long long duration,struct trace_seq *s); +extern int set_ftrace (char *str);#ifdef CONFIG_DYNAMIC_FTRACE /* TODO: make this variable */
Signature · 1 line
1.6.2.5
Quoted 18 lines · Stefan Assmann
Thanks for reviewing Frédéric!
I hope the following is what you had in mind.Stefan
From
edeb75ce9c9a35d5905d45954f66a0e05d5fe8abMon Sep 17 00:00:00 2001
From: Stefan Assmann <[email protected]>
Date: Mon, 12 Oct 2009 09:11:47 +0200
Subject: [PATCH] ftrace: add kernel command line graph function filteringAdd a command line parameter to allow limiting the top level callers functions traced by the function graph tracer at boot up.
This patch adds the following command line option:
ftrace_graph_filter=function-listWhere function-list is a comma separated list of functions to filter.
Quoted 7 lines
Signed-off-by Stefan Assmann <[email protected]>---
Documentation/kernel-parameters.txt | 9 ++++++++-kernel/trace/ftrace.c| 35 +++++++++++++++++++++++++++++++++++kernel/trace/trace.c| 2 +-kernel/trace/trace.h| 1 +4 files changed, 45 insertions(+), 2 deletions(-)
Yup, looks good to me. I'm going to queue it.
Just some minor neats I'll change, see below:
Quoted 25 lines
Documentation/kernel-parameters.txt +0
-0@@ -771,7 +771,14 @@ and is between 256 and 4096 characters. It is defined in the filetracer at boot up. function-list is a comma separated list of functions. This list can be changed at run time by the
set_ftrace_filterfile in the debugfs
- tracing directory.
+ 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_functionfile in the debugfs tracing directory.ftrace_notrace=[function-list]
[FTRACE] Do not trace the functions specified inkernel/trace/ftrace.c +0
-0
kernel/trace/ftrace.c ftrace_func_t ftrace_trace_function __read_mostly = ftrace_stub; · line 83
Quoted 6 lines
kernel/trace/ftrace.c +3
-0@@ -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
I'll try to move most of this new code in the bottom of ftrace.c, where most of the ftrace related function graph tracer features are implemented.
Hopefully that could avoid us this ifdef'd declaration and all of the new others by putting them in the already ifdef'd section of function graph helpers. And also it's better to group the function graph helpers together.
Quoted 60 lines
kernel/trace/ftrace.c +26
-0static void ftrace_list_func(unsigned long ip, unsigned long parent_ip) { struct ftrace_ops *op = ftrace_list;@@ -2302,6 +2306,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) {@@ -2317,6 +2322,32 @@ 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; + + set_ftrace("function_graph"); + 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;
kernel/trace/ftrace.c +4
-0@@ -2333,6 +2364,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
kernel/trace/trace.c +0
-0
kernel/trace/trace.c static int tracing_set_tracer(const char *buf); · line 132
Quoted 5 lines
kernel/trace/trace.c +1
-1@@ -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) +int __init set_ftrace (char *str)
I'm also going to rename this into set_early_ftrace() :-)
Thanks!
Steven Rostedt
maintainerQuoted 13 lines · Frédéric Weisbecker
2009/10/12 Stefan Assmann <[email protected]>:
Quoted 10 lines
From
894e934e782ddaa33eb6d156d8326cdf479b5f62Mon Sep 17 00:00:00 2001
From: Stefan Assmann <[email protected]>
Date: Mon, 12 Oct 2009 09:11:47 +0200
Subject: [PATCH] ftrace: add kernel command line graph function filteringAdd a command line parameter to allow limiting the function graphs that are traced on boot up, when ftrace=function_graph is specified.
This patch adds the following command line option:
ftrace_graph_filter=function-list
Quoted 6 lines
If we use this parameter, we undoubtedly want to launch the function graph tracer.
I'd then suggest to arm ftrace=function_graph automatically if we haveftrace_graph_filter
set.
Actually, I disagree. I may just be lazy, and want to set up the function graph to a particular set of functions. It doesn't mean I want to run the function_graph tracer on boot up.
This is the same reason I don't automatically set up ftrace=function when the filter and notrace functions are set.
-- Steve
Quoted 21 lines · Steven Rostedt
Quoted 13 lines · Frédéric Weisbecker
2009/10/12 Stefan Assmann <[email protected]>:
Quoted 10 lines
From
894e934e782ddaa33eb6d156d8326cdf479b5f62Mon Sep 17 00:00:00 2001
From: Stefan Assmann <[email protected]>
Date: Mon, 12 Oct 2009 09:11:47 +0200
Subject: [PATCH] ftrace: add kernel command line graph function filteringAdd a command line parameter to allow limiting the function graphs that are traced on boot up, when ftrace=function_graph is specified.
This patch adds the following command line option:
ftrace_graph_filter=function-listQuoted 6 lines
If we use this parameter, we undoubtedly want to launch the function graph tracer.
I'd then suggest to arm ftrace=function_graph automatically if we haveftrace_graph_filter
set.
Quoted 6 lines
Actually, I disagree. I may just be lazy, and want to set up the function graph to a particular set of functions. It doesn't mean I want to run the
function_graphtracer on boot up.This is the same reason I don't automatically set up ftrace=function when the filter and notrace functions are set.
No problem. I'll take the previous patch then, plus the kernel parameter doc fix in the current one :-)
Steven Rostedt
maintainerQuoted 2 lines · Frédéric Weisbecker
No problem. I'll take the previous patch then, plus the kernel parameter doc fix in the current one :-)
Great, so you'll pull in these changes then?
-- Steve
Quoted 8 lines · Steven Rostedt
Quoted 2 lines · Frédéric Weisbecker
No problem. I'll take the previous patch then, plus the kernel parameter doc fix in the current one :-)
Great, so you'll pull in these changes then?
-- Steve
Yep, will push that soon.
Commit-ID: 369bc18f9a6c4e2686204c1d7476ab684a720968 Gitweb: http://git.kernel.org/tip/369bc18f9a6c4e2686204c1d7476ab684a720968 Author: Stefan Assmann <[email protected]> AuthorDate: Mon, 12 Oct 2009 22:17:21 +0200 Committer: Frederic Weisbecker <[email protected]> CommitDate: Mon, 12 Oct 2009 22:17:21 +0200
ftrace: add kernel command line graph function filtering
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
@@ -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
@@ -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_SIZEstatic 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