Re: [PATCH 4/9] ftrace: Add enable/disable ftrace_ops controlinterface

From: Jiri Olsa
Date: Tue Nov 29 2011 - 05:07:58 EST


On Mon, Nov 28, 2011 at 03:21:33PM -0500, Steven Rostedt wrote:
>
> >
> > @@ -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.

sounds good, I'll make the change

thanks,
jirka

>
> -- 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();
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/