1. 21 11月, 2009 1 次提交
    • A
      perf symbols: Remove unrelated actions from dso__load_kernel_sym · 6671cb16
      Arnaldo Carvalho de Melo 提交于
      It should just load kernel symbols, not load the list of
      modules. There are more stuff to move to other routines, but
      lets do it in several steps.
      
      End goal is to be able to defer symbol table loading till we
      find a hit for that map address range. So that the kernel &
      modules are handled just like all the other DSOs in the system.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1258757489-5978-1-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      6671cb16
  2. 19 11月, 2009 5 次提交
    • A
      perf symbols: Capture the running kernel buildid too · 2446042c
      Arnaldo Carvalho de Melo 提交于
      [root@doppio linux-2.6-tip]# perf record -a -f sleep 3s ; perf
      buildid-list | grep vmlinux
      [ perf record: Woken up 1 times to write data ]
      [ perf record: Captured and wrote 0.171 MB perf.data (~7489
      samples) ] 18e7cc53db62a7d35e9d6f6c9ddc23017d38ee9a vmlinux
      [root@doppio linux-2.6-tip]#
      
      Several refactorings were needed so that we can have symmetry
      between dsos__load_modules() and dsos__load_kernel(), i.e. those
      functions will respectively create and add to the dsos list the
      loaded modules and kernel, with its buildids, but not load its
      symbols. That is something the subcomands that need will have to
      call dso__load_kernel_sym(), just like we do with modules with
      dsos__load_module_sym()/dso__load_module_sym().
      
      Next csets will actually use this info to stop producing bogus
      results using mismatched vmlinux and .ko files.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Roland McGrath <roland@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1258582853-8579-4-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      2446042c
    • A
      perf symbols: Record the build_ids of kernel modules too · f1617b40
      Arnaldo Carvalho de Melo 提交于
      [root@doppio linux-2.6-tip]# perf record -a sleep 2s;perf
      buildid-list|tail [ perf record: Woken up 1 times to write data
      ] [ perf record: Captured and wrote 0.162 MB perf.data (~7078
      samples) ] 881588fa57b3c1696bc91e5e804a11304f093535 [cfg80211]
      4d47ce1da9d16bad00c962c072451b7c681e82df [snd_page_alloc]
      5146377e89a7caac617f9782f1a02e46263d3a31 [rfkill]
      2153b937bff0d345fea83b63a2e1d3138569f83d [i915]
      4e6fb1bb97362e3ee4d306988b9ad6912d5fb9ae [drm_kms_helper]
      f56ef2bf853e3a798f0d8d51f797622e5dc4420e [drm]
      b0d157a3b5c4e017329ffc07c64623cd6ad65e95 [i2c_algo_bit]
      8125374b905ef9fa8b65d98e166b008ad952f198 [i2c_core]
      fc875c6e5a90e7b915e9d445d0efc859e1b2678c [video]
      4b43c5006589f977e9762fdfc7ac1a92b72fca52 [output]
      [root@doppio linux-2.6-tip]#
      
      elfutils libdwfl/linux-kernel-modules.c was used as reference,
      as suggested by Roland McGrath.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Roland McGrath <roland@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1258582853-8579-3-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      f1617b40
    • A
      perf symbols: Kill struct build_id_list and die() another day · e30a3d12
      Arnaldo Carvalho de Melo 提交于
      No need for this struct and its allocations, we can just use the
      ->build_id member we already have in struct dso, then ask for it
      to be read, and later traverse the dsos list, writing the
      buildid table to the perf.data file.
      
      As a bonus, one more die() function got killed.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1258582853-8579-2-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      e30a3d12
    • A
      perf symbols: Fix comparision of build_ids · d3379ab9
      Arnaldo Carvalho de Melo 提交于
      When we read the build_id from the DSO name to then index into
      /usr/lib/debug/.buildid/DSO_BUILD_ID[0:2]/DSO_BUILD_ID[2:], we
      were jumping directly to the comparision with the buildid we
      already have in dso->build_id (that came from the perf.data
      build_id section, collected at perf record time)
      unconditionally, even if we didn't had recorded it, and
      furthermore, comparing a formatted buildid with a rawbuildid, yikes.
      
      Fix it by deleting the dso__read_build_id() function, that was
      really misdesigned anyway, and do the necessary checks and
      correct comparison of raw buildids.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1258582853-8579-1-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      d3379ab9
    • A
      perf symbols: Add a long_name_len member to struct dso · cfc10d3b
      Arnaldo Carvalho de Melo 提交于
      Using a two bytes hole we already had and since we also need to
      calculate this strlen for fetching the buildids. We'll use it in
      'perf top' to auto-adjust the output based on the terminal
      width.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1258479655-28662-1-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      cfc10d3b
  3. 17 11月, 2009 4 次提交
  4. 11 11月, 2009 1 次提交
    • F
      perf tools: Split up build id saving into fetch and write · 57f395a7
      Frederic Weisbecker 提交于
      We are saving the build id once we stop the profiling. And only
      after doing that we know if we need to set that feature in the
      header through the feature bitmap.
      
      But if we want a proper feature support in the headers, using a
      rule of offset/size pairs in sections, we need to know in
      advance how many features we need to set in the headers, so that
      we can reserve rooms for their section headers.
      
      The current state doesn't allow that, as it forces us to first
      save the build-ids to the file right after the datas instead of
      planning any structured layout.
      
      That's why this splits up the build-ids processing in two parts:
      one that fetches the build-ids from the Dso objects, and one
      that saves them into the file.
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
      LKML-Reference: <1257911467-28276-3-git-send-email-fweisbec@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      57f395a7
  5. 08 11月, 2009 1 次提交
    • A
      perf symbols: Use the buildids if present · 8d06367f
      Arnaldo Carvalho de Melo 提交于
      With this change 'perf record' will intercept PERF_RECORD_MMAP
      calls, creating a linked list of DSOs, then when the session
      finishes, it will traverse this list and read the buildids,
      stashing them at the end of the file and will set up a new
      feature bit in the header bitmask.
      
      'perf report' will then notice this feature and populate the
      'dsos' list and set the build ids.
      
      When reading the symtabs it will refuse to load from a file that
      doesn't have the same build id. This improves the
      reliability of the profiler output, as symbols and profiling
      data is more guaranteed to match.
      
      Example:
      
       [root@doppio ~]# perf report | head
       /home/acme/bin/perf with build id b1ea544ac3746e7538972548a09aadecc5753868 not found, continuing without symbols
        # Samples: 2621434559
        #
        # Overhead          Command                  Shared Object  Symbol
        # ........  ...............  .............................  ......
        #
             7.91%             init  [kernel]        [k] read_hpet
             7.64%             init  [kernel]        [k] mwait_idle_with_hints
             7.60%          swapper  [kernel]        [k] read_hpet
             7.60%          swapper  [kernel]        [k] mwait_idle_with_hints
             3.65%             init  [kernel]        [k] 0xffffffffa02339d9
      [root@doppio ~]#
      
      In this case the 'perf' binary was an older one, vanished,
      so its symbols probably wouldn't match or would cause subtly
      different (and misleading) output.
      
      Next patches will support the kernel as well, reading the build
      id notes for it and the modules from /sys.
      
      Another patch should also introduce a new plumbing command:
      
      'perf list-buildids'
      
      that will then be used in porcelain that is distro specific to
      fetch -debuginfo packages where such buildids are present. This
      will in turn allow for one to run 'perf record' in one machine
      and 'perf report' in another.
      
      Future work on having the buildid sent directly from the kernel
      in the PERF_RECORD_MMAP event is needed to close races, as the
      DSO can be changed during a 'perf record' session, but this
      patch at least helps with non-corner cases and current/older
      kernels.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: Frank Ch. Eigler <fche@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jason Baron <jbaron@redhat.com>
      Cc: Jim Keniston <jkenisto@us.ibm.com>
      Cc: K. Prasad <prasad@linux.vnet.ibm.com>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Roland McGrath <roland@redhat.com>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <1257367843-26224-1-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      8d06367f
  6. 04 11月, 2009 2 次提交
  7. 02 11月, 2009 2 次提交
  8. 29 10月, 2009 1 次提交
  9. 26 10月, 2009 1 次提交
    • M
      perf tools: Fix compatibility with libelf 0.8 and autodetect · 84087126
      Marti Raudsepp 提交于
      The Makefile now automatically defines LIBELF_NO_MMAP when
      libelf 0.8.x is detected. libelf 0.8 is still maintained and
      some distributions such as Arch Linux use it instead of
      elfutils.
      Signed-off-by: NMarti Raudsepp <marti@juffo.org>
      Cc: Lucas De Marchi <lucas.de.marchi@gmail.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      Cc: Mike Galbraith <efault@gmx.de>
      LKML-Reference: <1256400636.3007.16.camel@newn>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      84087126
  10. 23 10月, 2009 1 次提交
    • A
      perf tools: Unify debug messages mechanisms · 6beba7ad
      Arnaldo Carvalho de Melo 提交于
      We were using eprintf in some places, that looks at a global
      'verbose' level, and at other places passing a 'v' parameter to
      specify the verbosity level, unify it by introducing
      pr_{err,warning,debug,etc}, just like in the kernel.
      Signed-off-by: NArnaldo 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: <1256153646-10097-1-git-send-email-acme@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      6beba7ad
  11. 21 10月, 2009 1 次提交
  12. 20 10月, 2009 1 次提交
    • A
      perf tools: Add ->unmap_ip operation to struct map · ed52ce2e
      Arnaldo Carvalho de Melo 提交于
      We need this because we get section relative addresses when
      reading the symtabs, but when a tool like 'perf annotate' needs
      to match these address to what 'objdump -dS' produces we need
      the address + section back again.
      
      So in annotate now we look at the 'struct hist_entry' instances
      (that weren't really being used) so that we iterate only over
      the symbols that had some hit and get the map where that
      particular hit happened so that we can get the right address to
      match with annotate.
      
      Verified that at least:
      
       perf annotate mmap_read_counter # Uses the ~/bin/perf binary
       perf annotate --vmlinux /home/acme/git/build/perf/vmlinux intel_pmu_enable_all
      
      on a 'perf record perf top' session seems to work.
      Signed-off-by: NArnaldo 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: <1255979877-12533-1-git-send-email-acme@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      ed52ce2e
  13. 09 10月, 2009 2 次提交
    • A
      perf tools: Improve kernel/modules symbol lookup · 2e538c4a
      Arnaldo Carvalho de Melo 提交于
      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: NArnaldo 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: NIngo Molnar <mingo@elte.hu>
      2e538c4a
    • A
      perf tools: Up the verbose level for some really verbose stuff · da21d1b5
      Arnaldo Carvalho de Melo 提交于
      Like printing every symbol created.
      Signed-off-by: NArnaldo 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: <1254923340-4870-1-git-send-email-acme@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      da21d1b5
  14. 06 10月, 2009 3 次提交
    • A
      perf tools: elf_sym__is_function() should accept "zero" sized functions · 81833130
      Arnaldo Carvalho de Melo 提交于
      Asm routines that end up having size equal to zero are not really
      zero sized, and as now we do kernel_maps__fixup_sym_end, at least
      for kernel routines this gets fixed.
      
      A similar fixup needs to be done for the userspace bits as well,
      but as this fixup started only because in /proc/kallsyms we don't
      have the end address nor the function size, it appeared here first.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mike Galbraith <efault@gmx.de>
      LKML-Reference: <1254796503-27203-1-git-send-email-acme@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      81833130
    • A
      perf tools: /proc/modules names don't always match its name · a2a99e8e
      Arnaldo Carvalho de Melo 提交于
      $ cut -d' ' -f1 /proc/modules|grep _|wc -l
       29
       $ cut -d' ' -f1 /proc/modules|grep _|sed 's/$/.ko'/g|while read n;do find /lib/modules/`uname -r` -name $n;done|wc -l
       12
      
      For instance:
      
       $ grep ^aes_x86 /proc/modules
       aes_x86_64 9056 2 - Live 0xffffffffa0091000
       $ l /lib/modules/2.6.31-tip/kernel/arch/x86/crypto/aes-x86_64.ko
       -rw-r--r-- 1 root root 136438 2009-09-22 19:05 /lib/modules/2.6.31-tip/kernel/arch/x86/crypto/aes-x86_64.ko
      
      Handle that by introducing a strxfrchar routine that replaces
      dashes with underscores when matching file names to loaded modules.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mike Galbraith <efault@gmx.de>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      a2a99e8e
    • A
      perf tools: Create maps for modules when processing kallsyms · af427bf5
      Arnaldo Carvalho de Melo 提交于
      So that we get kallsyms processing closer to vmlinux + modules
      symtabs processing.
      
      One change in behaviour is that since when one specifies --vmlinux
      -m should be used to ask for modules, so it is now for kallsyms as
      well.
      
      Also continue if one manages to load the vmlinux data but module
      processing fails, so that at least some analisys can be done with
      part of the needed symbols.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mike Galbraith <efault@gmx.de>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      af427bf5
  15. 02 10月, 2009 1 次提交
    • A
      perf tools: Rewrite and improve support for kernel modules · 439d473b
      Arnaldo Carvalho de Melo 提交于
      Representing modules as struct map entries, backed by a DSO, etc,
      using /proc/modules to find where the module is loaded.
      
      DSOs now can have a short and long name, so that in verbose mode we
      can show exactly which .ko or vmlinux image was used.
      
      As kernel modules now are a DSO separate from the kernel, we can
      ask for just the hits for a particular set of kernel modules, just
      like we can do with shared libraries:
      
      [root@doppio linux-2.6-tip]# perf report -n --vmlinux
      /home/acme/git/build/tip-recvmmsg/vmlinux --modules --dsos \[drm\] | head -15
          84.58%      13266             Xorg  [k] drm_clflush_pages
           4.02%        630             Xorg  [k] trace_kmalloc.clone.0
           3.95%        619             Xorg  [k] drm_ioctl
           2.07%        324             Xorg  [k] drm_addbufs
           1.68%        263             Xorg  [k] drm_gem_close_ioctl
           0.77%        120             Xorg  [k] drm_setmaster_ioctl
           0.70%        110             Xorg  [k] drm_lastclose
           0.68%        106             Xorg  [k] drm_open
           0.54%         85             Xorg  [k] drm_mm_search_free
      [root@doppio linux-2.6-tip]#
      
      Specifying --dsos /lib/modules/2.6.31-tip/kernel/drivers/gpu/drm/drm.ko
      would have the same effect. Allowing specifying just 'drm.ko' is left
      for another patch.
      
      Processing kallsyms so that per kernel module struct map are
      instantiated was also left for another patch. That will allow
      removing the module name from each of its symbols.
      
      struct symbol was reduced by removing the ->module backpointer and
      moving it (well now the map) to struct symbol_entry in perf top,
      that is its only user right now.
      
      The total linecount went down by ~500 lines.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Avi Kivity <avi@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      439d473b
  16. 23 9月, 2009 1 次提交
    • M
      perf tools: Fix module symbol loading bug · 508c4d08
      Mike Galbraith 提交于
      Avi Kivity reported 'perf annotate' failures with modules, the
      requested function was not annotated.
      
      If there are no modules currently loaded, or the last module
      scanned is not loaded, dso__load_modules() steps on the value from
      dso__load_vmlinux(), so we happily load the kallsyms symbols on top
      of what we've already loaded.
      
      Fix that such that the total count of symbols loaded is returned.
      Should module symbol load fail after parsing of vmlinux, is's a
      hard failure, so do not silently fall-back to kallsyms.
      Reported-by: NAvi Kivity <avi@redhat.com>
      Signed-off-by: NMike Galbraith <efault@gmx.de>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: rostedt@goodmis.org
      Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      LKML-Reference: <1253697658.11461.36.camel@marge.simson.net>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      508c4d08
  17. 17 8月, 2009 1 次提交
    • F
      perf tools: Librarize trace_event() helper · 8f28827a
      Frederic Weisbecker 提交于
      Librarize trace_event() helper so that perf trace can use it
      too. Also clean up the debug.h includes a bit.
      
      It's not good to have it included in perf.h because it doesn't
      make it flexible against other headers it may need (headers
      that can also depend on perf.h and then create a recursive
      header dependency).
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      LKML-Reference: <1250453149-664-1-git-send-email-fweisbec@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      8f28827a
  18. 16 8月, 2009 1 次提交
    • I
      perf: Enable more compiler warnings · 83a0944f
      Ingo Molnar 提交于
      Related to a shadowed variable bug fix Valdis Kletnieks noticed
      that perf does not get built with -Wshadow, which could have
      helped us avoid the bug.
      
      So enable -Wshadow and also enable the following warnings on
      perf builds, in addition to the already enabled -Wall -Wextra
      -std=gnu99 warnings:
      
       -Wcast-align
       -Wformat=2
       -Wshadow
       -Winit-self
       -Wpacked
       -Wredundant-decls
       -Wstack-protector
       -Wstrict-aliasing=3
       -Wswitch-default
       -Wswitch-enum
       -Wno-system-headers
       -Wundef
       -Wvolatile-register-var
       -Wwrite-strings
       -Wbad-function-cast
       -Wmissing-declarations
       -Wmissing-prototypes
       -Wnested-externs
       -Wold-style-definition
       -Wstrict-prototypes
       -Wdeclaration-after-statement
      
      And change/fix the perf code to build cleanly under GCC 4.3.2.
      
      The list of warnings enablement is rather arbitrary: it's based
      on my (quick) reading of the GCC manpages and trying them on
      perf.
      
      I categorized the warnings based on individually enabling them
      and looking whether they trigger something in the perf build.
      If i liked those warnings (i.e. if they trigger for something
      that arguably could be improved) i enabled the warning.
      
      If the warnings seemed to come from language laywers spamming
      the build with tons of nuisance warnings i generally kept them
      off. Most of the sign conversion related warnings were in
      this category. (A second patch enabling some of the sign
      warnings might be welcome - sign bugs can be nasty.)
      
      I also kept warnings that seem to make sense from their manpage
      description and which produced no actual warnings on our code
      base. These warnings might still be turned off if they end up
      being a nuisance.
      
      I also left out a few warnings that are not supported in older
      compilers.
      
      [ Note that these changes might break the build on older
        compilers i did not test, or on non-x86 architectures that
        produce different warnings, so more testing would be welcome. ]
      
      Reported-by: Valdis.Kletnieks@vt.edu
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      83a0944f
  19. 12 8月, 2009 3 次提交
    • A
      perf tools: Fix dso__new handle() to handle deleted DSOs · 1340e6bb
      Arnaldo Carvalho de Melo 提交于
      It is better than showing the map addr, this way at least we
      know that we can't get the symtabs because the DSO was deleted
      (system update) while an app still used such DSO.
      
      Yeah, don't do that, but if you do, you'll figure it out
      quicker this way.
      
      [acme@doppio linux-2.6-tip]$ perf report | head -15
       # Samples: 3796
       #
       # Overhead  Command                                                        Shared Object  Symbol
       # ........  .......  ...................................................................  ......
       #
          23.55%   pidgin  /lib64/libglib-2.0.so.0.2000.4.#prelink#.Pd98lu (deleted)            [.] 0x00000000038844
          21.55%   pidgin  /lib64/libpthread-2.10.1.so.#prelink#.AFwK8Q (deleted)               [.] 0x0000000000a42d
          10.85%   pidgin  [kernel]                                                             [.] vread_hpet
           7.85%   pidgin  /lib64/libgobject-2.0.so.0.2000.4.#prelink#.o1vpU7 (deleted)         [.] 0x00000000014de8
           3.35%   pidgin  /lib64/libc-2.10.1.so (deleted)                                      [.] 0x0000000007a875
           3.19%   pidgin  /lib64/libdbus-1.so.3.4.0.#prelink#.6mwgZP (deleted)                 [.] 0x0000000001d254
           3.06%   pidgin  /usr/lib64/libgtk-x11-2.0.so.0.1600.5.#prelink#.511hAl (deleted)     [.] 0x000000002334e7
           2.90%   pidgin  /usr/lib64/libgdk-x11-2.0.so.0.1600.5.#prelink#.5qlMo1 (deleted)     [.] 0x00000000037b2d
           1.84%   pidgin  [kernel]                                                             [k] do_sys_poll
           1.45%   pidgin  /usr/lib64/libX11.so.6.2.0.#prelink#.iR59Rx (deleted)                [.] 0x0000000004c751
      [acme@doppio linux-2.6-tip]$
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Luis Claudio R. Gonçalves <lclaudio@redhat.com>
      Cc: Clark Williams <williams@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <20090811200436.GA3478@ghostprotocols.net>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      1340e6bb
    • A
      perf tools: Fix fallback to cplus_demangle() when bfd_demangle() is not available · 247648e3
      Arnaldo Carvalho de Melo 提交于
      In old binutils we can't access bfd_demangle(), use
      cplus_demangle() just like oprofile.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Luis Claudio R. Gonçalves <lclaudio@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <20090811192211.GG18061@ghostprotocols.net>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      247648e3
    • F
      perf tools: Factorize high level dso helpers · cd84c2ac
      Frederic Weisbecker 提交于
      Factorize multiple definitions of high level dso helpers into the
      symbol source file.
      
      The side effect is a general export of the verbose and eprintf
      debugging helpers into a new file dedicated to debugging purposes.
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Brice Goglin <Brice.Goglin@inria.fr>
      cd84c2ac
  20. 09 8月, 2009 1 次提交
    • A
      perf report: Add debug help for the finding of symbol bugs - show the symtab... · 94cb9e38
      Arnaldo Carvalho de Melo 提交于
      perf report: Add debug help for the finding of symbol bugs - show the symtab origin (DSO, build-id, kernel, etc)
      
      Used with perf report --verbose:
      
      [acme@doppio linux-2.6-tip]$ perf report -v | head -16
           5.17%  firefox  /usr/lib64/xulrunner-1.9.1/libxul.so   0x00000000005d8eee f [.] imgContainer::DrawFrameTo(gfxIImageFrame*, gfxIImageFrame*, nsRect&)
           2.56%  firefox  /lib64/libpthread-2.10.1.so            0x0000000000008e02 d [.] __pthread_mutex_lock_internal
           1.94%  firefox  /usr/lib64/xulrunner-1.9.1/libxul.so   0x0000000000d0af8f f [.] SearchTable
           1.75%  firefox  [kernel]                               0xffffffffff60013b k [.] vread_hpet
           1.63%  firefox  /lib64/libpthread-2.10.1.so            0x000000000000a404 d [.] __pthread_mutex_unlock
           1.47%  firefox  /usr/lib64/xulrunner-1.9.1/libmozjs.so 0x00000000000482ea f [.] js_Interpret
           1.42%  firefox  /usr/lib64/xulrunner-1.9.1/libmozjs.so 0x000000000003eda3 f [.] JS_CallTracer
           1.24%  firefox  [kernel]                               0xffffffff8102ca4a k [k] read_hpet
           1.16%  firefox  [kernel]                               0xffffffff810f3dd4 k [k] fget_light
           1.11%  firefox  /usr/lib64/xulrunner-1.9.1/libmozjs.so 0x00000000000567ff f [.] js_TraceObject
           0.98%  firefox  /usr/lib64/firefox-3.5.2/firefox       0x000000000000dd23 b [.] arena_ralloc
      [acme@doppio linux-2.6-tip]$
      
      The new field is just after the symbol address. To help in
      figuring out symbol resolution bugs.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Acked-by: NPeter Zijlstra <peterz@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      94cb9e38
  21. 07 8月, 2009 1 次提交
    • A
      perf symbol: Fix symbol parsing in certain cases: use the build-id as a symlink · 4d1e00a8
      Arnaldo Carvalho de Melo 提交于
      In some cases distros have binaries and debuginfo in weird places:
      
      [root@doppio tuna]# ls -la /usr/lib64/{xulrunner-1.9.1/xulrunner-stub,firefox-3.5.2/firefox}
      -rwxr-xr-x 1 root root 90024 2009-08-03 19:45 /usr/lib64/firefox-3.5.2/firefox
      -rwxr-xr-x 1 root root 90024 2009-08-03 18:23 /usr/lib64/xulrunner-1.9.1/xulrunner-stub
      [root@doppio tuna]# sha1sum /usr/lib64/{xulrunner-1.9.1/xulrunner-stub,firefox-3.5.2/firefox}
      19a858077d263d5de22c9c5da250d3e4396ae739  /usr/lib64/xulrunner-1.9.1/xulrunner-stub
      19a858077d263d5de22c9c5da250d3e4396ae739  /usr/lib64/firefox-3.5.2/firefox
      [root@doppio tuna]# rpm -qf /usr/lib64/{xulrunner-1.9.1/xulrunner-stub,firefox-3.5.2/firefox}
      xulrunner-1.9.1.2-1.fc11.x86_64
      firefox-3.5.2-2.fc11.x86_64
      [root@doppio tuna]# ls -la /usr/lib/debug/{usr/lib64/xulrunner-1.9.1/xulrunner-stub,usr/lib64/firefox-3.5.2/firefox}.debug
      ls: cannot access /usr/lib/debug/usr/lib64/firefox-3.5.2/firefox.debug: No such file or directory
      -rwxr-xr-x 1 root root 403608 2009-08-03 18:22 /usr/lib/debug/usr/lib64/xulrunner-1.9.1/xulrunner-stub.debug
      
      Seemingly we don't have a .symtab when we actually can find it
      if we use the .note.gnu.build-id ELF section put in place by
      some distros. Use it and find the symbols we need.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Acked-by: NPeter Zijlstra <peterz@infradead.org>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      4d1e00a8
  22. 05 8月, 2009 1 次提交
    • P
      perf: Auto-detect libbfd · 2cdbc46d
      Peter Zijlstra 提交于
      Since the C++ demangling isn't needed for everybody and
      bfd/iberty aren't widely/easily available on all machines, make
      it optional.
      
      It also allows you to forcefully disable demangling by using
      NO_DEMANGLE=1 and otherwise tries to detect libbfd/libiberty
      combinations that result in a compiling demangler.
      Reported-by: NJens Axboe <jens.axboe@oracle.com>
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Kyle McMartin <kyle@mcmartin.ca>
      LKML-Reference: <20090801082048.GX12579@kernel.dk>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      2cdbc46d
  23. 02 8月, 2009 1 次提交
    • S
      perf tools: Fix faulty check · 9b30a26b
      Stoyan Gaydarov 提交于
      This patch fixes a spelling error that has resulted from copy
      and pasting. The location of the error was found using a
      semantic patch but the semantic patch was not trying to find
      these errors. After looking things over it seemed logical that
      this change was needed. Please review it and then include the
      patch if it is in fact the correct change.
      Signed-off-by: NStoyan Gaydarov <sgayda2@uiuc.edu>
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <1248949529-20891-1-git-send-email-sgayda2@uiuc.edu>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      9b30a26b
  24. 23 7月, 2009 2 次提交
    • M
      perf_counter tools: Fix vmlinux symbol generation breakage · d20ff6bd
      Mike Galbraith 提交于
      vmlinux meets the criteria for symbol adjustment, which breaks vmlinux generated symbols.
      Fix this by exempting vmlinux.  This is a bit fragile in that someone could change the
      kernel dso's name, but currently that name is also hardwired.
      Signed-off-by: NMike Galbraith <efault@gmx.de>
      Cc: Ingo Molnar <mingo@elte.hu>
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <1248091298.18702.18.camel@marge.simson.net>
      d20ff6bd
    • A
      perf symbol: C++ demangling · 28ac909b
      Arnaldo Carvalho de Melo 提交于
      [acme@doppio ~]$ perf report -s comm,dso,symbol -C firefox -d /usr/lib64/xulrunner-1.9.1/libxul.so | grep :: | head
           2.21%  [.] nsDeque::Push(void*)
           1.78%  [.] GraphWalker::DoWalk(nsDeque&)
           1.30%  [.] GCGraphBuilder::AddNode(void*, nsCycleCollectionParticipant*)
           1.27%  [.] XPCWrappedNative::CallMethod(XPCCallContext&, XPCWrappedNative::CallMode)
           1.18%  [.] imgContainer::DrawFrameTo(gfxIImageFrame*, gfxIImageFrame*, nsRect&)
           1.13%  [.] nsDeque::PopFront()
           1.11%  [.] nsGlobalWindow::RunTimeout(nsTimeout*)
           0.97%  [.] nsXPConnect::Traverse(void*, nsCycleCollectionTraversalCallback&)
           0.95%  [.] nsJSEventListener::cycleCollection::Traverse(void*, nsCycleCollectionTraversalCallback&)
           0.95%  [.] nsCOMPtr_base::~nsCOMPtr_base()
      [acme@doppio ~]$
      
      Cc: Pekka Enberg <penberg@cs.helsinki.fi>
      Cc: Vegard Nossum <vegard.nossum@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Suggested-by: NClark Williams <williams@redhat.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <20090720171412.GB10410@ghostprotocols.net>
      28ac909b
  25. 12 7月, 2009 1 次提交
    • A
      perf_counter tools: PLT info is stripped in -debuginfo packages · a25e46c4
      Arnaldo Carvalho de Melo 提交于
      So we need to get the richer .symtab from the debuginfo
      packages but the PLT info from the original DSO where we have
      just the leaner .dynsym symtab.
      
      Example:
      
      | [acme@doppio pahole]$ perf report --sort comm,dso,symbol > before
      | [acme@doppio pahole]$ perf report --sort comm,dso,symbol > after
      | [acme@doppio pahole]$ diff -U1 before after
      | --- before	2009-07-11 11:04:22.688595741 -0300
      | +++ after	2009-07-11 11:04:33.380595676 -0300
      | @@ -80,3 +80,2 @@
      |       0.07%  pahole ./build/pahole              [.] pahole_stealer
      | -     0.06%  pahole /usr/lib64/libdw-0.141.so   [.] 0x00000000007140
      |       0.06%  pahole /usr/lib64/libdw-0.141.so   [.] __libdw_getabbrev
      | @@ -91,2 +90,3 @@
      |       0.06%  pahole [kernel]                    [k] free_hot_cold_page
      | +     0.06%  pahole /usr/lib64/libdw-0.141.so   [.] tfind@plt
      |       0.05%  pahole ./build/libdwarves.so.1.0.0 [.] ftype__add_parameter
      | @@ -242,2 +242,3 @@
      |       0.01%  pahole [kernel]                    [k] account_group_user_time
      | +     0.01%  pahole /usr/lib64/libdw-0.141.so   [.] strlen@plt
      |       0.01%  pahole ./build/pahole              [.] strcmp@plt
      | [acme@doppio pahole]$
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <1247325517-12272-4-git-send-email-acme@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      a25e46c4