perf/urgent fixes
Arnaldo Carvalho de Melo
maintainerHi Ingo,
Please consider pulling,
- Arnaldo
The following changes since commit b71b437eedaed985062492565d9d421d975ae845:
perf: Fix inherited events vs. tracepoint filters (2015-11-09 16:13:11 +0100)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-urgent-for-mingo
for you to fetch changes up to 5602ea09c19e85557f2b4d30be1d6ba349b7a038:
tools include: Add compiler.h to list.h (2015-11-11 18:41:33 -0300)
----------------------------------------------------------------
perf/urgent fixes:
User visible:
- Add missing newlines to some pr_err() calls (Arnaldo Carvalho de Melo)
- Print full source file paths when using
'perf annotate --print-line --full-paths' (Michael Petlan)
- Fix 'perf probe -d' when just one out of uprobes and kprobes is enabled (Wang Nan)
Developer stuff:
- Add compiler.h to list.h to fix 'make perf-tar-src-pkg' generated tarballs, i.e. out of tree building (Arnaldo Carvalho de Melo)
- Add the llvm-src-base.c and llvm-src-kbuild.c files, generated by the 'perf test' LLVM entries, when running it in-tree, to .gitignore (Yunlong Song)
----------------------------------------------------------------
Arnaldo Carvalho de Melo (2):
perf session: Add missing newlines to some pr_err() calls tools include: Add compiler.h to list.h
Michael Petlan (1):
perf annotate: Support full source file paths for srcline fix
Wang Nan (1):
perf probe: Verify parameters in two functions
Yunlong Song (1):
perf test: Add llvm-src-base.c and llvm-src-kbuild.c to .gitignore
tools/include/linux/list.h | 1 + tools/perf/tests/.gitignore | 2 ++ tools/perf/util/annotate.c | 1 + tools/perf/util/probe-file.c | 6 ++++++ tools/perf/util/session.c | 8 ++++---- 5 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 tools/perf/tests/.gitignore
Arnaldo Carvalho de Melo
maintainerPATCH 1/5 perf test: Add llvm-src-base.c and llvm-src-kbuild.c to .gitignore
From: Yunlong Song <[email protected]>
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.
--- tools/perf/tests/.gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 tools/perf/tests/.gitignore
tools/perf/tests/.gitignore new file +2 -0
@@ -0,0 +1,2 @@ +llvm-src-base.c +llvm-src-kbuild.c
Signature · 1 line
2.1.0
Arnaldo Carvalho de Melo
maintainerPATCH 2/5 perf annotate: Support full source file paths for srcline fix
In reply to Arnaldo Carvalho de MeloFrom: Michael Petlan <[email protected]>
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)
#--- tools/perf/util/annotate.c | 1 + 1 file changed, 1 insertion(+)
tools/perf/util/annotate.c +1 -0
@@ -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); }
Signature · 1 line
2.1.0
Arnaldo Carvalho de Melo
maintainerPATCH 3/5 perf session: Add missing newlines to some pr_err() calls
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
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]$
--- tools/perf/util/session.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tools/perf/util/session.c +4 -4
@@ -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 ; }
Signature · 1 line
2.1.0
Arnaldo Carvalho de Melo
maintainerPATCH 4/5 perf probe: Verify parameters in two functions
In reply to Arnaldo Carvalho de MeloFrom: Wang Nan <[email protected]>
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/[email protected]
--- tools/perf/util/probe-file.c | 6 ++++++ 1 file changed, 6 insertions(+)
tools/perf/util/probe-file.c +6 -0
@@ -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 ;
Signature · 1 line
2.1.0
Arnaldo Carvalho de Melo
maintainerPATCH 5/5 tools include: Add compiler.h to list.h
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
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.
--- tools/include/linux/list.h | 1 + 1 file changed, 1 insertion(+)
tools/include/linux/list.h +1 -0
@@ -1,3 +1,4 @@ +#include <linux/compiler.h> #include <linux/kernel.h> #include <linux/types.h>
Signature · 1 line
2.1.0
Quoted 55 lines · Arnaldo Carvalho de Melo
Hi Ingo,
Please consider pulling,
- Arnaldo
The following changes since commit
b71b437eedaed985062492565d9d421d975ae845:perf: Fix inherited events vs. tracepoint filters (2015-11-09 16:13:11 +0100)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.gittags/perf-urgent-for-mingofor you to fetch changes up to
5602ea09c19e85557f2b4d30be1d6ba349b7a038:tools include: Add
compiler.htolist.h(2015-11-11 18:41:33 -0300)----------------------------------------------------------------
perf/urgent fixes:User visible:
- Add missing newlines to some
pr_err()calls (Arnaldo Carvalho de Melo)- Print full source file paths when using
'perf annotate --print-line --full-paths' (Michael Petlan)- Fix 'perf probe -d' when just one out of uprobes and kprobes is enabled (Wang Nan)
Developer stuff:
- Add
compiler.htolist.hto fix 'make perf-tar-src-pkg' generated tarballs, i.e. out of tree building (Arnaldo Carvalho de Melo)- Add the
llvm-src-base.candllvm-src-kbuild.cfiles, generated by the 'perf test' LLVM entries, when running it in-tree, to .gitignore (Yunlong Song)Signed-off-by Arnaldo Carvalho de Melo <[email protected]>----------------------------------------------------------------
Arnaldo Carvalho de Melo (2):
perf session: Add missing newlines to somepr_err()calls tools include: Addcompiler.htolist.hMichael Petlan (1):
perf annotate: Support full source file paths for srcline fixWang Nan (1):
perf probe: Verify parameters in two functionsYunlong Song (1):
perf test: Addllvm-src-base.candllvm-src-kbuild.cto .gitignore
Quoted 7 lines
tools/include/linux/list.h | 1 + tools/perf/tests/.gitignore | 2 ++ tools/perf/util/annotate.c | 1 + tools/perf/util/probe-file.c | 6 ++++++ tools/perf/util/session.c | 8 ++++---- 5 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 tools/perf/tests/.gitignore
Pulled, thanks a lot Arnaldo!
Ingo