From: Frederic Weisbecker <fweisbec@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@elte.hu>,
linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Chris Mason <chris.mason@oracle.com>
Subject: Re: [PATCH 0/2] ftrace: updates to tip
Date: Sat, 17 Jan 2009 14:48:30 +0100 [thread overview]
Message-ID: <20090117134829.GB8413@nowhere> (raw)
In-Reply-To: <alpine.DEB.1.10.0901162003000.9232@gandalf.stny.rr.com>
On Fri, Jan 16, 2009 at 08:14:25PM -0500, Steven Rostedt wrote:
>
> On Fri, 16 Jan 2009, Ingo Molnar wrote:
>
> >
> > * Ingo Molnar <mingo@elte.hu> wrote:
> >
> > > > I was afraid you would say that :-)
> > > >
> > > > Yes, we could add something to do this. It would take some thought on
> > > > a good api, and implementation. This is not an easy task by any means.
> > > > We need a way to map between a function call and a tracer, where a
> > > > function call can call more than one tracer.
> > >
> > > Note that some other things could be consolidated under per function
> > > metadata: for example set_graph_function - which really is a per
> > > function attribute too. Plus a lot of new things would be enabled i
> > > think.
> >
> > a few other things that could be per-function attributes:
> >
> > - Using function trace 'limits': trace a function 50 times and dont trace
> > it afterwards. Each invocation of that function decreases the
> > remaining-count by one. For example:
> >
> > echo 'btrfs_join_transaction:#2' >> set_ftrace_filter
> >
> > Would specify that we generate two trace entries of
> > btrfs_join_transaction(), then stop tracing this function.
> >
> > - Using function-triggered tracing: a function could be specified (via a
> > filter format extension) to act as a 'start tracing' trigger. Another
> > extension would be 'stop tracing' trigger.
> >
> > For example:
> >
> > echo 'btrfs_join_transaction:+' >> set_ftrace_filter
> > echo 'btrfs_commit_transaction:-' >> set_ftrace_filter
> >
> > The '+' is a start-tracing trigger condition, the '-' is a stop-tracing
> > trigger condition. All function calls between btrfs_join_transaction()
> > and btrfs_commit_transaction() would be traced.
> >
> > The two could be combined - to generate the trace of a single btrfs
> > transaction, one could do:
> >
> > echo 0 > tracing_enabled
> > echo 'btrfs_join_transaction:+#1' >> set_ftrace_filter
> > echo 'btrfs_commit_transaction:-#1' >> set_ftrace_filter
> > echo 1 > tracing_enabled
> >
> > Other extensions are possible too:
> >
> > - Trace length triggers. For example one could do:
> >
> > echo 'btrfs_join_transaction:+*#10' >> set_ftrace_filter
> >
> > To trace 10 function calls [allowed by current filter settings] after
> > the first btrfs_join_transaction() call - and stop tracing after those
> > 10 trace entries.
> >
> > This would allow the creation of "surgical" one-time traces - of events
> > and functions one is specifically interested in.
>
> This all sounds great, but it would add a lot of conditionals into a
> extremely hot function tracer path. Remember, we are not modifying the
> calls to mcount to call a registered function directly. All functions
> being traced must call the same function. The reason is that mcount is not
> a normal function in C. It does not behave the same as other functions,
> and must be implemented in assembly (as you already know ;-) The dynamic
> tracer calls into a trampoline that calls the registered function. There
> is only one trampoline, so only one function gets called on a trace. We
> can at most enable or disable a given function. We can not change what
> that function calls (without implementing it for every arch).
>
> This means any conditional that you make, must be made for all traced
> functions. And this will put an overhead onto the system.
>
> Now we can register multiple functions to be called by a traced function,
> or pick and choose what function will be called by a traced function
> depending on what option was asked for. But all traced functions will
> still call the same code.
We could use a kind of ftrace_filter thing which would be a list of callbacks
to call, depending of the options set.
This would add one condition to verify for each function in the best case.
> We can start experimenting, but I would
> be more keen on how this will be used by developers. Chris gave a great
> example of how he would use his feature. Doing what you ask would require
> a rewrite of most the code. I hate to do that and have only 2 or 3 people
> using it :-/
>
> -- Steve
>
next prev parent reply other threads:[~2009-01-17 13:48 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-16 0:40 [PATCH 0/2] ftrace: updates to tip Steven Rostedt
2009-01-16 0:40 ` [PATCH 1/2] ftrace: fix trace_output Steven Rostedt
2009-01-16 1:40 ` Andrew Morton
2009-01-16 1:46 ` Steven Rostedt
2009-01-16 0:40 ` [PATCH 2/2] ftrace: add stack trace to function tracer Steven Rostedt
2009-01-16 0:48 ` Steven Rostedt
2009-01-16 10:08 ` Frédéric Weisbecker
2009-01-16 14:28 ` Steven Rostedt
2009-01-16 11:19 ` Ingo Molnar
2009-01-16 11:23 ` [PATCH 0/2] ftrace: updates to tip Ingo Molnar
2009-01-16 13:08 ` Frédéric Weisbecker
2009-01-16 13:10 ` Ingo Molnar
2009-01-16 14:32 ` Steven Rostedt
2009-01-16 15:21 ` Ingo Molnar
2009-01-16 15:53 ` Steven Rostedt
2009-01-16 16:02 ` Ingo Molnar
2009-01-16 16:03 ` Ingo Molnar
2009-01-16 16:22 ` Steven Rostedt
2009-01-16 16:30 ` Ingo Molnar
2009-01-16 22:59 ` Ingo Molnar
2009-01-17 1:14 ` Steven Rostedt
2009-01-17 13:48 ` Frederic Weisbecker [this message]
2009-01-17 22:34 ` Ingo Molnar
2009-01-18 7:27 ` Ingo Molnar
2009-01-16 21:47 ` Chris Mason
2009-01-16 22:26 ` Ingo Molnar
2009-01-17 1:30 ` Chris Mason
2009-01-17 2:38 ` Arnaldo Carvalho de Melo
2009-01-19 13:31 ` Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090117134829.GB8413@nowhere \
--to=fweisbec@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=chris.mason@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox