Commit b3fdd1f9 authored by Changbin Du's avatar Changbin Du Committed by Jonathan Corbet

trace doc: add ftrace-uses.rst to doc tree

Add ftrace-uses.rst into Sphinx TOC tree. Few format issues are fixed.

Cc: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: default avatarChangbin Du <changbin.du@intel.com>
Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
parent fcdeddc9
...@@ -21,13 +21,14 @@ how to use ftrace to implement your own function callbacks. ...@@ -21,13 +21,14 @@ how to use ftrace to implement your own function callbacks.
The ftrace context The ftrace context
================== ==================
.. warning::
WARNING: The ability to add a callback to almost any function within the The ability to add a callback to almost any function within the
kernel comes with risks. A callback can be called from any context kernel comes with risks. A callback can be called from any context
(normal, softirq, irq, and NMI). Callbacks can also be called just before (normal, softirq, irq, and NMI). Callbacks can also be called just before
going to idle, during CPU bring up and takedown, or going to user space. going to idle, during CPU bring up and takedown, or going to user space.
This requires extra care to what can be done inside a callback. A callback This requires extra care to what can be done inside a callback. A callback
can be called outside the protective scope of RCU. can be called outside the protective scope of RCU.
The ftrace infrastructure has some protections agains recursions and RCU The ftrace infrastructure has some protections agains recursions and RCU
but one must still be very careful how they use the callbacks. but one must still be very careful how they use the callbacks.
...@@ -54,15 +55,15 @@ an ftrace_ops with ftrace: ...@@ -54,15 +55,15 @@ an ftrace_ops with ftrace:
Both .flags and .private are optional. Only .func is required. Both .flags and .private are optional. Only .func is required.
To enable tracing call:: To enable tracing call:
.. c:function:: register_ftrace_function(&ops); .. c:function:: register_ftrace_function(&ops);
To disable tracing call:: To disable tracing call:
.. c:function:: unregister_ftrace_function(&ops); .. c:function:: unregister_ftrace_function(&ops);
The above is defined by including the header:: The above is defined by including the header:
.. c:function:: #include <linux/ftrace.h> .. c:function:: #include <linux/ftrace.h>
...@@ -200,7 +201,7 @@ match a specific pattern. ...@@ -200,7 +201,7 @@ match a specific pattern.
See Filter Commands in :file:`Documentation/trace/ftrace.txt`. See Filter Commands in :file:`Documentation/trace/ftrace.txt`.
To just trace the schedule function:: To just trace the schedule function:
.. code-block:: c .. code-block:: c
...@@ -210,7 +211,7 @@ To add more functions, call the ftrace_set_filter() more than once with the ...@@ -210,7 +211,7 @@ To add more functions, call the ftrace_set_filter() more than once with the
@reset parameter set to zero. To remove the current filter set and replace it @reset parameter set to zero. To remove the current filter set and replace it
with new functions defined by @buf, have @reset be non-zero. with new functions defined by @buf, have @reset be non-zero.
To remove all the filtered functions and trace all functions:: To remove all the filtered functions and trace all functions:
.. code-block:: c .. code-block:: c
......
...@@ -6,3 +6,4 @@ Linux Tracing Technologies ...@@ -6,3 +6,4 @@ Linux Tracing Technologies
:maxdepth: 2 :maxdepth: 2
ftrace-design ftrace-design
ftrace-uses
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment