perf record: Replace option --bpf-event with --no-bpf-event
authorSong Liu <songliubraving@fb.com>
Tue, 12 Mar 2019 05:30:37 +0000 (22:30 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 19 Mar 2019 19:52:06 +0000 (16:52 -0300)
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>
tools/perf/builtin-record.c
tools/perf/perf.h
tools/perf/util/bpf-event.c
tools/perf/util/evsel.c

index e7144a1c1c8226d4bb49f06d0ebb3d90cae51cff..f29874192d3e5083e04eac535c7e0f0ab0ab3163 100644 (file)
@@ -1891,7 +1891,7 @@ static struct option __record_options[] = {
        OPT_BOOLEAN(0, "tail-synthesize", &record.opts.tail_synthesize,
                    "synthesize non-sample events at the end of output"),
        OPT_BOOLEAN(0, "overwrite", &record.opts.overwrite, "use overwrite mode"),
-       OPT_BOOLEAN(0, "bpf-event", &record.opts.bpf_event, "record bpf events"),
+       OPT_BOOLEAN(0, "no-bpf-event", &record.opts.no_bpf_event, "record bpf events"),
        OPT_BOOLEAN(0, "strict-freq", &record.opts.strict_freq,
                    "Fail if the specified frequency can't be used"),
        OPT_CALLBACK('F', "freq", &record.opts, "freq or 'max'",
index b120e547ddc7b7fd9b4a03c8723a797f010b9511..c59743def8d36f539d7c196befa216a4b6c55a66 100644 (file)
@@ -66,7 +66,7 @@ struct record_opts {
        bool         ignore_missing_thread;
        bool         strict_freq;
        bool         sample_id;
-       bool         bpf_event;
+       bool         no_bpf_event;
        unsigned int freq;
        unsigned int mmap_pages;
        unsigned int auxtrace_mmap_pages;
index 028c8ec1f62a9c347b5c493d3b0caddf74145451..ea012b735a37c19bc486aedd77dec5e0262dc14b 100644 (file)
@@ -187,7 +187,7 @@ static int perf_event__synthesize_one_bpf_prog(struct perf_tool *tool,
        }
 
        /* Synthesize PERF_RECORD_BPF_EVENT */
-       if (opts->bpf_event) {
+       if (!opts->no_bpf_event) {
                *bpf_event = (struct bpf_event){
                        .header = {
                                .type = PERF_RECORD_BPF_EVENT,
index 1a2023da5d9c6b84f117b77b9714d3b0c28e6922..7835e05f0c0a476c4d782a98dc8de5fb4494d55b 100644 (file)
@@ -1036,7 +1036,7 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts,
        attr->mmap2 = track && !perf_missing_features.mmap2;
        attr->comm  = track;
        attr->ksymbol = track && !perf_missing_features.ksymbol;
-       attr->bpf_event = track && opts->bpf_event &&
+       attr->bpf_event = track && !opts->no_bpf_event &&
                !perf_missing_features.bpf_event;
 
        if (opts->record_namespaces)