Re: [patch] perf wrong enabled time after attach/enable/enable

From: Peter Zijlstra
Date: Wed Aug 09 2017 - 12:31:09 EST


On Fri, Aug 04, 2017 at 01:22:53PM +0200, Peter Zijlstra wrote:
> On Thu, Aug 03, 2017 at 02:07:53PM -0400, Vince Weaver wrote:
> > On Wed, 2 Aug 2017, Peter Zijlstra wrote:
> >
> > > Playing with that test it really is the IOC_DISABLE while STOP'ed that
> > > messes things up.
> > >
> > > Ah.. magic.. the below seems to fix things, hopefully it doesn't break
> > > anything else.
> >
> > yes, I've tested this and it seems to fix things.
>
> New version below.. is a bit different and should handle another case.
> I'll try and run more tests on it, because while it _SHOULD_ not trigger
> that WARN_ON_ONCE() you know how that goes..

And splat it goes.. turns out we can attach to a ctx when OFF (which
makes sense, they need to live someplace too).

In that case the IOC_ENABLE will again go through
__perf_event_enable_time() and recompute things.

I think I'll just remove the WARN_ON_ONCE(), and put in a comment.