Re: [PATCH] perf tools: Move precise_ip detection into perf_evsel__open

From: Arnaldo Carvalho de Melo
Date: Mon Mar 25 2019 - 10:53:44 EST


Em Sat, Mar 23, 2019 at 04:04:22PM +0100, Jiri Olsa escreveu:
> On Fri, Mar 15, 2019 at 03:52:25PM +0100, Jiri Olsa wrote:
> > On Fri, Mar 15, 2019 at 11:35:04AM -0300, Arnaldo Carvalho de Melo wrote:
> > > The perf_evsel__open() code is already complex with that fallback
> > > mechanism, this is just one more way of fallbacking when asking the
> > > kernel for something that may fail.

> > > In fact what happens if the precise_ip that is being asked _is_
> > > supported but sys_perf_event_open() fails because some other
> > > perf_event_attr attribute that is set is not supported?

> > it's outside the scope of standard feature fallback code,
> > so we will try it for any possible fallback variant, so:

> > we will try all possible precise_ip (3,2,1,0) and they will
> > all fail because of the unsupported attribute - so we will
> > restore the precise_ip back and continue in standard fallback
> > code that will eventualy switch that attribute off

> > > I see, it gets it back restored to what the user asked so that the
> > > standard fallback is tried, ok, I'll apply with just the rename for this
> > > function,

> ping, there's rebased version in my perf/fixes branch

Thanks, applied.

- Arnaldo