* [PATCH 0/4] tracing: Small updates on tracing/set_graph_notrace file
@ 2014-06-12 16:23 Namhyung Kim
2014-06-12 16:23 ` [PATCH 1/4] tracing: Add ftrace_graph_notrace boot parameter Namhyung Kim
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Namhyung Kim @ 2014-06-12 16:23 UTC (permalink / raw)
To: Steven Rostedt; +Cc: Ingo Molnar, LKML, Naoya Horiguchi
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
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
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(-)
--
1.7.9.2
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/4] tracing: Add ftrace_graph_notrace boot parameter
2014-06-12 16:23 [PATCH 0/4] tracing: Small updates on tracing/set_graph_notrace file Namhyung Kim
@ 2014-06-12 16:23 ` Namhyung Kim
2014-06-12 16:23 ` [PATCH 2/4] tracing: Improve message of empty set_graph_notrace file Namhyung Kim
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Namhyung Kim @ 2014-06-12 16:23 UTC (permalink / raw)
To: Steven Rostedt; +Cc: Ingo Molnar, LKML
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.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
Documentation/kernel-parameters.txt | 6 ++++++
kernel/trace/ftrace.c | 24 ++++++++++++++++++++----
2 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 43842177b771..40cf0caf92a9 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -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)
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 071908f58e7a..f08edd7125c6 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -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 */
}
--
1.7.9.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/4] tracing: Improve message of empty set_graph_notrace file
2014-06-12 16:23 [PATCH 0/4] tracing: Small updates on tracing/set_graph_notrace file Namhyung Kim
2014-06-12 16:23 ` [PATCH 1/4] tracing: Add ftrace_graph_notrace boot parameter Namhyung Kim
@ 2014-06-12 16:23 ` Namhyung Kim
2014-06-12 16:23 ` [PATCH 3/4] tracing: Improve message of empty set_ftrace_notrace file Namhyung Kim
2014-06-12 16:23 ` [PATCH 4/4] tracing: Add description of set_graph_notrace to tracing/README Namhyung Kim
3 siblings, 0 replies; 7+ messages in thread
From: Namhyung Kim @ 2014-06-12 16:23 UTC (permalink / raw)
To: Steven Rostedt; +Cc: Ingo Molnar, LKML
When 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 ####
Reported-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
kernel/trace/ftrace.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index f08edd7125c6..b375cf2cd786 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -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;
}
--
1.7.9.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/4] tracing: Improve message of empty set_ftrace_notrace file
2014-06-12 16:23 [PATCH 0/4] tracing: Small updates on tracing/set_graph_notrace file Namhyung Kim
2014-06-12 16:23 ` [PATCH 1/4] tracing: Add ftrace_graph_notrace boot parameter Namhyung Kim
2014-06-12 16:23 ` [PATCH 2/4] tracing: Improve message of empty set_graph_notrace file Namhyung Kim
@ 2014-06-12 16:23 ` Namhyung Kim
2014-06-12 19:27 ` Steven Rostedt
2014-06-12 16:23 ` [PATCH 4/4] tracing: Add description of set_graph_notrace to tracing/README Namhyung Kim
3 siblings, 1 reply; 7+ messages in thread
From: Namhyung Kim @ 2014-06-12 16:23 UTC (permalink / raw)
To: Steven Rostedt; +Cc: Ingo Molnar, LKML
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 ####
Reported-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
kernel/trace/ftrace.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index b375cf2cd786..566ffa0f3442 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -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;
}
--
1.7.9.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/4] tracing: Add description of set_graph_notrace to tracing/README
2014-06-12 16:23 [PATCH 0/4] tracing: Small updates on tracing/set_graph_notrace file Namhyung Kim
` (2 preceding siblings ...)
2014-06-12 16:23 ` [PATCH 3/4] tracing: Improve message of empty set_ftrace_notrace file Namhyung Kim
@ 2014-06-12 16:23 ` Namhyung Kim
3 siblings, 0 replies; 7+ messages in thread
From: Namhyung Kim @ 2014-06-12 16:23 UTC (permalink / raw)
To: Steven Rostedt; +Cc: Ingo Molnar, LKML
It was missing the description of set_graph_notrace file. Add it.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
kernel/trace/trace.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 384ede311717..a5f1f8f10645 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -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
--
1.7.9.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 3/4] tracing: Improve message of empty set_ftrace_notrace file
2014-06-12 16:23 ` [PATCH 3/4] tracing: Improve message of empty set_ftrace_notrace file Namhyung Kim
@ 2014-06-12 19:27 ` Steven Rostedt
2014-06-13 7:24 ` [PATCH v2 " Namhyung Kim
0 siblings, 1 reply; 7+ messages in thread
From: Steven Rostedt @ 2014-06-12 19:27 UTC (permalink / raw)
To: Namhyung Kim; +Cc: Ingo Molnar, LKML
On Fri, 13 Jun 2014 01:23:52 +0900
Namhyung Kim <namhyung@kernel.org> wrote:
> 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 ####
>
> Reported-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
> kernel/trace/ftrace.c | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index b375cf2cd786..566ffa0f3442 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -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;
> + }
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
> +
> 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;
> }
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 3/4] tracing: Improve message of empty set_ftrace_notrace file
2014-06-12 19:27 ` Steven Rostedt
@ 2014-06-13 7:24 ` Namhyung Kim
0 siblings, 0 replies; 7+ messages in thread
From: Namhyung Kim @ 2014-06-13 7:24 UTC (permalink / raw)
To: Steven Rostedt; +Cc: Ingo Molnar, LKML
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 ####
Reported-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
also updated the ftrace/nograph-v3 branch..
kernel/trace/ftrace.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index b375cf2cd786..ff402e092df1 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -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;
}
--
1.7.9.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-06-13 7:24 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-12 16:23 [PATCH 0/4] tracing: Small updates on tracing/set_graph_notrace file Namhyung Kim
2014-06-12 16:23 ` [PATCH 1/4] tracing: Add ftrace_graph_notrace boot parameter Namhyung Kim
2014-06-12 16:23 ` [PATCH 2/4] tracing: Improve message of empty set_graph_notrace file Namhyung Kim
2014-06-12 16:23 ` [PATCH 3/4] tracing: Improve message of empty set_ftrace_notrace file Namhyung Kim
2014-06-12 19:27 ` Steven Rostedt
2014-06-13 7:24 ` [PATCH v2 " Namhyung Kim
2014-06-12 16:23 ` [PATCH 4/4] tracing: Add description of set_graph_notrace to tracing/README Namhyung Kim
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.