perf bpf: Decouple creating the evlist from adding the SB event
Renaming bpf_event__add_sb_event() to evlist__add_sb_event() and requiring that the evlist be allocated beforehand. This will allow using the same side band thread and evlist to be used for multiple purposes in addition to react to PERF_RECORD_BPF_EVENT soon after they are generated. Acked-by: Jiri Olsa <jolsa@redhat.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Song Liu <songliubraving@fb.com> Link: http://lore.kernel.org/lkml/20200429131106.27974-4-acme@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
@@ -1573,16 +1573,27 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
|
||||
goto out_child;
|
||||
}
|
||||
|
||||
err = -1;
|
||||
if (!rec->no_buildid
|
||||
&& !perf_header__has_feat(&session->header, HEADER_BUILD_ID)) {
|
||||
pr_err("Couldn't generate buildids. "
|
||||
"Use --no-buildid to profile anyway.\n");
|
||||
err = -1;
|
||||
goto out_child;
|
||||
}
|
||||
|
||||
if (!opts->no_bpf_event)
|
||||
bpf_event__add_sb_event(&rec->sb_evlist, &session->header.env);
|
||||
if (!opts->no_bpf_event) {
|
||||
rec->sb_evlist = evlist__new();
|
||||
|
||||
if (rec->sb_evlist == NULL) {
|
||||
pr_err("Couldn't create side band evlist.\n.");
|
||||
goto out_child;
|
||||
}
|
||||
|
||||
if (evlist__add_bpf_sb_event(rec->sb_evlist, &session->header.env)) {
|
||||
pr_err("Couldn't ask for PERF_RECORD_BPF_EVENT side band events.\n.");
|
||||
goto out_child;
|
||||
}
|
||||
}
|
||||
|
||||
if (perf_evlist__start_sb_thread(rec->sb_evlist, &rec->opts.target)) {
|
||||
pr_debug("Couldn't start the BPF side band thread:\nBPF programs starting from now on won't be annotatable\n");
|
||||
|
||||
Reference in New Issue
Block a user