2010-01-04 10:23:48

by Jamie Iles

[permalink] [raw]
Subject: [PATCH] perf symbols: don't use modules or try vmlinux unless needed

Commit 75be6cf (perf symbols: Make symbol_conf global) does what it says
on the tin, but also initialises the member fields use_modules and
try_vmlinux_path to true rather than the 'false' value they would have
had when symbol_conf was static.

When there is no vmlinux on the system and modules loaded, perf top will
not show any kernel symbols and perf report will only list raw IP's
rather than symbol names. Unloading the modules will allow perf to give
normal output.

Restore previous behaviour by initialising these fields to false.

Signed-off-by: Jamie Iles <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Paul Mackerras <[email protected]>
---
tools/perf/util/symbol.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 79ca6a0..9467c29 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -40,8 +40,8 @@ static char **vmlinux_path;

struct symbol_conf symbol_conf = {
.exclude_other = true,
- .use_modules = true,
- .try_vmlinux_path = true,
+ .use_modules = false,
+ .try_vmlinux_path = false,
};

bool dso__loaded(const struct dso *self, enum map_type type)
--
1.6.5.4


2010-01-08 11:37:14

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [PATCH] perf symbols: don't use modules or try vmlinux unless needed

Em Mon, Jan 04, 2010 at 10:23:54AM +0000, Jamie Iles escreveu:
> Commit 75be6cf (perf symbols: Make symbol_conf global) does what it says
> on the tin, but also initialises the member fields use_modules and
> try_vmlinux_path to true rather than the 'false' value they would have
> had when symbol_conf was static.
>
> When there is no vmlinux on the system and modules loaded, perf top will
> not show any kernel symbols and perf report will only list raw IP's
> rather than symbol names. Unloading the modules will allow perf to give
> normal output.
>
> Restore previous behaviour by initialising these fields to false.

James,

I just tried using perf top here in such conditions:

[root@ana ~]# strace -e open -o /tmp/perf.open.strace perf top
------------------------------------------------------------------------
PerfTop: 65 irqs/sec kernel:64.6% [1000Hz cycles], (all, 2 CPUs)
------------------------------------------------------------------------

samples pcnt function DSO
_______ _____ __________________ _________________

12.00 7.0% format_decode [kernel.kallsyms]
10.00 5.8% __strstr_ia32 /lib/libc-2.11.so
9.00 5.3% read_hpet [kernel.kallsyms]
7.00 4.1% module_get_kallsym [kernel.kallsyms]
5.00 2.9% vsnprintf [kernel.kallsyms]
5.00 2.9% __memchr /lib/libc-2.11.so
/usr/lib/libgtk-x11-2.0.so.0.1800.5.#prelink#.aAFN89 was updated,
restart the long running apps that use it!

[root@ana ~]# grep vmlinux /tmp/perf.open.strace
open("vmlinux", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/boot/vmlinux", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/boot/vmlinux-2.6.31.9-174.fc12.i686", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/lib/modules/2.6.31.9-174.fc12.i686/build/vmlinux", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/usr/lib/debug/lib/modules/2.6.31.9-174.fc12.i686/vmlinux", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)

And it is resolving the kernel symbols.

Maybe some changes I made that aren't yet in Ingo's tree or upstream
fixed it, can you please try after those patches are merged?

- Arnaldo

2010-01-08 11:52:54

by Jamie Iles

[permalink] [raw]
Subject: Re: [PATCH] perf symbols: don't use modules or try vmlinux unless needed

On Fri, Jan 08, 2010 at 09:36:57AM -0200, Arnaldo Carvalho de Melo wrote:
> Ecanfcan Mon, Jan 04, 2010 at 10:23:54AM +0000, Jamie Iles escreveu:
> > Commit 75be6cf (perf symbols: Make symbol_conf global) does what it says
> > on the tin, but also initialises the member fields use_modules and
> > try_vmlinux_path to true rather than the 'false' value they would have
> > had when symbol_conf was static.
> >
> > When there is no vmlinux on the system and modules loaded, perf top will
> > not show any kernel symbols and perf report will only list raw IP's
> > rather than symbol names. Unloading the modules will allow perf to give
> > normal output.
> >
> > Restore previous behaviour by initialising these fields to false.
>
> James,
>
> I just tried using perf top here in such conditions:
>
[snip]
>
> And it is resolving the kernel symbols.
>
> Maybe some changes I made that aren't yet in Ingo's tree or upstream
> fixed it, can you please try after those patches are merged?
Ok, could you let me know when the relevant ones are in there? From todays
next tree, without the patch I still only get userspace symbols (system loaded
with 'dd if=/dev/zero of=/dev/null' to make sure it's busy):

49.00 17.6% T.276 /root/tools/perf
25.00 9.0% __GI_strcmp /lib/libc-2.8.so
21.00 7.6% symbol_filter /root/tools/perf
17.00 6.1% strncmp /root/tools/perf
...

But with the patch applied output looks good:

597.00 17.0% _raw_spin_unlock_irq [kernel.kallsyms]
589.00 16.8% lock_acquire [kernel.kallsyms]
367.00 10.4% _raw_spin_unlock_irqrestore [kernel.kallsyms]
230.00 6.5% vector_swi [kernel.kallsyms]
122.00 3.5% __memzero [kernel.kallsyms]
71.00 2.0% lock_release [kernel.kallsyms]
...

Jamie