<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/trace/ftrace.c, branch v3.18</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v3.18</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v3.18'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2014-10-24T20:53:11Z</updated>
<entry>
<title>ftrace: Fix checking of trampoline ftrace_ops in finding trampoline</title>
<updated>2014-10-24T20:53:11Z</updated>
<author>
<name>Steven Rostedt (Red Hat)</name>
<email>rostedt@goodmis.org</email>
</author>
<published>2014-10-24T18:48:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=4fc409048d5afb1ad853f294b4262ecf2c980a49'/>
<id>urn:sha1:4fc409048d5afb1ad853f294b4262ecf2c980a49</id>
<content type='text'>
When modifying code, ftrace has several checks to make sure things
are being done correctly. One of them is to make sure any code it
modifies is exactly what it expects it to be before it modifies it.
In order to do so with the new trampoline logic, it must be able
to find out what trampoline a function is hooked to in order to
see if the code that hooks to it is what's expected.

The logic to find the trampoline from a record (accounting descriptor
for a function that is hooked) needs to only look at the "old_hash"
of an ops that is being modified. The old_hash is the list of function
an ops is hooked to before its update. Since a record would only be
pointing to an ops that is being modified if it was already hooked
before.

Currently, it can pick a modified ops based on its new functions it
will be hooked to, and this picks the wrong trampoline and causes
the check to fail, disabling ftrace.

Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;

ftrace: squash into ordering of ops for modification
</content>
</entry>
<entry>
<title>ftrace: Set ops-&gt;old_hash on modifying what an ops hooks to</title>
<updated>2014-10-24T20:33:36Z</updated>
<author>
<name>Steven Rostedt (Red Hat)</name>
<email>rostedt@goodmis.org</email>
</author>
<published>2014-10-24T18:56:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8252ecf346474cfe46315bd0a7ca655c293c34a9'/>
<id>urn:sha1:8252ecf346474cfe46315bd0a7ca655c293c34a9</id>
<content type='text'>
The code that checks for trampolines when modifying function hooks
tests against a modified ops "old_hash". But the ops old_hash pointer
is not being updated before the changes are made, making it possible
to not find the right hash to the callback and possibly causing
ftrace to break in accounting and disable itself.

Have the ops set its old_hash before the modifying takes place.

Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>ftrace: Add sanity check when unregistering last ftrace_ops</title>
<updated>2014-09-13T00:48:43Z</updated>
<author>
<name>Steven Rostedt (Red Hat)</name>
<email>rostedt@goodmis.org</email>
</author>
<published>2014-09-12T18:21:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=84bde62ca4b49701190dbd953c1e04024860c1f5'/>
<id>urn:sha1:84bde62ca4b49701190dbd953c1e04024860c1f5</id>
<content type='text'>
When the last ftrace_ops is unregistered, all the function records should
have a zeroed flags value. Make sure that is the case when the last ftrace_ops
is unregistered.

Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>ftrace: Replace tramp_hash with old_*_hash to save space</title>
<updated>2014-09-10T14:48:45Z</updated>
<author>
<name>Steven Rostedt (Red Hat)</name>
<email>rostedt@goodmis.org</email>
</author>
<published>2014-07-24T16:25:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=fef5aeeee9e3717e7aea991a7ae9ff6a7a2d4c85'/>
<id>urn:sha1:fef5aeeee9e3717e7aea991a7ae9ff6a7a2d4c85</id>
<content type='text'>
Allowing function callbacks to declare their own trampolines requires
that each ftrace_ops that has a trampoline must have some sort of
accounting that keeps track of which ops has a trampoline attached
to a record.

The easy way to solve this was to add a "tramp_hash" that created a
hash entry for every function that a ops uses with a trampoline.
But since we can have literally tens of thousands of functions being
traced, that means we need tens of thousands of descriptors to map
the ops to the function in the hash. This is quite expensive and
can cause enabling and disabling the function graph tracer to take
some time to start and stop. It can take up to several seconds to
disable or enable all functions in the function graph tracer for this
reason.

The better approach albeit more complex, is to keep track of how ops
are being enabled and disabled, and use that along with the counting
of the number of ops attached to records, to determive what ops has
a trampoline attached to a record at enabling and disabling of
tracing.

To do this, the tramp_hash has been replaced with an old_filter_hash
and old_notrace_hash, which get the copy of the ops filter_hash and
notrace_hash respectively. The old hashes is kept until the ops has
been modified or removed and the old hashes are used with the logic
of the accounting to determine the ops that have the trampoline of
a record. The reason this has less of a footprint is due to the trick
that an "empty" hash in the filter_hash means "all functions" and
an empty hash in the notrace hash means "no functions" in the hash.

