lkml.org 
[lkml]   [2010]   [Nov]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[tip:perf/urgent] perf record: Handle restrictive permissions in /proc/{kallsyms,modules}
Commit-ID:  c1a3a4b90a5a47adcca0e587f5d7e9ea61329b26
Gitweb: http://git.kernel.org/tip/c1a3a4b90a5a47adcca0e587f5d7e9ea61329b26
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Mon, 22 Nov 2010 14:01:55 -0200
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 22 Nov 2010 14:01:55 -0200

perf record: Handle restrictive permissions in /proc/{kallsyms,modules}

The 59365d1 commit, even being reverted by 33e0d57, showed a non robust
behavior in 'perf record': it really should just warn the user that some
functionality will not be available.

The new behavior then becomes:

[acme@felicio linux]$ ls -la /proc/{kallsyms,modules}
-r-------- 1 root root 0 Nov 22 12:19 /proc/kallsyms
-r-------- 1 root root 0 Nov 22 12:19 /proc/modules
[acme@felicio linux]$ perf record ls -R > /dev/null
Couldn't record kernel reference relocation symbol
Symbol resolution may be skewed if relocation was used (e.g. kexec).
Check /proc/kallsyms permission or run as root.
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.004 MB perf.data (~161 samples) ]
[acme@felicio linux]$ perf report --stdio
[kernel.kallsyms] with build id 77b05e00e64e4de1c9347d83879779b540d69f00 not found, continuing without symbols
# Events: 98 cycles
#
# Overhead Command Shared Object Symbol
# ........ ....... ............... ....................
#
48.26% ls [kernel] [k] ffffffff8102b92b
22.49% ls libc-2.12.90.so [.] __strlen_sse2
8.35% ls libc-2.12.90.so [.] __GI___strcoll_l
8.17% ls ls [.] 11580
3.35% ls libc-2.12.90.so [.] _IO_new_file_xsputn
3.33% ls libc-2.12.90.so [.] _int_malloc
1.88% ls libc-2.12.90.so [.] _int_free
0.84% ls libc-2.12.90.so [.] malloc_consolidate
0.84% ls libc-2.12.90.so [.] __readdir64
0.83% ls ls [.] strlen@plt
0.83% ls libc-2.12.90.so [.] __GI_fwrite_unlocked
0.83% ls libc-2.12.90.so [.] __memcpy_sse2

#
# (For a higher level overview, try: perf report --sort comm,dso)
#
[acme@felicio linux]$

It still has the build-ids for DSOs in the maps with hits:

[acme@felicio linux]$ perf buildid-list
77b05e00e64e4de1c9347d83879779b540d69f00 [kernel.kallsyms]
09c4a431a4a8b648fcfc2c2bdda70f56050ddff1 /bin/ls
af75ea9ad951d25e0f038901a11b3846dccb29a4 /lib64/libc-2.12.90.so
[acme@felicio linux]$

That can be used in another machine to resolve kernel symbols.

Cc: Eugene Teo <eugeneteo@kernel.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Jesper Juhl <jj@chaosbits.net>
Cc: Marcus Meissner <meissner@suse.de>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-record.c | 17 +++++++++--------
1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 93bd2ff..e2c2de2 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -697,17 +697,18 @@ static int __cmd_record(int argc, const char **argv)
if (err < 0)
err = event__synthesize_kernel_mmap(process_synthesized_event,
session, machine, "_stext");
- if (err < 0) {
- pr_err("Couldn't record kernel reference relocation symbol.\n");
- return err;
- }
+ if (err < 0)
+ pr_err("Couldn't record kernel reference relocation symbol\n"
+ "Symbol resolution may be skewed if relocation was used (e.g. kexec).\n"
+ "Check /proc/kallsyms permission or run as root.\n");

err = event__synthesize_modules(process_synthesized_event,
session, machine);
- if (err < 0) {
- pr_err("Couldn't record kernel reference relocation symbol.\n");
- return err;
- }
+ if (err < 0)
+ pr_err("Couldn't record kernel module information.\n"
+ "Symbol resolution may be skewed if relocation was used (e.g. kexec).\n"
+ "Check /proc/modules permission or run as root.\n");
+
if (perf_guest)
perf_session__process_machines(session, event__synthesize_guest_os);


\
 
 \ /
  Last update: 2010-11-23 20:55    [W:0.473 / U:0.252 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site