perf offcpu: Accept allowed sample types only
authorNamhyung Kim <namhyung@kernel.org>
Fri, 24 Jun 2022 23:13:09 +0000 (16:13 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 28 Jun 2022 14:45:45 +0000 (11:45 -0300)
commit49c692b7dfc9b6c06a1dc11359a8780575b16d4a
treed4312d6d454aca7a01d1469a314d8c5cdda57fd7
parentd6838ec44b4513280a3f43fcc402e246d543fb53
perf offcpu: Accept allowed sample types only

As offcpu-time event is synthesized at the end, it could not get the
all the sample info.  Define OFFCPU_SAMPLE_TYPES for allowed ones and
mask out others in evsel__config() to prevent parse errors.

Because perf sample parsing assumes a specific ordering with the
sample types, setting unsupported one would make it fail to read
data like perf record -d/--data.

Fixes: edc41a1099c2d08c ("perf record: Enable off-cpu analysis with BPF")
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Blake Jones <blakejones@google.com>
Cc: Hao Luo <haoluo@google.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Milian Wolff <milian.wolff@kdab.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Song Liu <songliubraving@fb.com>
Cc: bpf@vger.kernel.org
Link: http://lore.kernel.org/lkml/20220624231313.367909-3-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/bpf_off_cpu.c
tools/perf/util/evsel.c
tools/perf/util/off_cpu.h