This is much more efficienct, doesn't have the delay, and takes up
much less memory, as we do not need to map all the functions but
just figure out which functions are mapped at the time it is
enabled or disabled.

Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>ftrace: Annotate the ops operation on update</title>
<updated>2014-09-10T14:48:44Z</updated>
<author>
<name>Steven Rostedt (Red Hat)</name>
<email>rostedt@goodmis.org</email>
</author>
<published>2014-08-05T21:19:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e1effa0144a1ddf5b456c388ffaf784f3c5163fd'/>
<id>urn:sha1:e1effa0144a1ddf5b456c388ffaf784f3c5163fd</id>
<content type='text'>
Add three new flags for ftrace_ops:

  FTRACE_OPS_FL_ADDING
  FTRACE_OPS_FL_REMOVING
  FTRACE_OPS_FL_MODIFYING

These will be set for the ftrace_ops when they are first added
to the function tracing, being removed from function tracing
or just having their functions changed from function tracing,
respectively.

This will be needed to remove the tramp_hash, which can grow quite
big. The tramp_hash is used to note what functions a ftrace_ops
is using a trampoline for. Denoting which ftrace_ops is being
modified, will allow us to use the ftrace_ops hashes themselves,
which are much smaller as they have a global flag to denote if
a ftrace_ops is tracing all functions, as well as a notrace hash
if the ftrace_ops is tracing all but a few. The tramp_hash just
creates a hash item for every function, which can go into the 10s
of thousands if all functions are using the ftrace_ops trampoline.

Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>ftrace: Grab any ops for a rec for enabled_functions output</title>
<updated>2014-09-10T14:48:43Z</updated>
<author>
<name>Steven Rostedt (Red Hat)</name>
<email>rostedt@goodmis.org</email>
</author>
<published>2014-07-24T20:00:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5fecaa044af3dc52e4bc138842bdf1c6676105b1'/>
<id>urn:sha1:5fecaa044af3dc52e4bc138842bdf1c6676105b1</id>
<content type='text'>
When dumping the enabled_functions, use the first op that is
found with a trampoline to the record, as there should only be
one, as only one ops can be registered to a function that has
a trampoline.

Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>ftrace: Remove freeing of old_hash from ftrace_hash_move()</title>
<updated>2014-09-10T14:48:42Z</updated>
<author>
<name>Steven Rostedt (Red Hat)</name>
<email>rostedt@goodmis.org</email>
</author>
<published>2014-07-24T19:33:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3296fc4e2509fa8870923ed52e7990040b151847'/>
<id>urn:sha1:3296fc4e2509fa8870923ed52e7990040b151847</id>
<content type='text'>
ftrace_hash_move() currently frees the old hash that is passed to it
after replacing the pointer with the new hash. Instead of having the
function do that chore, have the caller perform the free.

This lets the ftrace_hash_move() be used a bit more freely, which
is needed for changing the way the trampoline logic is done.

Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>ftrace: Set callback to ftrace_stub when no ops are registered</title>
<updated>2014-09-10T14:48:18Z</updated>
<author>
<name>Steven Rostedt (Red Hat)</name>
<email>rostedt@goodmis.org</email>
</author>
<published>2014-09-10T14:42:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f7aad4e1a8221210db7eb434349cc6fe87aeee8c'/>
<id>urn:sha1:f7aad4e1a8221210db7eb434349cc6fe87aeee8c</id>
<content type='text'>
The clean up that adds the helper function ftrace_ops_get_func()
caused the default function to not change when DYNAMIC_FTRACE was not
set and no ftrace_ops were registered. Although static tracing is
not very useful (not having DYNAMIC_FTRACE set), it is still supported
and we don't want to break it.

Clean up the if statement even more to specifically have the default
function call ftrace_stub when no ftrace_ops are registered. This
fixes the small bug for static tracing as well as makes the code a
bit more understandable.

Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>ftrace: Add helper function ftrace_ops_get_func()</title>
<updated>2014-09-09T23:26:06Z</updated>
<author>
<name>Steven Rostedt (Red Hat)</name>
<email>rostedt@goodmis.org</email>
</author>
<published>2014-07-23T00:41:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=87354059881ce9315181604dc17076c535f4d744'/>
<id>urn:sha1:87354059881ce9315181604dc17076c535f4d744</id>
<content type='text'>
Add the helper function to what the mcount trampoline is to call
for a ftrace_ops function. This helper will be used by arch code
in the future to set up dynamic trampolines. But as this does the
same tests that are performed in choosing what function to call for
the default mcount trampoline, might as well use it to clean up
the existing code.

Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>ftrace: Add separate function for non recursive callbacks</title>
<updated>2014-09-09T14:26:48Z</updated>
<author>
<name>Steven Rostedt (Red Hat)</name>
<email>rostedt@goodmis.org</email>
</author>
<published>2014-07-23T00:16:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f1ff6348b30b3658d138f05643149706f99078ae'/>
<id>urn:sha1:f1ff6348b30b3658d138f05643149706f99078ae</id>
<content type='text'>
Instead of using the generic list function for callbacks that
are not recursive, call a new helper function from the mcount
trampoline called ftrace_ops_recur_func() that will do the recursion
checking for the callback.

This eliminates an indirection as well as will help in future code
that will use dynamically allocated trampolines.

Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</content>
</entry>
</feed>
