Re: [PATCH 1/2] perf stat: Fix segfault when counting armv8_pmu events

From: Namhyung Kim
Date: Wed Sep 23 2020 - 10:15:25 EST


On Wed, Sep 23, 2020 at 11:08 PM Jiri Olsa <jolsa@xxxxxxxxxx> wrote:
>
> On Wed, Sep 23, 2020 at 10:49:52PM +0900, Namhyung Kim wrote:
> > On Wed, Sep 23, 2020 at 2:44 PM Jiri Olsa <jolsa@xxxxxxxxxx> wrote:
> > >
> > > On Tue, Sep 22, 2020 at 11:13:45AM +0800, Wei Li wrote:
> > > > When executing perf stat with armv8_pmu events with a workload, it will
> > > > report a segfault as result.
> > >
> > > please share the perf stat command line you see that segfault for
> >
> > It seems the description in the patch 0/2 already has it:
> >
> > [root@localhost hulk]# tools/perf/perf stat -e
> > armv8_pmuv3_0/ll_cache_rd/,armv8_pmuv3_0/ll_cache_miss_rd/ ls >
> > /dev/null
> > Segmentation fault
>
> yea I found it, but can't reproduce it.. I see the issue from
> patch 2, but not sure what's the problem so far

I think the problem is that armv8_pmu has a cpumask,
and the user requested per-task events.

The code tried to open the event with a dummy cpu map
since it's not a cpu event, but the pmu has cpu map and
it's passed to evsel. So there's confusion somewhere
whether it should use evsel->cpus or a dummy map.

Thanks
Namhyung