Skip to content

Commit faf59ec

Browse files
ahunter6acmel
authored andcommitted
perf record: Fix synthesis failure warnings
Some calls to synthesis functions set err < 0 but only warn about the failure and continue. However they do not set err back to zero, relying on subsequent code to do that. That changed with the introduction of option --synth. When --synth=no subsequent functions that set err back to zero are not called. Fix by setting err = 0 in those cases. Example: Before: $ perf record --no-bpf-event --synth=all -o /tmp/huh uname Couldn't synthesize bpf events. Linux [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.014 MB /tmp/huh (7 samples) ] $ perf record --no-bpf-event --synth=no -o /tmp/huh uname Couldn't synthesize bpf events. After: $ perf record --no-bpf-event --synth=no -o /tmp/huh uname Couldn't synthesize bpf events. Linux [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.014 MB /tmp/huh (7 samples) ] Fixes: 41b740b ("perf record: Add --synth option") Signed-off-by: Adrian Hunter <[email protected]> Acked-by: Namhyung Kim <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 0a9eaf6 commit faf59ec

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tools/perf/builtin-record.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1906,14 +1906,18 @@ static int record__synthesize(struct record *rec, bool tail)
19061906

19071907
err = perf_event__synthesize_bpf_events(session, process_synthesized_event,
19081908
machine, opts);
1909-
if (err < 0)
1909+
if (err < 0) {
19101910
pr_warning("Couldn't synthesize bpf events.\n");
1911+
err = 0;
1912+
}
19111913

19121914
if (rec->opts.synth & PERF_SYNTH_CGROUP) {
19131915
err = perf_event__synthesize_cgroups(tool, process_synthesized_event,
19141916
machine);
1915-
if (err < 0)
1917+
if (err < 0) {
19161918
pr_warning("Couldn't synthesize cgroup events.\n");
1919+
err = 0;
1920+
}
19171921
}
19181922

19191923
if (rec->opts.nr_threads_synthesize > 1) {

0 commit comments

Comments
 (0)