1. 16 1月, 2010 3 次提交
    • A
      perf symbols: Use dso->long_name in dsos__find() · cf4e5b08
      Arnaldo Carvalho de Melo 提交于
      If not we end up duplicating the module DSOs because first we
      insert them using the short name found in /proc/modules, then,
      when processing synthesized MMAP events we add them again.
      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: <1263519930-22803-1-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      cf4e5b08
    • A
      perf symbols: Cache /proc/kallsyms files by build-id · 9e201442
      Arnaldo Carvalho de Melo 提交于
      So that when we don't have a vmlinux handy we can store the
      kallsyms for later use by 'perf report'.
      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: <1263501006-14185-3-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      9e201442
    • A
      perf symbols: Don't try to load kallsyms if doesn't match the record build-id · 8d0591f6
      Arnaldo Carvalho de Melo 提交于
      Now a perf.data file collected on a x86_64 fedora 12 machine
      gets properly parsed on a Debian testing PARISC64 machine with
      32-bit userland:
      
        acme@parisc:~/git/linux-2.6-tip$ perf report 2> /dev/null | head -15
        # Samples: 293085637
        #
        # Overhead          Command                      Shared Object  Symbol
        # ........  ...............  .................................  ......
        #
            35.11%             find  [kernel.kallsyms]                  [k] 0xffffffff81002b5a
            18.25%             perf  [kernel.kallsyms]                  [k] 0xffffffff8102235f
             9.07%             find  find                               [.] 0x0000000000fb0e
             5.80%          swapper  [kernel.kallsyms]                  [k] 0xffffffff8102235f
             3.29%             perf  libc-2.10.2.so                     [.] __GI_strcmp
             2.70%             find  libc-2.10.2.so                     [.] __GI_memmove
             2.33%             init  [kernel.kallsyms]                  [k] 0xffffffff810091b9
             2.03%             find  libc-2.10.2.so                     [.] _int_malloc
             1.67%             find  libc-2.10.2.so                     [.] _IO_vfprintf_internal
             1.65%             sshd  libcrypto.so.0.9.8k                [.] 0x00000000105440
        acme@parisc:~/git/linux-2.6-tip$
      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: <1263501006-14185-2-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      8d0591f6
  2. 14 1月, 2010 1 次提交
    • A
      perf tools: Encode kernel module mappings in perf.data · b7cece76
      Arnaldo Carvalho de Melo 提交于
      We were always looking at the running machine /proc/modules,
      even when processing a perf.data file, which only makes sense
      when we're doing 'perf record' and 'perf report' on the same
      machine, and in close sucession, or if we don't use modules at
      all, right Peter? ;-)
      
      Now, at 'perf record' time we read /proc/modules, find the long
      path for modules, and put them as PERF_MMAP events, just like we
      did to encode the reloc reference symbol for vmlinux. Talking
      about that now it is encoded in .pgoff, so that we can use
      .{start,len} to store the address boundaries for the kernel so
      that when we reconstruct the kmaps tree we can do lookups right
      away, without having to fixup the end of the kernel maps like we
      did in the past (and now only in perf record).
      
      One more step in the 'perf archive' direction when we'll finally
      be able to collect data in one machine and analyse in another.
      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: <1263396139-4798-1-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      b7cece76
  3. 13 1月, 2010 5 次提交
    • A
      perf symbols: Record the domain of DSOs in HEADER_BUILD_ID header table · a89e5abe
      Arnaldo Carvalho de Melo 提交于
      So that we can restore them to the right DSO list (either
      dsos__kernel or dsos__user).
      
      We do that just like the kernel does for the other events,
      encoding PERF_RECORD_MISC_{KERNEL,USER} in perf_event_header.
      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: <1262901583-8074-2-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      a89e5abe
    • A
      perf tools: Handle relocatable kernels · 56b03f3c
      Arnaldo Carvalho de Melo 提交于
      DSOs don't have this problem because the kernel emits a
      PERF_MMAP for each new executable mapping it performs on
      monitored threads.
      
      To fix the kernel case we simulate the same behaviour, by having
      'perf record' to synthesize a PERF_MMAP for the kernel, encoded
      like this:
      
      [root@doppio ~]# perf record -a -f sleep 1
      [ perf record: Woken up 1 times to write data ]
      [ perf record: Captured and wrote 0.344 MB perf.data (~15038 samples) ]
      [root@doppio ~]# perf report -D | head -10
      
      0xd0 [0x40]: event: 1
      .
      . ... raw event: size 64 bytes
      .  0000:  01 00 00 00 00 00 40 00 00 00 00 00 00 00 00 00 ......@........
      .  0010:  00 00 00 81 ff ff ff ff 00 00 00 00 00 00 00 00 ...............
      .  0020:  00 00 00 00 00 00 00 00 5b 6b 65 72 6e 65 6c 2e ........  [kernel
      .  0030:  6b 61 6c 6c 73 79 6d 73 2e 5f 74 65 78 74 5d 00  kallsyms._text]
      .  0xd0
      [0x40]: PERF_RECORD_MMAP 0/0: [0xffffffff81000000((nil)) @ (nil)]: [kernel.kallsyms._text]
      
      I.e. we identify such event as having:
      
       .pid      = 0
       .filename = [kernel.kallsyms.REFNAME]
       .start    = REFNAME addr in /proc/kallsyms at 'perf record' time
      
      and use now a hardcoded value of '.text' for REFNAME.
      
      Then, later, in 'perf report', if there are any kernel hits and
      thus we need to resolve kernel symbols, we search for REFNAME
      and if its address changed, relocation happened and we thus must
      change the kernel mapping routines to one that uses .pgoff as
      the relocation to apply.
      
      This way we use the same mechanism used for the other DSOs and
      don't have to do a two pass in all the kernel symbols.
      Reported-by: NXiao Guangrong <xiaoguangrong@cn.fujitsu.com>
      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: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
      LKML-Reference: <1262717431-1246-1-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      56b03f3c
    • A
      perf session: Keep pointers to the vmlinux maps · de176489
      Arnaldo Carvalho de Melo 提交于
      So that tools such as 'perf probe' don't have to lookup
      '[kernel.kallsyms]' but instead access them directly after
      perf_session__create_kernel_maps or
      map_groups__create_kernel_maps.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Masami Hiramatsu <mhiramat@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: <1262629169-22797-4-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      de176489
    • A
      perf symbols: Export symbol_type__is_a · 36a3e646
      Arnaldo Carvalho de Melo 提交于
      Will be needed by the new HEADER_DSO_INFO feature that will be a
      HEADER_BUILD_ID superset, replacing it.
      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: <1262629169-22797-2-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      36a3e646
    • A
      perf symbols: Generalise the kallsyms parsing routine · 682b335a
      Arnaldo Carvalho de Melo 提交于
      Will be used to find an specific symbol by name on 'perf record'
      to support relocation reference symbols to support relocatable
      kernels.
      
      Still have to conver the perf trace tools to use it instead of
      their current reimplementation.
      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: <1262629169-22797-1-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      682b335a
  4. 28 12月, 2009 1 次提交
    • A
      perf record: Introduce a symtab cache · 4cf40131
      Arnaldo Carvalho de Melo 提交于
      Now a cache will be created in a ~/.debug debuginfo like
      hierarchy, so that at the end of a 'perf record' session all the
      binaries (with build-ids) involved get collected and indexed by
      their build-ids, so that perf report can find them.
      
      This is interesting when developing software where you want to
      do a 'perf diff' with the previous build and opens avenues for
      lots more interesting tools, like a 'perf diff --graph' that
      takes more than two binaries into account.
      
      Tunables for collecting just the symtabs can be added if one
      doesn't want to have the full binary, but having the full binary
      allows things like 'perf rerecord' or other tools that can
      re-run the tests by having access to the exact binary in some
      perf.data file, so it may well be interesting to keep the full
      binary there.
      
      Space consumption is minimised by trying to use hard links, a
      'perf cache' tool to manage the space used, a la ccache is
      required to purge older entries.
      
      With this in place it will be possible also to introduce new
      commands, 'perf archive' and 'perf restore' (or some more
      suitable and future proof names) to create a cpio/tar file with
      the perf data and the files in the cache that _had_ perf hits of
      interest.
      
      There are more aspects to polish, like finding the right vmlinux
      file to cache, etc, but this is enough for a first step.
      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: <1261957026-15580-10-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      4cf40131
  5. 16 12月, 2009 4 次提交
  6. 14 12月, 2009 1 次提交
    • A
      perf session: Move kmaps to perf_session · 4aa65636
      Arnaldo Carvalho de Melo 提交于
      There is still some more work to do to disentangle map creation
      from DSO loading, but this happens only for the kernel, and for
      the early adopters of perf diff, where this disentanglement
      matters most, we'll be testing different kernels, so no problem
      here.
      
      Further clarification: right now we create the kernel maps for
      the various modules and discontiguous kernel text maps when
      loading the DSO, we should do it as a two step process, first
      creating the maps, for multiple mappings with the same DSO
      store, then doing the dso load just once, for the first hit on
      one of the maps sharing this DSO backing store.
      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: <1260741029-4430-6-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      4aa65636
  7. 12 12月, 2009 6 次提交
    • A
      perf symbols: Ditch dso->find_symbol · ea08d8cb
      Arnaldo Carvalho de Melo 提交于
      It is always wired to dso__find_symbol.
      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: <1260564999-13371-1-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      ea08d8cb
    • A
      perf symbols: Allow lookups by symbol name too · 79406cd7
      Arnaldo Carvalho de Melo 提交于
      Configurable via symbol_conf.sort_by_name, so that the cost of an
      extra rb_node on all 'struct symbol' instances is not paid by tools
      that only want to decode addresses.
      
      How to use it:
      
      	symbol_conf.sort_by_name = true;
      	symbol_init(&symbol_conf);
      
      	struct map *map = map_groups__find_by_name(kmaps, MAP__VARIABLE, "[kernel.kallsyms]");
      
      	if (map == NULL) {
      		pr_err("couldn't find map!\n");
      		kernel_maps__fprintf(stdout);
      	} else {
      		struct symbol *sym = map__find_symbol_by_name(map, sym_filter, NULL);
      		if (sym == NULL)
      			pr_err("couldn't find symbol %s!\n", sym_filter);
      		else
      			pr_info("symbol %s: %#Lx-%#Lx \n", sym_filter, sym->start, sym->end);
      	}
      
      Looking over the vmlinux/kallsyms is common enough that I'll add a
      variable to the upcoming struct perf_session to avoid the need to
      use map_groups__find_by_name to get the main vmlinux/kallsyms map.
      
      The above example looks on the 'variable' symtab, but it is just
      like that for the functions one.
      
      Also the sort operation is done when we first use
      map__find_symbol_by_name, in a lazy way.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1260564622-12392-1-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      79406cd7
    • A
      perf symbols: Add support for 'variable' symtabs · f1dfa0b1
      Arnaldo Carvalho de Melo 提交于
      Example:
      
      {
      	u64 addr = strtoull(sym_filter, NULL, 16);
      	struct map *map = map_groups__find(kmaps, MAP__VARIABLE, addr);
      
      	if (map == NULL)
      		pr_err("couldn't find map!\n");
      	else {
      		struct symbol *sym = map__find_symbol(map, addr, NULL);
      		if (sym == NULL)
      			pr_err("couldn't find addr!\n");
      		else
      			pr_info("addr %#Lx is in %s global var\n", addr, sym->name);
      	}
      	exit(0);
      }
      
      Added just after symbol__init() call in 'perf top', then:
      
      {
              u64 addr = strtoull(sym_filter, NULL, 16);
              struct map *map = map_groups__find(kmaps, MAP__VARIABLE, addr);
      
              if (map == NULL)
                      pr_err("couldn't find map!\n");
              else {
                      struct symbol *sym = map__find_symbol(map, addr, NULL);
                      if (sym == NULL)
                              pr_err("couldn't find addr!\n");
                      else
                              pr_info("addr %#Lx is in %s global var\n", addr, sym->name);
              }
              exit(0);
      }
      
      [root@doppio linux-2.6-tip]# grep ' [dD] ' /proc/kallsyms | grep ' sched'
      ffffffff817827d8 d sched_nr_latency
      ffffffff81782ce0 d sched_domains_mutex
      ffffffff8178c070 d schedstr.22423
      ffffffff817909a0 d sched_register_mutex
      ffffffff81823490 d sched_feat_names
      ffffffff81823558 d scheduler_running
      ffffffff818235b8 d sched_clock_running
      ffffffff818235bc D sched_clock_stable
      ffffffff81824f00 d sched_switch_trace
      [root@doppio linux-2.6-tip]# perf top -s 0xffffffff817827d9
      addr 0xffffffff817827d9 is in sched_nr_latency global var
      [root@doppio linux-2.6-tip]# perf top -s ffffffff81782ce0
      addr 0xffffffff81782ce0 is in sched_domains_mutex global var
      [root@doppio linux-2.6-tip]#
      [root@doppio linux-2.6-tip]# perf top -s ffffffff81782ce0 --vmlinux OFF
      The file OFF cannot be used, trying to use /proc/kallsyms...addr 0xffffffff81782ce0 is in sched_domains_mutex global var
      [root@doppio linux-2.6-tip]# perf top -s ffffffff818235bc --vmlinux OFF
      The file OFF cannot be used, trying to use /proc/kallsyms...addr 0xffffffff818235bc is in sched_clock_stable global var
      [root@doppio linux-2.6-tip]#
      
      So it works with both /proc/kallsyms and with ELF symtabs, either
      the one on the vmlinux explicitely passed via --vmlinux or in one
      in the vmlinux_path that matches the buildid for the running kernel
      or the one found in the buildid header section in a perf.data file.
      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: <1260550239-5372-4-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      f1dfa0b1
    • A
      perf symbols: Introduce ELF counterparts to symbol_type__is_a · d45868d3
      Arnaldo Carvalho de Melo 提交于
      For selecting the right types of symbols in ELF symtabs.
      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: <1260550239-5372-3-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      d45868d3
    • A
      perf symbols: Introduce symbol_type__is_a · 6893d4ee
      Arnaldo Carvalho de Melo 提交于
      For selecting the right types of symbols in /proc/kallsyms, will be
      followed by elf_symbol_type__is_a, for the same purpose on ELF
      symtabs.
      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: <1260550239-5372-2-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      6893d4ee
    • A
      perf symbols: Rename kthreads to kmaps, using another abstraction for it · 9958e1f0
      Arnaldo Carvalho de Melo 提交于
      Using a struct thread instance just to hold the kernel space maps
      (vmlinux + modules) is overkill and confuses people trying to
      understand the perf symbols abstractions.
      
      The kernel maps are really present in all threads, i.e. the kernel
      is a library, not a separate thread.
      
      So introduce the 'map_groups' abstraction and use it for the kernel
      maps, now in the kmaps global variable.
      
      It, in turn, will move, together with the threads list to the
      perf_file abstraction, so that we can support multiple perf_file
      instances, needed by perf diff.
      
      Brainstormed-with: Eduardo Habkost <ehabkost@redhat.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Eduardo Habkost <ehabkost@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: <1260550239-5372-1-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      9958e1f0
  8. 10 12月, 2009 1 次提交
  9. 28 11月, 2009 11 次提交
    • A
      perf tools: Consolidate symbol resolving across all tools · 1ed091c4
      Arnaldo Carvalho de Melo 提交于
      Now we have a very high level routine for simple tools to
      process IP sample events:
      
      	int event__preprocess_sample(const event_t *self,
      				     struct addr_location *al,
      				     symbol_filter_t filter)
      
      It receives the event itself and will insert new threads in the
      global threads list and resolve the map and symbol, filling all
      this info into the new addr_location struct, so that tools like
      annotate and report can further process the event by creating
      hist_entries in their specific way (with or without callgraphs,
      etc).
      
      It in turn uses the new next layer function:
      
      	void thread__find_addr_location(struct thread *self, u8 cpumode,
      					enum map_type type, u64 addr,
      					struct addr_location *al,
      					symbol_filter_t filter)
      
      This one will, given a thread (userspace or the kernel kthread
      one), will find the given type (MAP__FUNCTION now, MAP__VARIABLE
      too in the near future) at the given cpumode, taking vdsos into
      account (userspace hit, but kernel symbol) and will fill all
      these details in the addr_location given.
      
      Tools that need a more compact API for plain function
      resolution, like 'kmem', can use this other one:
      
      	struct symbol *thread__find_function(struct thread *self, u64 addr,
      					     symbol_filter_t filter)
      
      So, to resolve a kernel symbol, that is all the 'kmem' tool
      needs, its just a matter of calling:
      
      	sym = thread__find_function(kthread, addr, NULL);
      
      The 'filter' parameter is needed because we do lazy
      parsing/loading of ELF symtabs or /proc/kallsyms.
      
      With this we remove more code duplication all around, which is
      always good, huh? :-)
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: John Kacur <jkacur@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1259346563-12568-12-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      1ed091c4
    • A
      perf symbols: When not using modules, discard its symbols · 1de8e245
      Arnaldo Carvalho de Melo 提交于
      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: <1259346563-12568-10-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      1de8e245
    • A
      perf symbols: Support multiple symtabs in struct thread · 95011c60
      Arnaldo Carvalho de Melo 提交于
      Making the routines that were so far specific to the kernel maps
      useful for all threads.
      
      This is done by making the kernel maps be contained in a kernel
      "thread".
      
      This gets the kernel specific routines closer to the userspace
      counterparts, which will help in reducing the boilerplate for
      resolving a symbol, as will be demonstrated in the next patches.
      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: <1259346563-12568-9-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      95011c60
    • A
      perf symbols: Kernel_maps should be an array of MAP__NR_TYPES entries · 23ea4a3f
      Arnaldo Carvalho de Melo 提交于
      So that we can support multiple symbol table types.
      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: <1259346563-12568-8-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      23ea4a3f
    • A
      perf symbols: Make the kallsyms loading routines part of the dso class · 4e06255f
      Arnaldo Carvalho de Melo 提交于
      So that the kallsyms loading routines are the direct counterpart
      of the vmlinux loading ones, i.e. dso__load_kallsyms is the
      counterpart of dso__load_vmlinux.
      
      In the process make them also use the symbols rb tree indexed by
      map->type, paving the way for supporting other types of symtabs,
      such as the next one to be supported: variables.
      
      This also allowed removal of yet another global variable:
      kernel_map__functions.
      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: <1259346563-12568-7-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      4e06255f
    • A
      perf symbols: Better support for multiple symbol tables per dso · 6a4694a4
      Arnaldo Carvalho de Melo 提交于
      By using an array of rb_roots in struct dso we can, from a
      struct map instance to get the right symbol rb_tree more easily.
      This way we can have just one symbol lookup method for struct
      map instances, map__find_symbol, instead of one per symtab type
      (functions, variables).
      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: <1259346563-12568-6-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      6a4694a4
    • A
      perf symbols: Add a 'type' field to struct map · 3610583c
      Arnaldo Carvalho de Melo 提交于
      That way we will be able to check if the right symtab is loaded
      in the underlying DSO.
      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: <1259346563-12568-5-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      3610583c
    • A
      perf symbols: Unexport kernel_map__functions · 605ca4ba
      Arnaldo Carvalho de Melo 提交于
      perf annotate was the only user, and it doesn't really need it.
      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: <1259346563-12568-4-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      605ca4ba
    • A
      perf symbols: Split the dsos list into kernel and user parts · b0da954a
      Arnaldo Carvalho de Melo 提交于
      We don't need to look at modules in dsos__findnew because the
      kernel events come only with user DSOs. Also we need a way to
      list just the module DSOs so that we can create multiple sets of
      maps, now that we will support maps for the variables in a
      symtab.
      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: <1259346563-12568-3-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      b0da954a
    • A
      perf symbols: Rename kernel_mapto kernel_map[s]__functions · 61f37a82
      Arnaldo Carvalho de Melo 提交于
      As we'll have kernel_map[s]__variables too.
      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: <1259346563-12568-2-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      61f37a82
    • A
      perf symbols: Avoid annoying message about loading symbols · 3f5ee186
      Arnaldo Carvalho de Melo 提交于
      This should be properly fixed when we remove the XXX comment in
      'perf report', function resolve_symbol.
      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: <1259346563-12568-1-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      3f5ee186
  10. 24 11月, 2009 4 次提交
  11. 23 11月, 2009 1 次提交
  12. 22 11月, 2009 2 次提交
    • P
      perf symbols: Fix ELF header errors during "perf kmem record" · e57cfcda
      Pekka Enberg 提交于
      The write_event() function in builtin-record.c writes out all
      mmap()'d DSOs including non-ELF files like GNOME resource files
      and such.
      
      Therefore, check for ELF_K_ELF in filename__read_build_id()
      before attempting to read the ELF header with gelf_getehdr().
      
      Fixes the following error messages when running "perf kmem
      record":
      
        penberg@penberg-laptop:~/src/linux/tools/perf$ perf kmem record
        ^C[ perf record: Woken up 2 times to write data ]
        [ perf record: Captured and wrote 0.753 MB perf.data (~32885 samples) ]
        filename__read_build_id: cannot get elf header.
        filename__read_build_id: cannot get elf header.
        filename__read_build_id: cannot get elf header.
        filename__read_build_id: cannot get elf header.
        filename__read_build_id: cannot get elf header.
        filename__read_build_id: cannot get elf header.
        filename__read_build_id: cannot get elf header.
        filename__read_build_id: cannot get elf header.
        filename__read_build_id: cannot get elf header.
      Signed-off-by: NPekka Enberg <penberg@cs.helsinki.fi>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <1258885784-11709-1-git-send-email-penberg@cs.helsinki.fi>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      e57cfcda
    • A
      perf symbols: Old versions of elf.h don't have NT_GNU_BUILD_ID · c12e15e7
      Arnaldo Carvalho de Melo 提交于
      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: <1258821086-11521-2-git-send-email-acme@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      c12e15e7