From 3d07b3bed8eac28bbb336cd9304f1974d9a425fb Mon Sep 17 00:00:00 2001 From: Yunlong Song Date: Mon, 9 Nov 2015 11:10:03 +0800 Subject: perf test: Add llvm-src-base.c and llvm-src-kbuild.c to .gitignore Commit b31de018a6284a25e0fdfeb028e724f8417ec3b1 ("perf test: Enhance the LLVM test: update basic BPF test program") dynamically creates file llvm-src-base.c during the perf building. Similarly, the commit 7af3f3d55b80cce40ad94b6b8e173dccedaf25e6 ("perf test: Enhance the LLVM tests: add kbuild test") dynamically creates file llvm-src-kbuild.c during the perf building. Add them to .gitignore. Signed-off-by: Yunlong Song Tested-by: Arnaldo Carvalho de Melo Cc: Adrian Hunter Cc: Alexei Starovoitov Cc: David Ahern Cc: Jiri Olsa Cc: Kan Liang Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Wang Nan Fixes: b31de018a628 ("perf test: Enhance the LLVM test: update basic BPF test program") Fixes: 7af3f3d55b80 ("perf test: Enhance the LLVM tests: add kbuild test") Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/tests/.gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 tools/perf/tests/.gitignore diff --git a/tools/perf/tests/.gitignore b/tools/perf/tests/.gitignore new file mode 100644 index 000000000000..489fc9ffbcb0 --- /dev/null +++ b/tools/perf/tests/.gitignore @@ -0,0 +1,2 @@ +llvm-src-base.c +llvm-src-kbuild.c -- cgit v1.2.3 From 4a4c03c1bb286bf0def7ae506bc076285f58d8b6 Mon Sep 17 00:00:00 2001 From: Michael Petlan Date: Mon, 9 Nov 2015 16:33:31 +0100 Subject: perf annotate: Support full source file paths for srcline fix The --full-paths option did not show the full source file paths in the 'perf annotate' tool, because the value of the option was not propagated into the related functions. With this patch the value of the --full-paths option is known to the function that composes the srcline string, so it prints the full path when necessary. Committer Note: This affects annotate when the --print-line option is used: # perf annotate -h 2>&1 | grep print-line -l, --print-line print matching source lines (may be slow) Looking just at the lines that should be affected by this change: Before: # perf annotate --print-line --full-paths --stdio fput | grep '\.[ch]:[0-9]\+' 94.44 atomic64_64.h:114 5.56 file_table.c:265 file_table.c:265 5.56 : ffffffff81219a00: callq ffffffff81769360 <__fentry__> atomic64_64.h:114 94.44 : ffffffff81219a05: lock decq 0x38(%rdi) After: # perf annotate --print-line --full-paths --stdio fput | grep '\.[ch]:[0-9]\+' 94.44 /home/git/linux/arch/x86/include/asm/atomic64_64.h:114 5.56 /home/git/linux/fs/file_table.c:265 /home/git/linux/fs/file_table.c:265 5.56 : ffffffff81219a00: callq ffffffff81769360 <__fentry__> /home/git/linux/arch/x86/include/asm/atomic64_64.h:114 94.44 : ffffffff81219a05: lock decq 0x38(%rdi) # Signed-off-by: Michael Petlan Tested-by: Arnaldo Carvalho de Melo Link: http://permalink.gmane.org/gmane.linux.kernel.perf.user/2365 Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/annotate.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index f2974da0185a..1dd1949b0e79 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c @@ -1620,6 +1620,7 @@ int symbol__tty_annotate(struct symbol *sym, struct map *map, len = symbol__size(sym); if (print_lines) { + srcline_full_filename = full_paths; symbol__get_source_line(sym, map, evsel, &source_line, len); print_summary(&source_line, dso->long_name); } -- cgit v1.2.3 From e87b49116dedba3464fd8d0ec9393b4841167334 Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Mon, 9 Nov 2015 17:12:03 -0300 Subject: perf session: Add missing newlines to some pr_err() calls Before: [acme@zoo linux]$ perf evlist WARNING: The perf.data file's data size field is 0 which is unexpected. Was the 'perf record' command properly terminated? non matching sample_type[acme@zoo linux]$ After: [acme@zoo linux]$ perf evlist WARNING: The perf.data file's data size field is 0 which is unexpected. Was the 'perf record' command properly terminated? non matching sample_type [acme@zoo linux]$ Cc: Adrian Hunter Cc: David Ahern Cc: Jiri Olsa Cc: Namhyung Kim Cc: Wang Nan Link: http://lkml.kernel.org/n/tip-wscok3a2s7yrj8156oc2r6qe@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/session.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 428149bc64d2..c35ffdd360fe 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -29,7 +29,7 @@ static int perf_session__open(struct perf_session *session) struct perf_data_file *file = session->file; if (perf_session__read_header(session) < 0) { - pr_err("incompatible file format (rerun with -v to learn more)"); + pr_err("incompatible file format (rerun with -v to learn more)\n"); return -1; } @@ -37,17 +37,17 @@ static int perf_session__open(struct perf_session *session) return 0; if (!perf_evlist__valid_sample_type(session->evlist)) { - pr_err("non matching sample_type"); + pr_err("non matching sample_type\n"); return -1; } if (!perf_evlist__valid_sample_id_all(session->evlist)) { - pr_err("non matching sample_id_all"); + pr_err("non matching sample_id_all\n"); return -1; } if (!perf_evlist__valid_read_format(session->evlist)) { - pr_err("non matching read_format"); + pr_err("non matching read_format\n"); return -1; } -- cgit v1.2.3 From 421fd0845eaeecce6b3806f7f0c0d67d1f9ad108 Mon Sep 17 00:00:00 2001 From: Wang Nan Date: Fri, 6 Nov 2015 09:50:15 +0000 Subject: perf probe: Verify parameters in two functions On kernel with only one out of CONFIG_KPROBE_EVENTS and CONFIG_UPROBE_EVENTS enabled, 'perf probe -d' causes a segfault because perf_del_probe_events() calls probe_file__get_events() with a negative fd. This patch fixes it by adding parameter validation at the entry of probe_file__get_events() and probe_file__get_rawlist(). Since they are both non-static public functions (in .h file), parameter verifying is required. v1 -> v2: Verify fd at the head of probe_file__get_rawlist() instead of checking at call site (suggested by Masami and Arnaldo at [1,2]). [1] http://lkml.kernel.org/r/50399556C9727B4D88A595C8584AAB37526048E3@GSjpTKYDCembx32.service.hitachi.net [2] http://lkml.kernel.org/r/20151105155830.GV13236@kernel.org Signed-off-by: Wang Nan Acked-by: Masami Hiramatsu Cc: Jiri Olsa Cc: Namhyung Kim Cc: Zefan Li Cc: pi3orama@163.com Link: http://lkml.kernel.org/r/1446803415-83382-1-git-send-email-wangnan0@huawei.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/probe-file.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c index 89dbeb92c68e..e3b3b92e4458 100644 --- a/tools/perf/util/probe-file.c +++ b/tools/perf/util/probe-file.c @@ -138,6 +138,9 @@ struct strlist *probe_file__get_rawlist(int fd) char *p; struct strlist *sl; + if (fd < 0) + return NULL; + sl = strlist__new(NULL, NULL); fp = fdopen(dup(fd), "r"); @@ -271,6 +274,9 @@ int probe_file__get_events(int fd, struct strfilter *filter, const char *p; int ret = -ENOENT; + if (!plist) + return -EINVAL; + namelist = __probe_file__get_namelist(fd, true); if (!namelist) return -ENOENT; -- cgit v1.2.3 From 5602ea09c19e85557f2b4d30be1d6ba349b7a038 Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Wed, 11 Nov 2015 12:54:42 -0300 Subject: tools include: Add compiler.h to list.h list.h needs WRITE_ONCE() since 7f5f873c6a07 ("rculist: Use WRITE_ONCE() when deleting from reader-visible list") add it before including the kernel's list.h file. This fixes builds of 'make perf-tar-src-pkg' perf tool tarball builds, i.e. out of tree builds. Cc: Adrian Hunter Cc: David Ahern Cc: Jiri Olsa Cc: Namhyung Kim Cc: Wang Nan Link: http://lkml.kernel.org/n/tip-e0rb8f7jwz0jn24ttyick9u6@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/include/linux/list.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/include/linux/list.h b/tools/include/linux/list.h index 76b014c96893..a017f1595676 100644 --- a/tools/include/linux/list.h +++ b/tools/include/linux/list.h @@ -1,3 +1,4 @@ +#include #include #include -- cgit v1.2.3