mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-28 01:21:58 +00:00
Documentation: Update ftrace-design.txt
Correct grammos. Spell out words. Add missing words. Consistent use of "mcount()" function name. Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Acked-by: Steven Rostedt <rostedt@goodmis.org> LKML-Reference: <4B2C0D78.6060707@oracle.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
b41df645c8
commit
7e25f44cbf
1 changed files with 7 additions and 7 deletions
|
@ -53,14 +53,14 @@ size of the mcount call that is embedded in the function).
|
||||||
For example, if the function foo() calls bar(), when the bar() function calls
|
For example, if the function foo() calls bar(), when the bar() function calls
|
||||||
mcount(), the arguments mcount() will pass to the tracer are:
|
mcount(), the arguments mcount() will pass to the tracer are:
|
||||||
"frompc" - the address bar() will use to return to foo()
|
"frompc" - the address bar() will use to return to foo()
|
||||||
"selfpc" - the address bar() (with _mcount() size adjustment)
|
"selfpc" - the address bar() (with mcount() size adjustment)
|
||||||
|
|
||||||
Also keep in mind that this mcount function will be called *a lot*, so
|
Also keep in mind that this mcount function will be called *a lot*, so
|
||||||
optimizing for the default case of no tracer will help the smooth running of
|
optimizing for the default case of no tracer will help the smooth running of
|
||||||
your system when tracing is disabled. So the start of the mcount function is
|
your system when tracing is disabled. So the start of the mcount function is
|
||||||
typically the bare min with checking things before returning. That also means
|
typically the bare minimum with checking things before returning. That also
|
||||||
the code flow should usually kept linear (i.e. no branching in the nop case).
|
means the code flow should usually be kept linear (i.e. no branching in the nop
|
||||||
This is of course an optimization and not a hard requirement.
|
case). This is of course an optimization and not a hard requirement.
|
||||||
|
|
||||||
Here is some pseudo code that should help (these functions should actually be
|
Here is some pseudo code that should help (these functions should actually be
|
||||||
implemented in assembly):
|
implemented in assembly):
|
||||||
|
@ -131,10 +131,10 @@ some functions to save (hijack) and restore the return address.
|
||||||
|
|
||||||
The mcount function should check the function pointers ftrace_graph_return
|
The mcount function should check the function pointers ftrace_graph_return
|
||||||
(compare to ftrace_stub) and ftrace_graph_entry (compare to
|
(compare to ftrace_stub) and ftrace_graph_entry (compare to
|
||||||
ftrace_graph_entry_stub). If either of those are not set to the relevant stub
|
ftrace_graph_entry_stub). If either of those is not set to the relevant stub
|
||||||
function, call the arch-specific function ftrace_graph_caller which in turn
|
function, call the arch-specific function ftrace_graph_caller which in turn
|
||||||
calls the arch-specific function prepare_ftrace_return. Neither of these
|
calls the arch-specific function prepare_ftrace_return. Neither of these
|
||||||
function names are strictly required, but you should use them anyways to stay
|
function names is strictly required, but you should use them anyway to stay
|
||||||
consistent across the architecture ports -- easier to compare & contrast
|
consistent across the architecture ports -- easier to compare & contrast
|
||||||
things.
|
things.
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ but the first argument should be a pointer to the "frompc". Typically this is
|
||||||
located on the stack. This allows the function to hijack the return address
|
located on the stack. This allows the function to hijack the return address
|
||||||
temporarily to have it point to the arch-specific function return_to_handler.
|
temporarily to have it point to the arch-specific function return_to_handler.
|
||||||
That function will simply call the common ftrace_return_to_handler function and
|
That function will simply call the common ftrace_return_to_handler function and
|
||||||
that will return the original return address with which, you can return to the
|
that will return the original return address with which you can return to the
|
||||||
original call site.
|
original call site.
|
||||||
|
|
||||||
Here is the updated mcount pseudo code:
|
Here is the updated mcount pseudo code:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue