Re: [tip:perf/core] perf evsel: Fix inverted test for fixing upattr.inherit flag

From: Arnaldo Carvalho de Melo
Date: Mon Apr 11 2011 - 13:36:04 EST


Em Sat, Apr 09, 2011 at 04:05:42PM +0200, Peter Zijlstra escreveu:
> On Tue, 2011-02-22 at 09:10 +0000, tip-bot for Arnaldo Carvalho de Melo
> wrote:
> > Commit-ID: e603dc15072c7fec0ae263597e6dabc3bb4c5c5b
> > Gitweb: http://git.kernel.org/tip/e603dc15072c7fec0ae263597e6dabc3bb4c5c5b
> > Author: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
> > AuthorDate: Mon, 21 Feb 2011 16:05:50 -0300
> > Committer: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
> > CommitDate: Mon, 21 Feb 2011 22:27:59 -0300
> >
> > perf evsel: Fix inverted test for fixing up attr.inherit flag
> >
> > The kernel refuses mmapping an event with the inherit flag set for
> > something that is systemwide (cpu == -1), and the evsel layer got this
> > reversed at some point, fix it.
> >
> > + * Proper fix is not to pass 'inherit' to perf_evsel__open*,
> > + * but a 'flags' parameter, with 'group' folded there as well,
> > + * then introduce a PERF_O_{MMAP,GROUP,INHERIT} enum, and if
> > + * O_MMAP is set, emit a warning if cpu < 0 and O_INHERIT is
> > + * set. Lets go for the minimal fix first tho.
> > + */
> > + evsel->attr.inherit = (cpus->map[cpu] >= 0) && inherit;

> This wrecked perf-stat, perf-stat doesn't mmap and its perfectly fine
> for it to use task-bound counters with inheritance.

Can you check if the patch below fixes this? An acked-by or tested-by
tag would be mucho appreciated.

- Arnaldo