Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf record: Replace option --bpf-event with --no-bpf-event

Currently, monitoring of BPF programs through bpf_event is off by
default for 'perf record'.

To turn it on, the user need to use option "--bpf-event". As BPF gets
wider adoption in different subsystems, this option becomes
inconvenient.

This patch makes bpf_event on by default, and adds option "--no-bpf-event"
to turn it off. Since option --bpf-event is not released yet, it is safe
to remove it.

Signed-off-by: Song Liu <songliubraving@fb.com>
Reviewed-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: kernel-team@fb.com
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stanislav Fomichev <sdf@google.com>
Link: http://lkml.kernel.org/r/20190312053051.2690567-2-songliubraving@fb.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Song Liu and committed by
Arnaldo Carvalho de Melo
71184c6a d982b331

+4 -4
+1 -1
tools/perf/builtin-record.c
··· 1891 1891 OPT_BOOLEAN(0, "tail-synthesize", &record.opts.tail_synthesize, 1892 1892 "synthesize non-sample events at the end of output"), 1893 1893 OPT_BOOLEAN(0, "overwrite", &record.opts.overwrite, "use overwrite mode"), 1894 - OPT_BOOLEAN(0, "bpf-event", &record.opts.bpf_event, "record bpf events"), 1894 + OPT_BOOLEAN(0, "no-bpf-event", &record.opts.no_bpf_event, "record bpf events"), 1895 1895 OPT_BOOLEAN(0, "strict-freq", &record.opts.strict_freq, 1896 1896 "Fail if the specified frequency can't be used"), 1897 1897 OPT_CALLBACK('F', "freq", &record.opts, "freq or 'max'",
+1 -1
tools/perf/perf.h
··· 66 66 bool ignore_missing_thread; 67 67 bool strict_freq; 68 68 bool sample_id; 69 - bool bpf_event; 69 + bool no_bpf_event; 70 70 unsigned int freq; 71 71 unsigned int mmap_pages; 72 72 unsigned int auxtrace_mmap_pages;
+1 -1
tools/perf/util/bpf-event.c
··· 187 187 } 188 188 189 189 /* Synthesize PERF_RECORD_BPF_EVENT */ 190 - if (opts->bpf_event) { 190 + if (!opts->no_bpf_event) { 191 191 *bpf_event = (struct bpf_event){ 192 192 .header = { 193 193 .type = PERF_RECORD_BPF_EVENT,
+1 -1
tools/perf/util/evsel.c
··· 1036 1036 attr->mmap2 = track && !perf_missing_features.mmap2; 1037 1037 attr->comm = track; 1038 1038 attr->ksymbol = track && !perf_missing_features.ksymbol; 1039 - attr->bpf_event = track && opts->bpf_event && 1039 + attr->bpf_event = track && !opts->no_bpf_event && 1040 1040 !perf_missing_features.bpf_event; 1041 1041 1042 1042 if (opts->record_namespaces)