* [PATCH 0/3] ftrace: updates for tip
@ 2008-11-15 0:45 Steven Rostedt
2008-11-15 0:45 ` [PATCH 1/3] ftrace: remove condition from ftrace_record_ip Steven Rostedt
` (2 more replies)
0 siblings, 3 replies; 17+ messages in thread
From: Steven Rostedt @ 2008-11-15 0:45 UTC (permalink / raw)
To: linux-kernel
Cc: Ingo Molnar, Andrew Morton, Frederic Weisbecker, Peter Zijlstra
Ingo,
The following patches are in:
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
branch: tip/devel
Steven Rostedt (3):
ftrace: remove condition from ftrace_record_ip
ftrace: disable ftrace on anomalies in trace start and stop
ftrace: do not process freed records
----
kernel/trace/ftrace.c | 91 +++++++++++++++++++++++++++---------------------
1 files changed, 51 insertions(+), 40 deletions(-)
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 1/3] ftrace: remove condition from ftrace_record_ip
2008-11-15 0:45 [PATCH 0/3] ftrace: updates for tip Steven Rostedt
@ 2008-11-15 0:45 ` Steven Rostedt
2008-11-15 0:45 ` [PATCH 2/3] ftrace: disable ftrace on anomalies in trace start and stop Steven Rostedt
2008-11-15 0:45 ` [PATCH 3/3] ftrace: do not process freed records Steven Rostedt
2 siblings, 0 replies; 17+ messages in thread
From: Steven Rostedt @ 2008-11-15 0:45 UTC (permalink / raw)
To: linux-kernel
Cc: Ingo Molnar, Andrew Morton, Frederic Weisbecker, Peter Zijlstra,
Steven Rostedt
[-- Attachment #1: 0001-ftrace-remove-condition-from-ftrace_record_ip.patch --]
[-- Type: text/plain, Size: 1004 bytes --]
Impact: let module functions be recorded when dyn ftrace not enabled
When dynamic ftrace had a daemon and a hash to record the locations
of mcount callers at run time, the recording needed to stop when
ftrace was disabled. But now that the recording is done at compile time
and the ftrace_record_ip is only called at boot up and when a module
is loaded, we no longer need to check if ftrace_enabled is set.
In fact, this breaks module load if it is not set because we skip
over module functions.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
kernel/trace/ftrace.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index beb21a5..66aa19e 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -335,7 +335,7 @@ ftrace_record_ip(unsigned long ip)
{
struct dyn_ftrace *rec;
- if (!ftrace_enabled || ftrace_disabled)
+ if (ftrace_disabled)
return NULL;
rec = ftrace_alloc_dyn_node(ip);
--
1.5.6.5
--
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 2/3] ftrace: disable ftrace on anomalies in trace start and stop
2008-11-15 0:45 [PATCH 0/3] ftrace: updates for tip Steven Rostedt
2008-11-15 0:45 ` [PATCH 1/3] ftrace: remove condition from ftrace_record_ip Steven Rostedt
@ 2008-11-15 0:45 ` Steven Rostedt
2008-11-15 0:45 ` [PATCH 3/3] ftrace: do not process freed records Steven Rostedt
2 siblings, 0 replies; 17+ messages in thread
From: Steven Rostedt @ 2008-11-15 0:45 UTC (permalink / raw)
To: linux-kernel
Cc: Ingo Molnar, Andrew Morton, Frederic Weisbecker, Peter Zijlstra,
Steven Rostedt
[-- Attachment #1: 0002-ftrace-disable-ftrace-on-anomalies-in-trace-start-a.patch --]
[-- Type: text/plain, Size: 3180 bytes --]
Impact: robust feature to disable ftrace on start or stop tracing on error
Currently only the initial conversion to nops will disable ftrace
on an anomaly. But if an anomaly happens on start or stopping of the
tracer, it will silently fail.
This patch adds a check there too, to disable ftrace and warn if the
conversion fails.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
kernel/trace/ftrace.c | 81 ++++++++++++++++++++++++++----------------------
1 files changed, 44 insertions(+), 37 deletions(-)
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 66aa19e..4ef1331 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -349,6 +349,47 @@ ftrace_record_ip(unsigned long ip)
return rec;
}
+static void print_ip_ins(const char *fmt, unsigned char *p)
+{
+ int i;
+
+ printk(KERN_CONT "%s", fmt);
+
+ for (i = 0; i < MCOUNT_INSN_SIZE; i++)
+ printk(KERN_CONT "%s%02x", i ? ":" : "", p[i]);
+}
+
+static void ftrace_bug(int failed, unsigned long ip,
+ unsigned char *expected,
+ unsigned char *replace)
+{
+ switch (failed) {
+ case -EFAULT:
+ FTRACE_WARN_ON_ONCE(1);
+ pr_info("ftrace faulted on modifying ");
+ print_ip_sym(ip);
+ break;
+ case -EINVAL:
+ FTRACE_WARN_ON_ONCE(1);
+ pr_info("ftrace failed to modify ");
+ print_ip_sym(ip);
+ print_ip_ins(" expected: ", expected);
+ print_ip_ins(" actual: ", (unsigned char *)ip);
+ print_ip_ins(" replace: ", replace);
+ printk(KERN_CONT "\n");
+ break;
+ case -EPERM:
+ FTRACE_WARN_ON_ONCE(1);
+ pr_info("ftrace faulted on writing ");
+ print_ip_sym(ip);
+ break;
+ default:
+ FTRACE_WARN_ON_ONCE(1);
+ pr_info("ftrace faulted on unknown error ");
+ print_ip_sym(ip);
+ }
+}
+
#define FTRACE_ADDR ((long)(ftrace_caller))
static int
@@ -466,22 +507,13 @@ static void ftrace_replace_code(int enable)
if ((system_state == SYSTEM_BOOTING) ||
!core_kernel_text(rec->ip)) {
ftrace_free_rec(rec);
- }
+ } else
+ ftrace_bug(failed, rec->ip, old, new);
}
}
}
}
-static void print_ip_ins(const char *fmt, unsigned char *p)
-{
- int i;
-
- printk(KERN_CONT "%s", fmt);
-
- for (i = 0; i < MCOUNT_INSN_SIZE; i++)
- printk(KERN_CONT "%s%02x", i ? ":" : "", p[i]);
-}
-
static int
ftrace_code_disable(struct dyn_ftrace *rec)
{
@@ -496,32 +528,7 @@ ftrace_code_disable(struct dyn_ftrace *rec)
ret = ftrace_modify_code(ip, call, nop);
if (ret) {
- switch (ret) {
- case -EFAULT:
- FTRACE_WARN_ON_ONCE(1);
- pr_info("ftrace faulted on modifying ");
- print_ip_sym(ip);
- break;
- case -EINVAL:
- FTRACE_WARN_ON_ONCE(1);
- pr_info("ftrace failed to modify ");
- print_ip_sym(ip);
- print_ip_ins(" expected: ", call);
- print_ip_ins(" actual: ", (unsigned char *)ip);
- print_ip_ins(" replace: ", nop);
- printk(KERN_CONT "\n");
- break;
- case -EPERM:
- FTRACE_WARN_ON_ONCE(1);
- pr_info("ftrace faulted on writing ");
- print_ip_sym(ip);
- break;
- default:
- FTRACE_WARN_ON_ONCE(1);
- pr_info("ftrace faulted on unknown error ");
- print_ip_sym(ip);
- }
-
+ ftrace_bug(ret, ip, call, nop);
rec->flags |= FTRACE_FL_FAILED;
return 0;
}
--
1.5.6.5
--
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 3/3] ftrace: do not process freed records
2008-11-15 0:45 [PATCH 0/3] ftrace: updates for tip Steven Rostedt
2008-11-15 0:45 ` [PATCH 1/3] ftrace: remove condition from ftrace_record_ip Steven Rostedt
2008-11-15 0:45 ` [PATCH 2/3] ftrace: disable ftrace on anomalies in trace start and stop Steven Rostedt
@ 2008-11-15 0:45 ` Steven Rostedt
2 siblings, 0 replies; 17+ messages in thread
From: Steven Rostedt @ 2008-11-15 0:45 UTC (permalink / raw)
To: linux-kernel
Cc: Ingo Molnar, Andrew Morton, Frederic Weisbecker, Peter Zijlstra,
Steven Rostedt
[-- Attachment #1: 0003-ftrace-do-not-process-freed-records.patch --]
[-- Type: text/plain, Size: 1086 bytes --]
Impact: keep from converting freed records
When the tracer is started or stopped, it converts all code pointed
to by the saved records into callers to ftrace or nops. When modules
are unloaded, their records are freed, but they still exist within
the record pages.
This patch changes the code to skip over freed records.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
kernel/trace/ftrace.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 4ef1331..2e712a4 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -489,8 +489,12 @@ static void ftrace_replace_code(int enable)
for (i = 0; i < pg->index; i++) {
rec = &pg->records[i];
- /* don't modify code that has already faulted */
- if (rec->flags & FTRACE_FL_FAILED)
+ /*
+ * Skip over free records and records that have
+ * failed.
+ */
+ if (rec->flags & FTRACE_FL_FREE ||
+ rec->flags & FTRACE_FL_FAILED)
continue;
/* ignore updates to this record's mcount site */
--
1.5.6.5
--
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 0/3] ftrace: updates for tip
2009-02-05 6:13 [PATCH 0/3] ftrace: updates for tip Steven Rostedt
@ 2009-02-05 13:37 ` Ingo Molnar
0 siblings, 0 replies; 17+ messages in thread
From: Ingo Molnar @ 2009-02-05 13:37 UTC (permalink / raw)
To: Steven Rostedt
Cc: linux-kernel, Andrew Morton, Arnaldo Carvalho de Melo,
Frederic Weisbecker
* Steven Rostedt <rostedt@goodmis.org> wrote:
> Ingo,
>
> Arnaldo was nice enough to do something that was on my todo list
> for quite some time.
>
> I also included the change you asked for.
>
> The following patches are in:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
>
> branch: tip/devel
>
>
> Arnaldo Carvalho de Melo (2):
> trace_branch: Remove unused function
> trace: Remove unused trace_array_cpu parameter
>
> Steven Rostedt (1):
> trace: code style clean up
>
> ----
> block/blktrace.c | 2 +-
> kernel/trace/trace.c | 76 ++++++++++++++++---------------------
> kernel/trace/trace.h | 4 --
> kernel/trace/trace_branch.c | 17 --------
> kernel/trace/trace_functions.c | 8 ++--
> kernel/trace/trace_irqsoff.c | 10 ++--
> kernel/trace/trace_sched_switch.c | 4 +-
> kernel/trace/trace_sched_wakeup.c | 12 ++---
> 8 files changed, 50 insertions(+), 83 deletions(-)
Applied to tip:tracing/ftrace, thanks guys!
Ingo
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 0/3] ftrace: updates for tip
@ 2009-02-05 6:13 Steven Rostedt
2009-02-05 13:37 ` Ingo Molnar
0 siblings, 1 reply; 17+ messages in thread
From: Steven Rostedt @ 2009-02-05 6:13 UTC (permalink / raw)
To: linux-kernel
Cc: Ingo Molnar, Andrew Morton, Arnaldo Carvalho de Melo,
Frederic Weisbecker
Ingo,
Arnaldo was nice enough to do something that was on my todo list
for quite some time.
I also included the change you asked for.
The following patches are in:
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
branch: tip/devel
Arnaldo Carvalho de Melo (2):
trace_branch: Remove unused function
trace: Remove unused trace_array_cpu parameter
Steven Rostedt (1):
trace: code style clean up
----
block/blktrace.c | 2 +-
kernel/trace/trace.c | 76 ++++++++++++++++---------------------
kernel/trace/trace.h | 4 --
kernel/trace/trace_branch.c | 17 --------
kernel/trace/trace_functions.c | 8 ++--
kernel/trace/trace_irqsoff.c | 10 ++--
kernel/trace/trace_sched_switch.c | 4 +-
kernel/trace/trace_sched_wakeup.c | 12 ++---
8 files changed, 50 insertions(+), 83 deletions(-)
--
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 0/3] ftrace: updates for tip
@ 2009-02-03 2:38 Steven Rostedt
0 siblings, 0 replies; 17+ messages in thread
From: Steven Rostedt @ 2009-02-03 2:38 UTC (permalink / raw)
To: linux-kernel
Cc: Ingo Molnar, Andrew Morton, Peter Zijlstra, Frederic Weisbecker,
Arjan van de Ven
Ingo,
The first patch here is to disable the branch tracer on ALPHA.
There has been several reports that the branch tracer breaks the
compile on ALPHA. Alpha uses ifs extern inlines, and the injecting
of static elements breaks the build.
The next patch fixes the selecting of a tracer for bootup.
Now you can select the default tracer from the kernel command line.
i.e.
ftrace=function
Will start the function tracer as soon as it is registered.
Now that we have the kernel command line tracer selection working
we can use it for he boot "initcall" tracer. Instead of having the
initcall tracer disable selftests, it now needs to be selected
in the kernel command line as the default tracer to be implemented.
This means we can keep both selftest and boot initcall tracer configured
at the same time.
ftrace=initcall
Will now enable the boot initcall tracer. No need to recompile.
-- Steve
The following patches are in:
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
branch: tip/devel
Steven Rostedt (3):
trace: disable branch tracer on alpha
trace: fix default boot up tracer
trace: let boot trace be chosen by command line
----
kernel/trace/Kconfig | 9 +++---
kernel/trace/trace.c | 65 ++++++++++++++++++++++++++++++++++++++-------
kernel/trace/trace_boot.c | 11 +++++---
3 files changed, 67 insertions(+), 18 deletions(-)
--
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 0/3] ftrace: updates for tip
2008-12-24 4:24 Steven Rostedt
2008-12-24 23:13 ` Frederic Weisbecker
2008-12-24 23:24 ` Frederic Weisbecker
@ 2008-12-29 11:46 ` Ingo Molnar
2 siblings, 0 replies; 17+ messages in thread
From: Ingo Molnar @ 2008-12-29 11:46 UTC (permalink / raw)
To: Steven Rostedt
Cc: linux-kernel, Andrew Morton, Frederic Weisbecker, Pekka Paalanen
* Steven Rostedt <rostedt@goodmis.org> wrote:
> This series restructures the output functions of trace.c.
>
> Events are now registered and maintaining an event output is
> simplified by keeping the output close together.
>
> The following patches are in:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
>
> branch: tip/devel
>
>
> Steven Rostedt (3):
> ftrace: remove obsolete print continue functionality
> ftrace: set up trace event hash infrastructure
> ftrace: change trace.c to use registered events
pulled, thanks Steve!
Ingo
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 0/3] ftrace: updates for tip
2008-12-24 4:24 Steven Rostedt
2008-12-24 23:13 ` Frederic Weisbecker
@ 2008-12-24 23:24 ` Frederic Weisbecker
2008-12-29 11:46 ` Ingo Molnar
2 siblings, 0 replies; 17+ messages in thread
From: Frederic Weisbecker @ 2008-12-24 23:24 UTC (permalink / raw)
To: Steven Rostedt; +Cc: linux-kernel, Ingo Molnar, Andrew Morton, Pekka Paalanen
Steven Rostedt wrote:
> This series restructures the output functions of trace.c.
>
> Events are now registered and maintaining an event output is
> simplified by keeping the output close together.
>
> The following patches are in:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
>
> branch: tip/devel
BTW it seems to be more likely on devel than tip/devel ...
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 0/3] ftrace: updates for tip
2008-12-24 4:24 Steven Rostedt
@ 2008-12-24 23:13 ` Frederic Weisbecker
2008-12-24 23:24 ` Frederic Weisbecker
2008-12-29 11:46 ` Ingo Molnar
2 siblings, 0 replies; 17+ messages in thread
From: Frederic Weisbecker @ 2008-12-24 23:13 UTC (permalink / raw)
To: Steven Rostedt; +Cc: linux-kernel, Ingo Molnar, Andrew Morton, Pekka Paalanen
Steven Rostedt wrote:
> This series restructures the output functions of trace.c.
>
> Events are now registered and maintaining an event output is
> simplified by keeping the output close together.
>
> The following patches are in:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
>
> branch: tip/devel
>
>
> Steven Rostedt (3):
> ftrace: remove obsolete print continue functionality
> ftrace: set up trace event hash infrastructure
> ftrace: change trace.c to use registered events
>
Which does mean that a tracer will now be able to build as a module?
That's all good news!
I'm testing a bit these patches...
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 0/3] ftrace: updates for tip
@ 2008-12-24 4:24 Steven Rostedt
2008-12-24 23:13 ` Frederic Weisbecker
` (2 more replies)
0 siblings, 3 replies; 17+ messages in thread
From: Steven Rostedt @ 2008-12-24 4:24 UTC (permalink / raw)
To: linux-kernel
Cc: Ingo Molnar, Andrew Morton, Frederic Weisbecker, Pekka Paalanen
This series restructures the output functions of trace.c.
Events are now registered and maintaining an event output is
simplified by keeping the output close together.
The following patches are in:
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
branch: tip/devel
Steven Rostedt (3):
ftrace: remove obsolete print continue functionality
ftrace: set up trace event hash infrastructure
ftrace: change trace.c to use registered events
----
kernel/trace/Makefile | 1 +
kernel/trace/trace.c | 738 ++----------------------------
kernel/trace/trace.h | 15 +-
kernel/trace/trace_boot.c | 1 +
kernel/trace/trace_branch.c | 53 +++
kernel/trace/trace_functions_graph.c | 4 +-
kernel/trace/trace_hw_branches.c | 1 +
kernel/trace/trace_mmiotrace.c | 4 +-
kernel/trace/trace_output.c | 832 ++++++++++++++++++++++++++++++++++
kernel/trace/trace_output.h | 59 +++
kernel/trace/trace_power.c | 1 +
11 files changed, 990 insertions(+), 719 deletions(-)
--
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 0/3] ftrace: updates for tip
2008-12-04 8:35 ` Ingo Molnar
@ 2008-12-04 13:30 ` Steven Rostedt
0 siblings, 0 replies; 17+ messages in thread
From: Steven Rostedt @ 2008-12-04 13:30 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Andrew Morton, Frederic Weisbecker, Peter Zijlstra,
Arjan van de Ven, Dave Hansen, containers, Eric Biederman,
Sukadev Bhattiprolu, Serge E. Hallyn
On Thu, 4 Dec 2008, Ingo Molnar wrote:
>
> * Steven Rostedt <rostedt@goodmis.org> wrote:
>
> > Ingo,
> >
> > This series has three patches.
> >
> > The first patch adds a new feature that I've been wanting to have for
> > some time and Arjan even requested. That is to pick a function and only
> > trace that function and its children. Dynamic ftrace and function graph
> > needs to be enabled for this.
> >
> > To do the above, I added a "trace" flags field in the task structure.
> > The second patch uses this for the ftrace pid code. It searches for the
> > task based on the pid and sets the trace flag, then in the ftrace
> > function caller it only needs to check this flag.
>
> Btw., i'd love to see this done via the regular regexp interface though,
> if possible - instead of the add-on interface you added.
So would I. Unfortunately the regex is tightly coupled to turning on or
off the function. This needs all functions enabled because we do not
know which functions the flagged one will call.
I could reuse the regex code if I add a call back to handle what to do on
a match. This is a bit more work, and will take some time to do.
If someone else has the time to do it, I would offer suggestions and
review the code. Right now I do not have the time myself.
>
> ( Also perhaps enable to toggle tracing via the /proc/<PID>/ hierarchy -
> a /proc/<PID>/tracing_enabled switch or so. )
>
> Regarding the filter functions, the basic principle should be
> mathematical set operations, like we have it now: add and remove, union,
> wildcards, etc.
>
> I'd suggest a natural and intuitive extension of the current syntax.
> (while keeping all the current bits)
>
> I already suggested a 'inverse' filter in a previous mail:
>
> echo "-schedule*" >> set_ftrace_filter
Ah, I did not see the '>>' that might be easier to do. I think you first
suggested this with a "!sched*" > set_ftrace_filter where the '>' would
truncate. But doing it with append '>>', might work.
>
> This rule operates on the current set of filter functions: it strikes out
> all existing filter functions that match this pattern.
>
> To handle PIDs, we could do something like:
>
> echo "sshd-312:schedule" > set_ftrace_filter
>
> This would restrict tracing to the sshd-pid:312 task.
>
> Note: the PID portion of the filter rules still stay separate from the
> function names - we dont want per task function filter rules.
Yep, agreed, A function is traced if the following conditions are true:
- function tracing is enabled
- the function is set to trace (not in set_ftrace_notrace)
- the pid filter is on and the current task has its trace bit set
or the pid filter is off.
- the function filter is on and the function is in the trace array
or the function filter is off
>
> A natural variation would be:
>
> echo "312:schedule" > set_ftrace_filter
>
> to only specify the PID, or:
>
> echo "312,313:schedule" > set_ftrace_filter
>
> to specify two PIDs, or:
>
> echo "sshd:schedule" > set_ftrace_filter
>
> to only specify the 'comm' part, which expands to all PIDs where
> task->comm matches sshd. Another variation would be:
>
> echo "loop*:schedule" > set_ftrace_filter
>
> that matches all PIDs where task->comm matches loop*.
>
> To specify recursive tracing, we could use something like:
>
> echo "loop*+schedule" > set_ftrace_filter
>
> the '+' would signal that the 'schedule' function is 'expanded' and all
> its child functions are traced as well.
>
> btw., maybe it makes sense to separate the regexp rule-set from the set
> of functions that we are tracing right now. For example:
>
> $ echo "schedule*" > set_ftrace_filter
> $ echo "time*" >> set_ftrace_filter
> $ echo "sys_*" >> set_ftrace_filter
>
> $ cat set_ftrace_filter
> schedule*
> time*
> sys_*
>
> We'd also have a separate, current_ftrace_functions file as well which
> shows all traced functions. (on a global basis - with possible PID filter
> rules added where applicable)
>
> I know this will be hellishly hard to implement, but it would be _very_
> elegant, and _very_ usable.
>
> What do you think?
Hmm, that is starting to get quite complex, just to use. This is something
we need to experiment with to find the best solution. I'd like to know use
cases first. Currently I have a simple program that forks, traces itself
and execs code to trace. It is exectued like:
./trace-func ls -ltr
to trace "ls -lrt", this code would become a little more complex with the
above methods. But I'm not set in stone in any of these options. I just
do not want to spend the days coding this to find out no one uses any of
it but what is already there.
-- Steve
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 0/3] ftrace: updates for tip
2008-12-03 20:36 Steven Rostedt
2008-12-04 8:19 ` Ingo Molnar
@ 2008-12-04 8:35 ` Ingo Molnar
2008-12-04 13:30 ` Steven Rostedt
1 sibling, 1 reply; 17+ messages in thread
From: Ingo Molnar @ 2008-12-04 8:35 UTC (permalink / raw)
To: Steven Rostedt
Cc: linux-kernel, Andrew Morton, Frederic Weisbecker, Peter Zijlstra,
Arjan van de Ven, Dave Hansen, containers, Eric Biederman,
Sukadev Bhattiprolu, Serge E. Hallyn
* Steven Rostedt <rostedt@goodmis.org> wrote:
> Ingo,
>
> This series has three patches.
>
> The first patch adds a new feature that I've been wanting to have for
> some time and Arjan even requested. That is to pick a function and only
> trace that function and its children. Dynamic ftrace and function graph
> needs to be enabled for this.
>
> To do the above, I added a "trace" flags field in the task structure.
> The second patch uses this for the ftrace pid code. It searches for the
> task based on the pid and sets the trace flag, then in the ftrace
> function caller it only needs to check this flag.
Btw., i'd love to see this done via the regular regexp interface though,
if possible - instead of the add-on interface you added.
( Also perhaps enable to toggle tracing via the /proc/<PID>/ hierarchy -
a /proc/<PID>/tracing_enabled switch or so. )
Regarding the filter functions, the basic principle should be
mathematical set operations, like we have it now: add and remove, union,
wildcards, etc.
I'd suggest a natural and intuitive extension of the current syntax.
(while keeping all the current bits)
I already suggested a 'inverse' filter in a previous mail:
echo "-schedule*" >> set_ftrace_filter
This rule operates on the current set of filter functions: it strikes out
all existing filter functions that match this pattern.
To handle PIDs, we could do something like:
echo "sshd-312:schedule" > set_ftrace_filter
This would restrict tracing to the sshd-pid:312 task.
Note: the PID portion of the filter rules still stay separate from the
function names - we dont want per task function filter rules.
A natural variation would be:
echo "312:schedule" > set_ftrace_filter
to only specify the PID, or:
echo "312,313:schedule" > set_ftrace_filter
to specify two PIDs, or:
echo "sshd:schedule" > set_ftrace_filter
to only specify the 'comm' part, which expands to all PIDs where
task->comm matches sshd. Another variation would be:
echo "loop*:schedule" > set_ftrace_filter
that matches all PIDs where task->comm matches loop*.
To specify recursive tracing, we could use something like:
echo "loop*+schedule" > set_ftrace_filter
the '+' would signal that the 'schedule' function is 'expanded' and all
its child functions are traced as well.
btw., maybe it makes sense to separate the regexp rule-set from the set
of functions that we are tracing right now. For example:
$ echo "schedule*" > set_ftrace_filter
$ echo "time*" >> set_ftrace_filter
$ echo "sys_*" >> set_ftrace_filter
$ cat set_ftrace_filter
schedule*
time*
sys_*
We'd also have a separate, current_ftrace_functions file as well which
shows all traced functions. (on a global basis - with possible PID filter
rules added where applicable)
I know this will be hellishly hard to implement, but it would be _very_
elegant, and _very_ usable.
What do you think?
Ingo
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 0/3] ftrace: updates for tip
2008-12-03 20:36 Steven Rostedt
@ 2008-12-04 8:19 ` Ingo Molnar
2008-12-04 8:35 ` Ingo Molnar
1 sibling, 0 replies; 17+ messages in thread
From: Ingo Molnar @ 2008-12-04 8:19 UTC (permalink / raw)
To: Steven Rostedt
Cc: linux-kernel, Andrew Morton, Frederic Weisbecker, Peter Zijlstra,
Arjan van de Ven, Dave Hansen, containers, Eric Biederman,
Sukadev Bhattiprolu, Serge E. Hallyn
* Steven Rostedt <rostedt@goodmis.org> wrote:
> Ingo,
>
> This series has three patches.
>
> The first patch adds a new feature that I've been wanting to have for some
> time and Arjan even requested. That is to pick a function and only
> trace that function and its children. Dynamic ftrace and function
> graph needs to be enabled for this.
>
> To do the above, I added a "trace" flags field in the task structure.
> The second patch uses this for the ftrace pid code. It searches for
> the task based on the pid and sets the trace flag, then in the
> ftrace function caller it only needs to check this flag.
>
> This means we can now trace more than one pid without any more overhead.
> It also means that we should be able to use the name space code that
> the container guys want us to. But since I'm not very up on the
> namespace code, I'm still using just the normal 'pid'. I've Cc'd the
> container folks so perhaps they could write up a patch for me ;-)
>
> Note: When writing to the set_ftrace_pid two things happen.
> - The task with the matching pid gets the trace flag set.
> - Any other task has its trace flag cleared.
> #2 needs to be addressed when converting to pid name spaces.
> Just because it is not enough to simply find the matching task.
> It may be good enough to just clear all tasks and then find the
> one that matches.
>
> The last patch makes the function graph tracer honor the set_ftrace_pid.
>
> The following patches are in:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
>
> branch: tip/devel
>
>
> Steven Rostedt (3):
> ftrace: graph of a single function
> ftrace: use task struct trace flag to filter on pid
> ftrace: trace single pid for function graph tracer
>
> ----
> include/linux/ftrace.h | 46 +++++++++
> include/linux/sched.h | 4 +
> kernel/trace/ftrace.c | 257 +++++++++++++++++++++++++++++++++++++++++++++++-
> kernel/trace/trace.c | 11 ++
> kernel/trace/trace.h | 40 +++++++-
> 5 files changed, 353 insertions(+), 5 deletions(-)
> --
pulled, thanks Steve!
These are some very nice changes!
Ingo
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 0/3] ftrace: updates for tip
@ 2008-12-03 20:36 Steven Rostedt
2008-12-04 8:19 ` Ingo Molnar
2008-12-04 8:35 ` Ingo Molnar
0 siblings, 2 replies; 17+ messages in thread
From: Steven Rostedt @ 2008-12-03 20:36 UTC (permalink / raw)
To: linux-kernel
Cc: Ingo Molnar, Andrew Morton, Frederic Weisbecker, Peter Zijlstra,
Arjan van de Ven, Dave Hansen, containers, Eric Biederman,
Sukadev Bhattiprolu, Serge E. Hallyn
Ingo,
This series has three patches.
The first patch adds a new feature that I've been wanting to have for some
time and Arjan even requested. That is to pick a function and only
trace that function and its children. Dynamic ftrace and function
graph needs to be enabled for this.
To do the above, I added a "trace" flags field in the task structure.
The second patch uses this for the ftrace pid code. It searches for
the task based on the pid and sets the trace flag, then in the
ftrace function caller it only needs to check this flag.
This means we can now trace more than one pid without any more overhead.
It also means that we should be able to use the name space code that
the container guys want us to. But since I'm not very up on the
namespace code, I'm still using just the normal 'pid'. I've Cc'd the
container folks so perhaps they could write up a patch for me ;-)
Note: When writing to the set_ftrace_pid two things happen.
- The task with the matching pid gets the trace flag set.
- Any other task has its trace flag cleared.
#2 needs to be addressed when converting to pid name spaces.
Just because it is not enough to simply find the matching task.
It may be good enough to just clear all tasks and then find the
one that matches.
The last patch makes the function graph tracer honor the set_ftrace_pid.
The following patches are in:
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
branch: tip/devel
Steven Rostedt (3):
ftrace: graph of a single function
ftrace: use task struct trace flag to filter on pid
ftrace: trace single pid for function graph tracer
----
include/linux/ftrace.h | 46 +++++++++
include/linux/sched.h | 4 +
kernel/trace/ftrace.c | 257 +++++++++++++++++++++++++++++++++++++++++++++++-
kernel/trace/trace.c | 11 ++
kernel/trace/trace.h | 40 +++++++-
5 files changed, 353 insertions(+), 5 deletions(-)
--
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 0/3] ftrace updates for tip
2008-11-12 22:52 [PATCH 0/3] ftrace " Steven Rostedt
@ 2008-11-13 8:50 ` Ingo Molnar
0 siblings, 0 replies; 17+ messages in thread
From: Ingo Molnar @ 2008-11-13 8:50 UTC (permalink / raw)
To: Steven Rostedt
Cc: linux-kernel, Andrew Morton, Thomas Gleixner, Peter Zijlstra,
David Miller, Frederic Weisbecker, Arjan van de Ven,
Pekka Paalanen
* Steven Rostedt <rostedt@goodmis.org> wrote:
> [
> I added a bit more people to the Cc so that they are aware
> of the pending renames that are coming.
>
> Namely, trace_entries will be renamed to buffer_size
> iter_ctrl will be renamed to trace_options
> ]
>
> Ingo,
>
> The following patches are in:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
>
> branch: tip/devel
>
>
> Steven Rostedt (3):
> ftrace: rename trace_entries to buffer_size
> ftrace: rename iter_ctrl to trace_options
> ftrace: CPU buffer start annotation clean ups
i've applied them to tip/tracing/ftrace, with some small changes:
12ef7d4: ftrace: CPU buffer start annotation clean ups
ee6bce5: ftrace: rename iter_ctrl to trace_options
1696b2b: ftrace: show buffer size in kilobytes
a94c80e: ftrace: rename trace_entries to buffer_size_kb
as per Arjan's suggestion i changed buffer_size to buffer_size_kb -
and also removed the kilobytes string from its output.
thanks Steve!
Ingo
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 0/3] ftrace updates for tip
@ 2008-11-12 22:52 Steven Rostedt
2008-11-13 8:50 ` Ingo Molnar
0 siblings, 1 reply; 17+ messages in thread
From: Steven Rostedt @ 2008-11-12 22:52 UTC (permalink / raw)
To: linux-kernel
Cc: Ingo Molnar, Andrew Morton, Thomas Gleixner, Peter Zijlstra,
David Miller, Frederic Weisbecker, Arjan van de Ven,
Pekka Paalanen
[
I added a bit more people to the Cc so that they are aware
of the pending renames that are coming.
Namely, trace_entries will be renamed to buffer_size
iter_ctrl will be renamed to trace_options
]
Ingo,
The following patches are in:
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
branch: tip/devel
Steven Rostedt (3):
ftrace: rename trace_entries to buffer_size
ftrace: rename iter_ctrl to trace_options
ftrace: CPU buffer start annotation clean ups
----
Documentation/ftrace.txt | 32 ++++++++++++++++----------------
kernel/trace/trace.c | 38 ++++++++++++++++++++++++++------------
kernel/trace/trace.h | 1 +
3 files changed, 43 insertions(+), 28 deletions(-)
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2009-02-05 13:37 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-15 0:45 [PATCH 0/3] ftrace: updates for tip Steven Rostedt
2008-11-15 0:45 ` [PATCH 1/3] ftrace: remove condition from ftrace_record_ip Steven Rostedt
2008-11-15 0:45 ` [PATCH 2/3] ftrace: disable ftrace on anomalies in trace start and stop Steven Rostedt
2008-11-15 0:45 ` [PATCH 3/3] ftrace: do not process freed records Steven Rostedt
-- strict thread matches above, loose matches on Subject: below --
2009-02-05 6:13 [PATCH 0/3] ftrace: updates for tip Steven Rostedt
2009-02-05 13:37 ` Ingo Molnar
2009-02-03 2:38 Steven Rostedt
2008-12-24 4:24 Steven Rostedt
2008-12-24 23:13 ` Frederic Weisbecker
2008-12-24 23:24 ` Frederic Weisbecker
2008-12-29 11:46 ` Ingo Molnar
2008-12-03 20:36 Steven Rostedt
2008-12-04 8:19 ` Ingo Molnar
2008-12-04 8:35 ` Ingo Molnar
2008-12-04 13:30 ` Steven Rostedt
2008-11-12 22:52 [PATCH 0/3] ftrace " Steven Rostedt
2008-11-13 8:50 ` Ingo Molnar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®