lkml.org 
[lkml]   [2011]   [Nov]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH 4/9] ftrace: Add enable/disable ftrace_ops control interface
    From
    Date

    >
    > @@ -311,6 +321,9 @@ static int __unregister_ftrace_function(struct ftrace_ops *ops)
    > if (ret < 0)
    > return ret;
    >
    > + if (ops->flags & FTRACE_OPS_FL_CONTROL)
    > + jump_label_dec(&ftrace_ops_control);
    > +
    > if (ftrace_enabled)
    > update_ftrace_function();
    >
    > @@ -3577,8 +3590,14 @@ ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip)
    > preempt_disable_notrace();
    > op = rcu_dereference_raw(ftrace_ops_list);
    > while (op != &ftrace_list_end) {
    > + if (static_branch(&ftrace_ops_control))

    Instead of doing a static_branch() here, which makes me really nervous,
    because this is called in function trace context, which has some strict
    rules of its own, and is probably prone to recursion, we could add
    another "ops" similar to the global_ops.

    We could make a control_ops, and add all ops with the
    FTRACE_OPS_FL_CONTROL flag set to it. And then this function will have
    its own loop that it will check the disabled flag, for the ops
    registered to it.

    This code doesn't need to be touched, we just add a layer of redirection
    for control ops and it will solve the jump_label issue.

    -- Steve

    > + if ((op->flags & FTRACE_OPS_FL_CONTROL) &&
    > + atomic_read(&op->disabled))
    > + goto next;
    > +
    > if (ftrace_ops_test(op, ip))
    > op->func(ip, parent_ip);
    > + next:
    > op = rcu_dereference_raw(op->next);
    > };
    > preempt_enable_notrace();




    \
     
     \ /
      Last update: 2011-11-28 21:23    [W:4.066 / U:0.032 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site