Re: [PATCHv2 4/5] perf stat: Add -a as a default target

From: Borislav Petkov
Date: Mon Feb 20 2017 - 17:47:48 EST

On Mon, Feb 20, 2017 at 06:22:54PM -0300, Arnaldo Carvalho de Melo wrote:
> Well, this one should be read (and written in the tool output as):
> <not supported in workload only mode, try system wide, using -a>

Do you want to change that CNTR_NOT_SUPPORTED string unconditionally to
something like above?

Because perf_evsel.supported seems like it means that counter is not
supported but not necessarily only because of the missing -a for an
uncore event, AFAICT. I could be wrong.

> Right, the ENOTSUPP in this case needs to be properly expanded into
> something meaningful, as suggested above.

I dumped errno in __run_perf_stat():

./perf stat -v -e amd_nb/event=0xe0,umask=0x1f/ sleep 1
Using CPUID AuthenticAMD-21-2
amd_nb/event=0xe0,umask=0x1f/ event is not supported by the kernel: 22.

It is -EINVAL and the syscall returns -EINVAL in bunch of places so I'm
guessing this might not be a good way to match the retval to the proper
error message.

Peterz said something about scanning all events supplied by -e and if
all are uncore, to set -a automatically. Can we do that?


Good mailing practices for 400: avoid top-posting and trim the reply.