Re: [RFC PATCH v2 26/31] fprobe: Rewrite fprobe on function-graph tracer
From: Steven Rostedt
Date: Fri Nov 10 2023 - 20:44:29 EST
On Fri, 10 Nov 2023 16:17:39 +0900
Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx> wrote:
> > + used = 0;
> > + hlist_for_each_entry_from_rcu(node, hlist) {
> > + if (node->addr != func)
> > + break;
> > + fp = READ_ONCE(node->fp);
> > + if (!fp || fprobe_disabled(fp))
> > + continue;
> > +
> > + if (fprobe_shared_with_kprobes(fp))
> > + ret = __fprobe_kprobe_handler(func, ret_ip,
> > + fp, fregs, fgraph_data + used);
> > + else
> > + ret = __fprobe_handler(func, ret_ip, fp,
> > + fregs, fgraph_data + used);
>
>
> Since the fgraph callback is under rcu-locked but not preempt-disabled,
rcu-locked? The only rcu-locked is task rcu.
> fprobe unittest fails. I need to add preempt_disable_notrace() and
> preempt_enable_notrace() around this. Note that kprobe_busy_begin()/end()
> also access to per-cpu variable, so it requires to disable preemption.
Just around the __fprobe_*handler()? Or the loop?
-- Steve