lkml.org 
[lkml]   [2010]   [Jan]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [RFC PATCH 02/10] ftrace: Ensure tracing has really stopped before leaving unregister_ftrace_graph
    From
    Date
    On Fri, 2010-01-22 at 02:16 +0100, Frederic Weisbecker wrote:
    > When we run under dynamic tracing, we know that after calling
    > unregister_ftrace_graph(), tracing has really stopped because of
    > the hot patching and use of stop_machine().

    This is incorrect. Even after unregister_ftrace_graph() with
    stop_machine(), we still have no guarantee that a call back is not being
    called. This is the reason I use sub tracing instead of NULLs. The call
    to the trace function could have been loaded in a register and then
    preempted. Even after stop_machine() that trace function can be called.
    This is also the reason that I never let modules add hooks to the
    function tracer (although I can easily make a wrapper to do so).

    >
    > But in static tracing case, we only set stub callbacks. This is
    > not sufficient on archs that have weak memory ordering to assume
    > the older callbacks won't be called right after we leave
    > unregister_ftrace_graph().
    >
    > Insert a read/write memory barrier in the end of
    > unregister_ftrace_graph() so that the code that follow can safely
    > assume tracing has really stopped. This can avoid its older tracing
    > callbacks to perform checks about various states like ensuring
    > needed buffers have been allocated, etc...

    There's no guarantee, even with a smp_mb() that a trace function will
    not be called after being unregistered.

    -- Steve





    \
     
     \ /
      Last update: 2010-01-22 02:53    [W:4.373 / U:0.716 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site