Re: [RFC][PATCH 8/8] perf: Rework the PMU methods

From: Frederic Weisbecker
Date: Tue Jun 22 2010 - 12:26:58 EST


On Fri, Jun 18, 2010 at 09:15:38AM +0200, Peter Zijlstra wrote:
> On Fri, 2010-06-18 at 06:21 +0200, Frederic Weisbecker wrote:
> > On Wed, Jun 16, 2010 at 06:00:35PM +0200, Peter Zijlstra wrote:
> > > -static void x86_pmu_stop(struct perf_event *event)
> > > +static void x86_pmu_stop(struct perf_event *event, int flags)
> > > {
> > > - struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
> > > - struct hw_perf_event *hwc = &event->hw;
> > > - int idx = hwc->idx;
> > > -
> > > if (!__test_and_clear_bit(idx, cpuc->active_mask))
> > > - return;
> >
> >
> >
> > Do you still need active_mask now that you have HES_STOPPED?
>
> there still were some users, but yeah, we cuold probably clean that up,
> bit since the patch is large enough as is, I didn't attempt that.


Yeah, that can be done later.



> > > +static void perf_swevent_start(struct perf_event *event, int flags)
> > > +{
> > > + event->hw.state = 0;
> > > +}
> > > +
> > > +static void perf_swevent_stop(struct perf_event *event, int flags)
> > > {
> > > + event->hw.state = 1;
> > > }
> >
> >
> > So, instead of doing this and add yet another check in the fast path,
> > what about just playing with the hlist insertion and deletion?
>
> I wanted to avoid too much trickery, first make a simple one work, then
> try something fancy.



Ok, as far it's not considered a long term thing. I can
improve that from my exclusion patchset, rebased on top of yours.




> > It would be nice to have a PERF_EF_STOP as well in ->del, so that
> > each pmu don't need to maintain an internal state.
>
> You have to track it since we can stop the thing outselves without the
> caller knowing.


>From the pmu internals yeah, that's what the x86 pmu does. But otherwise, other
pmu don't do such things.

--
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/