• Arnaldo Carvalho de Melo's avatar
    perf tools: Improve kernel/modules symbol lookup · 2e538c4a
    Arnaldo Carvalho de Melo authored
    This removes the ovelapping of vmlinux addresses with modules,
    using the ELF section name when using --vmlinux and creating a
    unique DSO name when using /proc/kallsyms ([kernel].N).
    
    This is done by creating multiple 'struct map' instances for
    address ranges backed by DSOs that have just the symbols for that
    range and a name that is derived from the ELF section name.o
    
    Now it is possible to ask for just the symbols in some particular
    kernel section:
    
    $ perf report -m --vmlinux ../build/tip-recvmmsg/vmlinux \
    	--dsos [kernel].vsyscall_fn | head -15
        52.73%             Xorg  [.] vread_hpet
        18.61%          firefox  [.] vread_hpet
        14.50%     npviewer.bin  [.] vread_hpet
         6.83%           compiz  [.] vread_hpet
         5.73%         glxgears  [.] vread_hpet
         0.63%             java  [.] vread_hpet
         0.30%   gnome-terminal  [.] vread_hpet
         0.23%             perf  [.] vread_hpet
         0.18%            xchat  [.] vread_hpet
    $
    
    Now we don't have to first lookup the list of modules and then, if
    it fails, vmlinux symbols, its just a simple lookup for the map
    then the symbols, just like for threads.
    
    Reports generated using /proc/kallsyms and --vmlinux should provide
    the same results, modulo the DSO name for sections other than
    ".text".
    
    But they don't right now because things like:
    
     ffffffff81011c20-ffffffff81012068 system_call
     ffffffff81011c30-ffffffff81011c9b system_call_after_swapgs
     ffffffff81011c9c-ffffffff81011cb6 system_call_fastpath
     ffffffff81011cb7-ffffffff81011cbb ret_from_sys_call
    
    I.e. overlapping symbols, again some ASM special case that we have
    to fixup.
    Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Frederic Weisbecker <fweisbec@gmail.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Paul Mackerras <paulus@samba.org>
    Cc: Mike Galbraith <efault@gmx.de>
    LKML-Reference: <1254934136-8503-1-git-send-email-acme@redhat.com>
    Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    2e538c4a
symbol.c 29.1 KB