22 Dec, 2018

1 commit

  • The function ftrace_graph_get_ret_stack() takes a task struct descriptor but
    uses current as the task to perform the operations on. In pretty much all
    cases the task decriptor is the same as current, so this wasn't an issue.
    But there is a case in the ARM architecture that passes in a task that is
    not current, and expects a result from that task, and this code breaks it.

    Fixes: 51584396cff5 ("arm64: Use ftrace_graph_get_ret_stack() instead of curr_ret_stack")
    Reported-by: James Morse
    Tested-by: James Morse
    Signed-off-by: Steven Rostedt (VMware)

    Steven Rostedt (VMware)
     

11 Dec, 2018

1 commit

  • The ret_stack should not be accessed directly via the curr_ret_stack
    variable on the task_struct. This is because the ret_stack is going to be
    converted into a series of longs and not an array of ret_stack structures.
    The way that a ret_stack should be retrieved is via the
    ftrace_graph_get_ret_stack structure, but it needs to be documented on how
    to use it.

    Signed-off-by: Steven Rostedt (VMware)

    Steven Rostedt (VMware)
     

09 Dec, 2018

5 commits

  • The ret_stack processing is going to change, and that is going
    to break anything that is accessing the ret_stack directly. One user is the
    function graph profiler. By using the ftrace_graph_get_ret_stack() helper
    function, the profiler can access the ret_stack entry without relying on the
    implementation details of the stack itself.

    Reviewed-by: Joel Fernandes (Google)
    Signed-off-by: Steven Rostedt (VMware)

    Steven Rostedt (VMware)
     
  • Move the function function_graph_ret_addr() to fgraph.c, as the management
    of the curr_ret_stack is going to change, and all the accesses to ret_stack
    needs to be done in fgraph.c.

    Reviewed-by: Joel Fernandes (Google)
    Signed-off-by: Steven Rostedt (VMware)

    Steven Rostedt (VMware)
     
  • Currently the registering of function graph is to pass in a entry and return
    function. We need to have a way to associate those functions together where
    the entry can determine to run the return hook. Having a structure that
    contains both functions will facilitate the process of converting the code
    to be able to do such.

    This is similar to the way function hooks are enabled (it passes in
    ftrace_ops). Instead of passing in the functions to use, a single structure
    is passed in to the registering function.

    The unregister function is now passed in the fgraph_ops handle. When we
    allow more than one callback to the function graph hooks, this will let the
    system know which one to remove.

    Reviewed-by: Joel Fernandes (Google)
    Signed-off-by: Steven Rostedt (VMware)

    Steven Rostedt (VMware)
     
  • To make the function graph infrastructure more managable, the code needs to
    be in its own file (fgraph.c). Move the code that is specific for managing
    the function graph infrastructure out of ftrace.c and into fgraph.c

    Reviewed-by: Joel Fernandes (Google)
    Signed-off-by: Steven Rostedt (VMware)

    Steven Rostedt (VMware)
     
  • The curr_ret_stack is no longer set to a negative value when a function is
    not to be traced by the function graph tracer. Remove the usage of
    FTRACE_NOTRACE_DEPTH, as it is no longer needed.

    Reviewed-by: Joel Fernandes (Google)
    Signed-off-by: Steven Rostedt (VMware)

    Steven Rostedt (VMware)
     

30 Nov, 2018

2 commits

  • In order to make the function graph infrastructure more generic, there can
    not be code specific for the function_graph tracer in the generic code. This
    includes the set_graph_notrace logic, that stops all graph calls when a
    function in the set_graph_notrace is hit.

    By using the trace_recursion mask, we can use a bit in the current
    task_struct to implement the notrace code, and move the logic out of
    fgraph.c and into trace_functions_graph.c and keeps it affecting only the
    tracer and not all call graph callbacks.

    Acked-by: Namhyung Kim
    Reviewed-by: Joel Fernandes (Google)
    Signed-off-by: Steven Rostedt (VMware)

    Steven Rostedt (VMware)
     
  • As the function graph infrastructure can be used by thing other than
    tracing, moving the code to its own file out of the trace_functions_graph.c
    code makes more sense.

    The fgraph.c file will only contain the infrastructure required to hook into
    functions and their return code.

    Reviewed-by: Joel Fernandes (Google)
    Signed-off-by: Steven Rostedt (VMware)

    Steven Rostedt (VMware)