Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1343953 > unrolled thread

[PATCH 06/46] perf trace: Call bpf__apply_obj_config in 'perf trace'

Started byWang Nan <wangnan0@huawei.com>
First post2016-02-26 10:40 +0100
Last post2016-02-27 10:50 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 06/46] perf trace: Call bpf__apply_obj_config in 'perf trace' Wang Nan <wangnan0@huawei.com> - 2016-02-26 10:40 +0100
    [tip:perf/core] perf trace: Call bpf__apply_obj_config in 'perf  trace' tip-bot for Wang Nan <tipbot@zytor.com> - 2016-02-27 10:50 +0100

#1343953 — [PATCH 06/46] perf trace: Call bpf__apply_obj_config in 'perf trace'

FromWang Nan <wangnan0@huawei.com>
Date2016-02-26 10:40 +0100
Subject[PATCH 06/46] perf trace: Call bpf__apply_obj_config in 'perf trace'
Message-ID<r6n2r-13D-37@gated-at.bofh.it>
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 9b6e7c4..32392c4 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

[toc] | [next] | [standalone]


#1344960 — [tip:perf/core] perf trace: Call bpf__apply_obj_config in 'perf trace'

Fromtip-bot for Wang Nan <tipbot@zytor.com>
Date2016-02-27 10:50 +0100
Subject[tip:perf/core] perf trace: Call bpf__apply_obj_config in 'perf trace'
Message-ID<r6JFE-XE-7@gated-at.bofh.it>
In reply to#1343953
Commit-ID:  ba50423530200659d4deb703a8f72d3b69bc13ce
Gitweb:     http://git.kernel.org/tip/ba50423530200659d4deb703a8f72d3b69bc13ce
Author:     Wang Nan <wangnan0@huawei.com>
AuthorDate: Fri, 26 Feb 2016 09:31:54 +0000
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 26 Feb 2016 19:50:40 -0300

perf trace: Call bpf__apply_obj_config in 'perf trace'

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: Alexei Starovoitov <ast@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Li Zefan <lizefan@huawei.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1456479154-136027-7-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.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 20916dd..254149c 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>
@@ -2586,6 +2587,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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web