linux-stable/tools
Rob Herring 289b56715b perf: Skip and warn on unknown format 'configN' attrs
[ Upstream commit e552b7be12 ]

If the kernel exposes a new perf_event_attr field in a format attr, perf
will return an error stating the specified PMU can't be found. For
example, a format attr with 'config3:0-63' causes an error as config3 is
unknown to perf. This causes a compatibility issue between a newer
kernel with older perf tool.

Before this change with a kernel adding 'config3' I get:

  $ perf record -e arm_spe// -- true
  event syntax error: 'arm_spe//'
                       \___ Cannot find PMU `arm_spe'. Missing kernel support?
  Run 'perf list' for a list of valid events

   Usage: perf record [<options>] [<command>]
      or: perf record [<options>] -- <command> [<options>]

      -e, --event <event>   event selector. use 'perf list' to list
  available events

After this change, I get:

  $ perf record -e arm_spe// -- true
  WARNING: 'arm_spe_0' format 'inv_event_filter' requires 'perf_event_attr::config3' which is not supported by this version of perf!
  [ perf record: Woken up 2 times to write data ]
  [ perf record: Captured and wrote 0.091 MB perf.data ]

To support unknown configN formats, rework the YACC implementation to
pass any config[0-9]+ format to perf_pmu__new_format() to handle with a
warning.

Reviewed-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Tested-by: Leo Yan <leo.yan@linaro.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20220914-arm-perf-tool-spe1-2-v2-v4-1-83c098e6212e@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-10-29 10:12:58 +02:00
..
accounting
arch
bootconfig
bpf bpftool: Clear errno after libcap's checks 2022-10-26 12:35:32 +02:00
build tools build: Switch to new openssl API for test-libcrypto 2022-08-25 11:40:14 +02:00
cgroup
debugging
edid
firewire
firmware
gpio
hv
iio
include tools/include/uapi: Fix <asm/errno.h> for parisc and xtensa 2022-09-23 14:15:49 +02:00
io_uring
kvm/kvm_stat
laptop
leds
lib selftests/xsk: Avoid use-after-free on ctx 2022-10-26 12:34:41 +02:00
memory-model
objtool objtool: Preserve special st_shndx indexes in elf_update_symbol 2022-10-26 12:34:37 +02:00
pci
pcmcia
perf perf: Skip and warn on unknown format 'configN' attrs 2022-10-29 10:12:58 +02:00
power
rcu
scripts
spi
testing kselftest/arm64: Fix validatation termination record after EXTRA_CONTEXT 2022-10-26 12:35:44 +02:00
thermal/tmon tools/thermal: Fix possible path truncations 2022-08-17 14:24:15 +02:00
time
tracing
usb
virtio
vm tools/vm/slabinfo: use alphabetic order when two values are equal 2022-08-25 11:40:13 +02:00
wmi
Makefile