tracing: Small updates on tracing/set_graph_notrace file
Subsystems (3)
cover tracing: Small updates on tracing/set_graph_notrace file
Hello,
This is an update of recent notrace filter change in the function graph tracer. It adds a new kernel boot parameter and also adds description of the file to the tracing/README in debugfs. Finally it changes message when the (both of) notrace filter hash is empty. They'll print below message when there's no entry:
# cat /sys/kernel/debug/tracing/set_graph_notrace #### no functions disabled ####
It's also available at 'ftrace/nograph-v3' branch in my tree
git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git
Thanks,
Namhyung
Namhyung Kim (4):
tracing: Add ftrace_graph_notrace boot parameter
tracing: Improve message of empty set_graph_notrace file
tracing: Improve message of empty set_ftrace_notrace file
tracing: Add description of set_graph_notrace to tracing/README
Documentation/kernel-parameters.txt | 6 +++++ kernel/trace/ftrace.c | 46 ++++++++++++++++++++++++++++++----- kernel/trace/trace.c | 1 + 3 files changed, 47 insertions(+), 6 deletions(-)
Signature · 1 line
1.7.9.2
PATCH 1/4 tracing: Add ftrace_graph_notrace boot parameter
The ftrace_graph_notrace option is for specifying notrace filter for function graph tracer at boot time. It can be altered after boot using set_graph_notrace file on the debugfs.
--- Documentation/kernel-parameters.txt | 6 ++++++ kernel/trace/ftrace.c | 24 ++++++++++++++++++++---- 2 files changed, 26 insertions(+), 4 deletions(-)
Documentation/kernel-parameters.txt +6 -0
@@ -1062,6 +1062,12 @@ bytes respectively. Such letter suffixes can also be entirely omitted. that can be changed at run time by the set_graph_function file in the debugfs tracing directory. + ftrace_graph_notrace=[function-list] + [FTRACE] Do not trace from the functions specified in + function-list. This list is a comma separated list of + functions that can be changed at run time by the + set_graph_notrace 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 +20 -4
@@ -3628,6 +3628,7 @@ __setup("ftrace_filter=", set_ftrace_filter);#ifdef CONFIG_FUNCTION_GRAPH_TRACER static char ftrace_graph_buf[FTRACE_FILTER_SIZE ]__initdata ; +static char ftrace_graph_notrace_buf[FTRACE_FILTER_SIZE ]__initdata ;static int ftrace_set_func (unsigned long *array,int *idx,int size,char *buffer);static int __init set_graph_function (char *str)
@@ -3637,16 +3638,29 @@ static int __init set_graph_function(char *str) }__setup ("ftrace_graph_filter=" , set_graph_function); -static void __init set_ftrace_early_graph (char *buf) +static int __init set_graph_notrace_function (char *str) +{ +strlcpy (ftrace_graph_notrace_buf, str,FTRACE_FILTER_SIZE ); +return 1 ; +} +__setup ("ftrace_graph_notrace=" , set_graph_notrace_function); + +static void __init set_ftrace_early_graph (char *buf,int enable) {int ret;char *func; +unsigned long *table = ftrace_graph_funcs; +int *count = &ftrace_graph_count; + +if (!enable) { + table = ftrace_graph_notrace_funcs; + count = &ftrace_graph_notrace_count; + }while (buf) { func =strsep (&buf,"," );/* we allow only one expression at a time */ - ret =ftrace_set_func (ftrace_graph_funcs, &ftrace_graph_count, -FTRACE_GRAPH_MAX_FUNCS , func); + ret =ftrace_set_func (table, count,FTRACE_GRAPH_MAX_FUNCS , func);if (ret)printk (KERN_DEBUG "ftrace: function %s not " "traceable\n" , func);
@@ -3675,7 +3689,9 @@ static void __init set_ftrace_early_filters(void)ftrace_set_early_filter (&global_ops, ftrace_notrace_buf,0 );#ifdef CONFIG_FUNCTION_GRAPH_TRACER if (ftrace_graph_buf[0 ]) -set_ftrace_early_graph (ftrace_graph_buf); +set_ftrace_early_graph (ftrace_graph_buf,1 ); +if (ftrace_graph_notrace_buf[0 ]) +set_ftrace_early_graph (ftrace_graph_notrace_buf,0 );#endif /* CONFIG_FUNCTION_GRAPH_TRACER */ }
Signature · 1 line
1.7.9.2
PATCH 2/4 tracing: Improve message of empty set_graph_notrace file
In reply to Namhyung KimWhen there's no entry in set_graph_notrace, it'll print below message
#### all functions enabled ####
While this is technically correct, it's better to print like below:
#### no functions disabled ####
--- kernel/trace/ftrace.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
kernel/trace/ftrace.c +6 -1
@@ -3833,7 +3833,12 @@ static int g_show(struct seq_file *m, void *v)return 0 ;if (ptr == (unsigned long *)1 ) { -seq_printf (m,"#### all functions enabled ####\n" ); +struct ftrace_graph_data *fgd = m->private; + +if (fgd->table == ftrace_graph_funcs) +seq_printf (m,"#### all functions enabled ####\n" ); +else +seq_printf (m,"#### no functions disabled ####\n" );return 0 ; }
Signature · 1 line
1.7.9.2
PATCH 3/4 tracing: Improve message of empty set_ftrace_notrace file
In reply to Namhyung KimWhen there's no entry in set_ftrace_notrace, it'll print nothing, but it's better to print something like below like set_graph_notrace does:
#### no functions disabled ####
--- kernel/trace/ftrace.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
kernel/trace/ftrace.c +14 -1
@@ -2603,6 +2603,16 @@ static void *t_start(struct seq_file *m, loff_t *pos)return iter; } +if (iter->flags &FTRACE_ITER_NOTRACE && +ftrace_hash_empty (ops->notrace_hash)) { +if (*pos >0 ) +return t_hash_start (m, pos); + iter->flags |=FTRACE_ITER_PRINTALL ; +/* reset in case of seek/pread */ + iter->flags &= ~FTRACE_ITER_HASH ; +return iter; + } +if (iter->flags &FTRACE_ITER_HASH )return t_hash_start (m, pos);
@@ -2639,7 +2649,10 @@ static int t_show(struct seq_file *m, void *v)return t_hash_show (m, iter);if (iter->flags &FTRACE_ITER_PRINTALL ) { -seq_printf (m,"#### all functions enabled ####\n" ); +if (iter->flags &FTRACE_ITER_NOTRACE ) +seq_printf (m,"#### no functions disabled ####\n" ); +else +seq_printf (m,"#### all functions enabled ####\n" );return 0 ; }
Signature · 1 line
1.7.9.2
Steven Rostedt
maintainerRe: [PATCH 3/4] tracing: Improve message of empty set_ftrace_notrace file
Quoted 18 lines · On Fri, 13 Jun 2014 01:23:52 +0900 Namhyung Kim <[email protected]> wrote:
When there's no entry in
set_ftrace_notrace, it'll print nothing, but it's better to print something like below likeset_graph_notracedoes:#### no functions disabled ####
Reported-by Naoya Horiguchi <[email protected]>Signed-off-by Namhyung Kim <[email protected]>--- kernel/trace/ftrace.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)kernel/trace/ftrace.c +0
-0@@ -2603,6 +2603,16 @@ static void *t_start(struct seq_file *m, loff_t *pos)return iter; }
kernel/trace/ftrace.c static void *t_start(struct seq_file *m, loff_t *pos) · line 2614
Quoted 10 lines
kernel/trace/ftrace.c +9
-0+if (iter->flags &FTRACE_ITER_NOTRACE && +ftrace_hash_empty (ops->notrace_hash)) { +if (*pos >0 ) +return t_hash_start (m, pos); + iter->flags |=FTRACE_ITER_PRINTALL ; +/* reset in case of seek/pread */ + iter->flags &= ~FTRACE_ITER_HASH ; +return iter; + }
This contains the exact if block as the condition before it. Why not join the two:
if ((iter->flags & FTRACE_ITER_FILTER &&
ftrace_hash_empty(ops->filter_hash))
||
(iter->flags & FTRACE_ITER_NOTRACE &&
ftrace_hash_empty(ops->notrace_hash))) {-- Steve
Quoted 16 lines
kernel/trace/ftrace.c +5
-1+if (iter->flags &FTRACE_ITER_HASH )return t_hash_start (m, pos);@@ -2639,7 +2649,10 @@ static int t_show(struct seq_file *m, void *v)return t_hash_show (m, iter);if (iter->flags &FTRACE_ITER_PRINTALL ) { -seq_printf (m,"#### all functions enabled ####\n" ); +if (iter->flags &FTRACE_ITER_NOTRACE ) +seq_printf (m,"#### no functions disabled ####\n" ); +else +seq_printf (m,"#### all functions enabled ####\n" );return 0 ; }
PATCH v2 3/4 tracing: Improve message of empty set_ftrace_notrace file
When there's no entry in set_ftrace_notrace, it'll print nothing, but it's better to print something like below like set_graph_notrace does:
#### no functions disabled ####
---
also updated the ftrace/nograph-v3 branch..
kernel/trace/ftrace.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
kernel/trace/ftrace.c +8 -3
@@ -2593,8 +2593,10 @@ static void *t_start(struct seq_file *m, loff_t *pos)* off, we can short cut and just print out that all * functions are enabled. */ -if (iter->flags &FTRACE_ITER_FILTER && -ftrace_hash_empty (ops->filter_hash)) { +if ((iter->flags &FTRACE_ITER_FILTER && +ftrace_hash_empty (ops->filter_hash)) || + (iter->flags &FTRACE_ITER_NOTRACE && +ftrace_hash_empty (ops->notrace_hash))) {if (*pos >0 )return t_hash_start (m, pos); iter->flags |=FTRACE_ITER_PRINTALL ;
@@ -2639,7 +2641,10 @@ static int t_show(struct seq_file *m, void *v)return t_hash_show (m, iter);if (iter->flags &FTRACE_ITER_PRINTALL ) { -seq_printf (m,"#### all functions enabled ####\n" ); +if (iter->flags &FTRACE_ITER_NOTRACE ) +seq_printf (m,"#### no functions disabled ####\n" ); +else +seq_printf (m,"#### all functions enabled ####\n" );return 0 ; }
Signature · 1 line
1.7.9.2
PATCH 4/4 tracing: Add description of set_graph_notrace to tracing/README
In reply to Namhyung KimIt was missing the description of set_graph_notrace file. Add it.
--- kernel/trace/trace.c | 1 + 1 file changed, 1 insertion(+)
kernel/trace/trace.c +1 -0
@@ -3687,6 +3687,7 @@ static const char readme_msg[] =#endif #ifdef CONFIG_FUNCTION_GRAPH_TRACER " set_graph_function\t- Trace the nested calls of a function (function_graph)\n" +" set_graph_notrace\t- Do not trace the nested calls of a function (function_graph)\n" " max_graph_depth\t- Trace a limited depth of nested calls (0 is unlimited)\n"#endif #ifdef CONFIG_TRACER_SNAPSHOT
Signature · 1 line
1.7.9.2