Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1261392
| From | Wang Nan <wangnan0@huawei.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 0/5] perf bpf: Improve error code delivering and output |
| Date | 2015-11-03 12:10 +0100 |
| Message-ID | <qqHtL-1CF-7@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
This patchset is based on tip/core.
Arnaldo found some confusing error reports when reviewing BPF related
patches. This patch set makes some changes:
- perf test only print ok, failed or skip. Extra messages can be seen
by '-v'.
- libbpf not output anything when called from perf without '-v'.
- Create libbpf and bpf-loader specific error number group to deliver
precise error. New strerror framework makes adding new error code
easier.
- Improve error messages.
After applying this patch:
When target object not exist:
$ ls ./foo.o
ls: cannot access ./foo.o: No such file or directory
$ ./perf record --event foo.o sleep
event syntax error: 'foo.o'
\___ Failed to load foo.o: No such file or directory
(add -v to see detail)
Run 'perf list' for a list of valid events
Usage: perf record [<options>] [<command>]
or: perf record [<options>] -- <command> [<options>]
-e, --event <event> event selector. use 'perf list' to list available events
When target object format invalid:
$ cp /etc/passwd ./badbpf.o
$ ./perf record --event ./badbpf.o sleep
event syntax error: './badbpf.o'
\___ Failed to load ./badbpf.o: BPF object format invalid
(... skip ...)
When run by normal user and /proc/sys/kernel/kptr_restrict is 1:
$ cat /proc/sys/kernel/kptr_restrict
1
$ ./perf record --event ./bpf-script-example.o sleep
Failed to init vmlinux path.
event syntax error: './bpf-script-example.o'
\___ You need to be root, and /proc/sys/kernel/kptr_restrict should be 0
(... skip ...)
After fixing /proc/sys/kernel/kptr_restrict:
$ sudo -s
# echo 0 > /proc/sys/kernel/kptr_restrict
# exit
$ ./perf record --event ./bpf-script-example.o sleep
Failed to open kprobe_events: Permission denied
event syntax error: './bpf-script-example.o'
\___ You need to be root
(... skip ...)
Load an object with no 'version' section:
# ./perf record --event ./bpf-script-example.o sleep
event syntax error: './bpf-script-example.o'
\___ Failed to load ./bpf-script-example.o: 'version' section incorrect or lost
(... skip ...)
Load an object with incorrect 'version' section:
# ./perf record --event ./bpf-script-example.o sleep
event syntax error: './bpf-script-example.o'
\___ Failed to load program: Validate your program and check 'license'/'version' sections in your object
(... skip ...)
When event name not set:
# ./perf record --event ./bpf-script-example.o sleep
event syntax error: './bpf-script-example.o'
\___ No event name found in config string
(... skip ...)
Wang Nan (5):
perf test: Keep test result clean if '-v' not set
perf tools: Mute libbpf when '-v' not set
perf tools: Parsing libbpf return value using err.h
bpf tools: Improve libbpf error reporting
perf tools: Improve BPF related error messages output
tools/lib/bpf/libbpf.c | 149 +++++++++++++++++++++++++------------
tools/lib/bpf/libbpf.h | 12 +++
tools/perf/tests/attr.c | 3 +-
tools/perf/tests/code-reading.c | 8 +-
tools/perf/tests/keep-tracking.c | 4 +-
tools/perf/tests/llvm.c | 13 ++--
tools/perf/tests/switch-tracking.c | 4 +-
tools/perf/util/bpf-loader.c | 110 +++++++++++++++++++++++----
tools/perf/util/bpf-loader.h | 18 +++++
tools/perf/util/parse-events.c | 7 +-
10 files changed, 243 insertions(+), 85 deletions(-)
--
1.8.3.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH 0/5] perf bpf: Improve error code delivering and output Wang Nan <wangnan0@huawei.com> - 2015-11-03 12:10 +0100
[PATCH 2/5] perf tools: Mute libbpf when '-v' not set Wang Nan <wangnan0@huawei.com> - 2015-11-03 12:10 +0100
[tip:perf/urgent] perf bpf: Mute libbpf when '-v' not set tip-bot for Wang Nan <tipbot@zytor.com> - 2015-11-08 08:30 +0100
[PATCH 4/5] bpf tools: Improve libbpf error reporting Wang Nan <wangnan0@huawei.com> - 2015-11-03 12:10 +0100
Re: [PATCH 0/5] perf bpf: Improve error code delivering and output Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-03 16:50 +0100
Re: [PATCH 0/5] perf bpf: Improve error code delivering and output "Wangnan (F)" <wangnan0@huawei.com> - 2015-11-04 02:50 +0100
csiph-web