Re: [PATCH 2/4] perf/ftrace: Fix function trace events

From: Peter Zijlstra
Date: Wed Oct 11 2017 - 12:40:58 EST


On Wed, Oct 11, 2017 at 05:02:28PM +0800, zhouchengming wrote:
> On 2017/10/11 15:45, Peter Zijlstra wrote:

> > + if (!(flags& PERF_EF_START))
> > + p_event->hw.state = PERF_HES_STOPPED;
>
> Don't we need to check the flags for ftrace perf_event?
> So if we should put this outside the if (!tp_event->class->reg()) ?

Oh, right you are, that's independent of the hlist nonsense.

> > + list = this_cpu_ptr(pcpu_list);
> > + hlist_add_head_rcu(&p_event->hlist_entry, list);
> > + }
>
> Now we don't add perf_event to the pcpu_list, so we also can avoid
> to alloc pcpu_list for function tp_event in perf_trace_event_reg().

Yeah that allocation is superfluous, Not entirely sure how to cleanly
get rid of that though; that's another web to untangle.