lkml.org 
[lkml]   [2015]   [Oct]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 30/31] perf record: Apply config to BPF objects before recording
    Date
    From: He Kuang <hekuang@huawei.com>

    In perf record, before start recording, call bpf__apply_config() to
    turn on all BPF config options.

    Signed-off-by: Wang Nan <wangnan0@huawei.com>
    Signed-off-by: He Kuang <hekuang@huawei.com>
    Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Alexei Starovoitov <ast@plumgrid.com>
    Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
    Cc: Daniel Borkmann <daniel@iogearbox.net>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: He Kuang <hekuang@huawei.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Kaixu Xia <xiakaixu@huawei.com>
    Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Paul Mackerras <paulus@samba.org>
    Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
    Cc: Zefan Li <lizefan@huawei.com>
    Cc: pi3orama@163.com
    Link: http://lkml.kernel.org/n/ebpf-ziazd5s4t9j96d01t5bdbtat@git.kernel.org
    ---
    tools/perf/builtin-record.c | 10 ++++++++++
    1 file changed, 10 insertions(+)

    diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
    index 200f221..a47ce9e 100644
    --- a/tools/perf/builtin-record.c
    +++ b/tools/perf/builtin-record.c
    @@ -32,6 +32,7 @@
    #include "util/parse-branch-options.h"
    #include "util/parse-regs-options.h"
    #include "util/llvm-utils.h"
    +#include "util/bpf-loader.h"

    #include <unistd.h>
    #include <sched.h>
    @@ -524,6 +525,15 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
    goto out_child;
    }

    + err = bpf__apply_config();
    + if (err) {
    + char errbuf[BUFSIZ];
    +
    + bpf__strerror_apply_config(err, errbuf, sizeof(errbuf));
    + pr_warning("WARNING: Apply config to BPF failed: %s\n",
    + errbuf);
    + }
    +
    /*
    * Normally perf_session__new would do this, but it doesn't have the
    * evlist.
    --
    1.8.3.4


    \
     
     \ /
      Last update: 2015-10-14 15:01    [W:3.923 / U:0.052 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site