Re: how to use perf annotate on the kernel

From: Arnaldo Carvalho de Melo
Date: Thu Jun 03 2010 - 20:39:27 EST


Em Thu, Jun 03, 2010 at 09:20:39PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Thu, Jun 03, 2010 at 08:18:04PM +0200, Stephane Eranian escreveu:
> > perf annotate __lock_acquire -k /home/eranian/perfmon/official/tip/build/vmlinux
> > build id event received for [kernel.kallsyms]:
> > 5c110a704293a259fbe11158dc1b25107ad7a23e
> > build id event received for
> > /lib/modules/2.6.35-rc1-tip/kernel/arch/x86/kernel/cpu/cpufreq/mperf.ko:
> > cb5
> > build id event received for
> > /lib/modules/2.6.35-rc1-tip/kernel/drivers/cpufreq/cpufreq_ondemand.ko:
> > cdb5
> > Using /home/eranian/perfmon/official/tip/build/vmlinux for symbols
> > hist_entry__inc_addr_samples: ip=0xffffffff81073b36
> > 0xffffffff81073b30 __lock_acquire: period++ [ip: 0xffffffff81073b36, 0x6] => 1
> > hist_entry__inc_addr_samples: ip=0xffffffff81073c94
> >
> > But in the end I get:
> > objdump: '[kernel.kallsyms]': No such file
>
> Reproduced, working on it now. I've been testing only with vmlinux in
> the path it searches for, not by directly specifying it, will get that
> fixed, thanks,

Should be fixed by this patch:

[root@emilia ~]# perf annotate -k /lib/modules/2.6.35-rc1/build/vmlinux.OFF n_tty_write | head -50


------------------------------------------------
Percent | Source code & Disassembly of vmlinux.OFF
------------------------------------------------
:
:
:
: Disassembly of section .text:
:
: ffffffff81288820 <n_tty_write>:
: * lock themselves)
: */
:
: static ssize_t n_tty_write(struct tty_struct *tty, struct file *file,
: const unsigned char *buf, size_t nr)
: {
0.00 : ffffffff81288820: 41 57 push %r15
:
: DECLARE_PER_CPU(struct task_struct *, current_task);
:
: static __always_inline struct task_struct *get_current(void)
: {
: return percpu_read_stable(current_task);
0.00 : ffffffff81288822: 65 48 8b 04 25 40 cc mov %gs:0xcc40,%rax
0.00 : ffffffff81288829: 00 00
0.00 : ffffffff8128882b: 41 56 push %r14
0.00 : ffffffff8128882d: 41 55 push %r13
0.00 : ffffffff8128882f: 49 89 cd mov %rcx,%r13
0.00 : ffffffff81288832: 41 54 push %r12
0.00 : ffffffff81288834: 49 89 d4 mov %rdx,%r12
0.00 : ffffffff81288837: 55 push %rbp
0.00 : ffffffff81288838: 48 89 f5 mov %rsi,%rbp
0.00 : ffffffff8128883b: 53 push %rbx
0.00 : ffffffff8128883c: 48 89 fb mov %rdi,%rbx
0.00 : ffffffff8128883f: 48 83 ec 58 sub $0x58,%rsp
: const unsigned char *b = buf;
: DECLARE_WAITQUEUE(wait, current);
0.00 : ffffffff81288843: 48 c7 44 24 20 00 00 movq $0x0,0x20(%rsp)
0.00 : ffffffff8128884a: 00 00
7.14 : ffffffff8128884c: 48 c7 44 24 38 00 00 movq $0x0,0x38(%rsp)
0.00 : ffffffff81288853: 00 00
0.00 : ffffffff81288855: 48 c7 44 24 40 00 00 movq $0x0,0x40(%rsp)
0.00 : ffffffff8128885c: 00 00
7.14 : ffffffff8128885e: 48 89 44 24 28 mov %rax,0x28(%rsp)
0.00 : ffffffff81288863: 48 c7 44 24 30 30 49 movq $0xffffffff81044930,0x30(%rsp)
0.00 : ffffffff8128886a: 04 81
: int c;
: ssize_t retval = 0;
:
[root@emilia ~]#