lkml.org 
[lkml]   [2019]   [Mar]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] perf tools: Move precise_ip detection into perf_evsel__open
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:
>
> SNIP
>
> > > +static void display_attr(struct perf_event_attr *attr)
> > > +{
> > > + if (verbose >= 2) {
> > > + fprintf(stderr, "%.60s\n", graph_dotted_line);
> > > + fprintf(stderr, "perf_event_attr:\n");
> > > + perf_event_attr__fprintf(stderr, attr, __open_attr__fprintf, NULL);
> > > + fprintf(stderr, "%.60s\n", graph_dotted_line);
> > > + }
> > > +}
> > > +
> > > +static int perf_event_open(struct perf_evsel *evsel,
> > > + pid_t pid, int cpu, int group_fd,
> > > + unsigned long flags)
> >
> >
> > The patch is ok, but I think the naming of this function is too generic,
> > so I'm renaming it to:
> >
> > static int perf_evsel__open_adjust_precise_ip(struct perf_evsel *evsel,
> > pid_t pid, int cpu, int group_fd,
> > unsigned long flags)
> >
> > Ok?
>
> ok
>
> >
> > 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,
>
> thanks,
> jirka

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

jirka

\
 
 \ /
  Last update: 2019-03-23 16:05    [W:0.050 / U:16.704 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site