* [PATCH] ftrace: fix "notrace" filtering priority
@ 2008-06-14 6:29 Abhishek Sagar
2008-06-14 6:33 ` Ingo Molnar
0 siblings, 1 reply; 2+ messages in thread
From: Abhishek Sagar @ 2008-06-14 6:29 UTC (permalink / raw)
To: Steven Rostedt; +Cc: Ingo Molnar, Thomas Gleixner, LKML
Hi Steven,
This is a fix to give notrace filter rules priority over "set_ftrace_filter"
rules. This way functions set to be filtered and also in the notrace list will
not get traced.
Signed-off-by: Abhishek Sagar <sagar.abhishek@gmail.com>
---
This fix ensures that functions which are set to be filetered and are
concurrently marked as "notrace" don't get recorded. As of now, if
a record is marked as FTRACE_FL_FILTER and is enabled, then the notrace
flag is not checked. Tested on x86-32.
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 0118979..b532e4a 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -355,20 +355,26 @@ __ftrace_replace_code(struct dyn_ftrace *rec,
* If this record is set not to trace then
* do nothing.
*
+ * If this record is set not to trace and
+ * it is enabled then disable it.
+ *
* If this record is not set to be filtered and
* it is enabled, disable it.
*/
- fl = rec->flags & (FTRACE_FL_FILTER | FTRACE_FL_ENABLED);
+
+ fl = rec->flags & (FTRACE_FL_FILTER | FTRACE_FL_NOTRACE |
+ FTRACE_FL_ENABLED);
if ((fl == (FTRACE_FL_FILTER | FTRACE_FL_ENABLED)) ||
- (fl == 0) || (rec->flags & FTRACE_FL_NOTRACE))
+ (fl == (FTRACE_FL_FILTER | FTRACE_FL_NOTRACE)) ||
+ !fl || (fl == FTRACE_FL_NOTRACE))
return 0;
/*
* If it is enabled disable it,
* otherwise enable it!
*/
- if (fl == FTRACE_FL_ENABLED) {
+ if (fl & FTRACE_FL_ENABLED) {
/* swap new and old */
new = old;
old = ftrace_call_replace(ip, FTRACE_ADDR);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ftrace: fix "notrace" filtering priority
2008-06-14 6:29 [PATCH] ftrace: fix "notrace" filtering priority Abhishek Sagar
@ 2008-06-14 6:33 ` Ingo Molnar
0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2008-06-14 6:33 UTC (permalink / raw)
To: Abhishek Sagar; +Cc: Steven Rostedt, Thomas Gleixner, LKML
* Abhishek Sagar <sagar.abhishek@gmail.com> wrote:
> Hi Steven,
>
> This is a fix to give notrace filter rules priority over
> "set_ftrace_filter" rules. This way functions set to be filtered and
> also in the notrace list will not get traced.
>
> This fix ensures that functions which are set to be filetered and are
> concurrently marked as "notrace" don't get recorded. As of now, if a
> record is marked as FTRACE_FL_FILTER and is enabled, then the notrace
> flag is not checked. Tested on x86-32.
applied to tip/tracing/ftrace - thanks Abhishek.
Ingo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-06-14 6:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-14 6:29 [PATCH] ftrace: fix "notrace" filtering priority Abhishek Sagar
2008-06-14 6:33 ` Ingo Molnar
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.