From: Wang Nan <wangnan0@huawei.com>
To: <acme@kernel.org>, <jolsa@kernel.org>
Cc: <linux-kernel@vger.kernel.org>, Wang Nan <wangnan0@huawei.com>,
"Arnaldo Carvalho de Melo" <acme@redhat.com>,
Li Zefan <lizefan@huawei.com>, <pi3orama@163.com>
Subject: [RFC PATCH 4/5] perf trace: Call bpf__apply_obj_config in 'perf trace'
Date: Thu, 25 Feb 2016 08:51:54 +0000 [thread overview]
Message-ID: <1456390315-127562-5-git-send-email-wangnan0@huawei.com> (raw)
In-Reply-To: <1456390315-127562-1-git-send-email-wangnan0@huawei.com>
Without this patch BPF map configuration is not applied.
Command like this:
# ./perf trace --ev bpf-output/no-inherit,name=evt/ \
--ev ./test_bpf_trace.c/map:channel.event=evt/ \
usleep 100000
Load BPF files without error, but since map:channel.event=evt is not
applied, bpf-output event not work.
This patch allows 'perf trace' load and run BPF scripts.
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Li Zefan <lizefan@huawei.com>
Cc: pi3orama@163.com
---
tools/perf/builtin-trace.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 2deb3f0..b7129d6 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -33,6 +33,7 @@
#include "util/stat.h"
#include "trace-event.h"
#include "util/parse-events.h"
+#include "util/bpf-loader.h"
#include <libaudit.h>
#include <stdlib.h>
@@ -2597,6 +2598,16 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
if (err < 0)
goto out_error_open;
+ err = bpf__apply_obj_config();
+ if (err) {
+ char errbuf[BUFSIZ];
+
+ bpf__strerror_apply_obj_config(err, errbuf, sizeof(errbuf));
+ pr_err("ERROR: Apply config to BPF failed: %s\n",
+ errbuf);
+ goto out_error_open;
+ }
+
/*
* Better not use !target__has_task() here because we need to cover the
* case where no threads were specified in the command line, but a
--
1.8.3.4
next prev parent reply other threads:[~2016-02-25 8:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-25 8:51 [RFC PATCH 0/5] perf tools: Decode bpf output in 'perf trace' Wang Nan
2016-02-25 8:51 ` [RFC PATCH 1/5] perf trace: Apply config options in '.perfconfig' Wang Nan
2016-02-25 12:50 ` Arnaldo Carvalho de Melo
2016-02-25 8:51 ` [RFC PATCH 2/5] perf trace: Improve error message when receive non-tracepoint events Wang Nan
2016-02-25 8:51 ` [RFC PATCH 3/5] perf tools: Only set filter for tracepoints events Wang Nan
2016-02-25 8:51 ` Wang Nan [this message]
2016-02-25 8:51 ` [RFC PATCH 5/5] perf trace: Print content of bpf-output event Wang Nan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1456390315-127562-5-git-send-email-wangnan0@huawei.com \
--to=wangnan0@huawei.com \
--cc=acme@kernel.org \
--cc=acme@redhat.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=pi3orama@163.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox