1. 13 8月, 2020 1 次提交
  2. 28 5月, 2020 1 次提交
  3. 23 3月, 2020 1 次提交
    • L
      perf symbols: Consolidate symbol fixup issue · 7eec00a7
      Leo Yan 提交于
      After copying Arm64's perf archive with object files and perf.data file
      to x86 laptop, the x86's perf kernel symbol resolution fails.  It
      outputs 'unknown' for all symbols parsing.
      
      This issue is root caused by the function elf__needs_adjust_symbols(),
      x86 perf tool uses one weak version, Arm64 (and powerpc) has rewritten
      their own version.  elf__needs_adjust_symbols() decides if need to parse
      symbols with the relative offset address; but x86 building uses the weak
      function which misses to check for the elf type 'ET_DYN', so that it
      cannot parse symbols in Arm DSOs due to the wrong result from
      elf__needs_adjust_symbols().
      
      The DSO parsing should not depend on any specific architecture perf
      building; e.g. x86 perf tool can parse Arm and Arm64 DSOs, vice versa.
      And confirmed by Naveen N. Rao that powerpc64 kernels are not being
      built as ET_DYN anymore and change to ET_EXEC.
      
      This patch removes the arch specific functions for Arm64 and powerpc and
      changes elf__needs_adjust_symbols() as a common function.
      
      In the common elf__needs_adjust_symbols(), it checks an extra condition
      'ET_DYN' for elf header type.  With this fixing, the Arm64 DSO can be
      parsed properly with x86's perf tool.
      
      Before:
      
        # perf script
        main 3258 1 branches:                0 [unknown] ([unknown]) => ffff800010c4665c [unknown] ([kernel.kallsyms])
        main 3258 1 branches: ffff800010c46670 [unknown] ([kernel.kallsyms]) => ffff800010c4eaec [unknown] ([kernel.kallsyms])
        main 3258 1 branches: ffff800010c4eaec [unknown] ([kernel.kallsyms]) => ffff800010c4eb00 [unknown] ([kernel.kallsyms])
        main 3258 1 branches: ffff800010c4eb08 [unknown] ([kernel.kallsyms]) => ffff800010c4e780 [unknown] ([kernel.kallsyms])
        main 3258 1 branches: ffff800010c4e7a0 [unknown] ([kernel.kallsyms]) => ffff800010c4eeac [unknown] ([kernel.kallsyms])
        main 3258 1 branches: ffff800010c4eebc [unknown] ([kernel.kallsyms]) => ffff800010c4ed80 [unknown] ([kernel.kallsyms])
      
      After:
      
        # perf script
        main 3258 1 branches:                0 [unknown] ([unknown]) => ffff800010c4665c coresight_timeout+0x54 ([kernel.kallsyms])
        main 3258 1 branches: ffff800010c46670 coresight_timeout+0x68 ([kernel.kallsyms]) => ffff800010c4eaec etm4_enable_hw+0x3cc ([kernel.kallsyms])
        main 3258 1 branches: ffff800010c4eaec etm4_enable_hw+0x3cc ([kernel.kallsyms]) => ffff800010c4eb00 etm4_enable_hw+0x3e0 ([kernel.kallsyms])
        main 3258 1 branches: ffff800010c4eb08 etm4_enable_hw+0x3e8 ([kernel.kallsyms]) => ffff800010c4e780 etm4_enable_hw+0x60 ([kernel.kallsyms])
        main 3258 1 branches: ffff800010c4e7a0 etm4_enable_hw+0x80 ([kernel.kallsyms]) => ffff800010c4eeac etm4_enable+0x2d4 ([kernel.kallsyms])
        main 3258 1 branches: ffff800010c4eebc etm4_enable+0x2e4 ([kernel.kallsyms]) => ffff800010c4ed80 etm4_enable+0x1a8 ([kernel.kallsyms])
      
      v3: Changed to check for ET_DYN across all architectures.
      
      v2: Fixed Arm64 and powerpc native building.
      Reported-by: NMike Leach <mike.leach@linaro.org>
      Signed-off-by: NLeo Yan <leo.yan@linaro.org>
      Reviewed-by: NNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Acked-by: NJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Allison Randal <allison@lohutok.net>
      Cc: Enrico Weigelt <info@metux.net>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Kate Stewart <kstewart@linuxfoundation.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Thomas Richter <tmricht@linux.vnet.ibm.com>
      Link: http://lore.kernel.org/lkml/20200306015759.10084-1-leo.yan@linaro.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      7eec00a7
  4. 21 12月, 2019 1 次提交
    • A
      perf map: Set kmap->kmaps backpointer for main kernel map chunks · a75af86b
      Arnaldo Carvalho de Melo 提交于
      When a map is create to represent the main kernel area (vmlinux) with
      map__new2() we allocate an extra area to store a pointer to the 'struct
      maps' for the kernel maps, so that we can access that struct when
      loading ELF files or kallsyms, as we will need to split it in multiple
      maps, one per kernel module or ELF section (such as ".init.text").
      
      So when map->dso->kernel is non-zero, it is expected that
      map__kmap(map)->kmaps to be set to the tree of kernel maps (modules,
      chunks of the main kernel, bpf progs put in place via
      PERF_RECORD_KSYMBOL, the main kernel).
      
      This was not the case when we were splitting the main kernel into chunks
      for its ELF sections, which ended up making 'perf report --children'
      processing a perf.data file with callchains to trip on
      __map__is_kernel(), when we press ENTER to see the popup menu for main
      histogram entries that starts at a symbol in the ".init.text" ELF
      section, e.g.:
      
      -    8.83%     0.00%  swapper     [kernel.vmlinux].init.text  [k] start_kernel
           start_kernel
           cpu_startup_entry
           do_idle
           cpuidle_enter
           cpuidle_enter_state
           intel_idle
      
      Fix it.
      Reviewed-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/lkml/20191218190120.GB13282@kernel.org/Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      a75af86b
  5. 26 11月, 2019 2 次提交
  6. 12 11月, 2019 1 次提交
    • A
      perf symbols: Stop using map->groups, we can use kmaps instead · f2baa060
      Arnaldo Carvalho de Melo 提交于
      To test that that function is being called I just added a probe on that
      place, enabled it via 'perf trace' asking for at most 16 levels of
      backtraces, system wide, and then ran 'perf top' on another xterm,
      voilà:
      
        # perf probe -x ~/bin/perf dso__process_kernel_symbol
        Added new event:
          probe_perf:dso__process_kernel_symbol (on dso__process_kernel_symbol in /home/acme/bin/perf)
      
        You can now use it in all perf tools, such as:
      
        	perf record -e probe_perf:dso__process_kernel_symbol -aR sleep 1
      
        # perf trace -e probe_perf:dso__process_kernel_symbol/max-stack=16/ --max-events=2
        # perf trace -e probe_perf:dso__process_kernel_symbol/max-stack=16/ --max-events=2
             0.000 :17345/17345 probe_perf:dso__process_kernel_symbol(__probe_ip: 5680224)
                                               dso__process_kernel_symbol (/home/acme/bin/perf)
                                               dso__load_vmlinux (/home/acme/bin/perf)
                                               dso__load_vmlinux_path (/home/acme/bin/perf)
                                               dso__load (/home/acme/bin/perf)
                                               map__load (/home/acme/bin/perf)
                                               thread__find_map (/home/acme/bin/perf)
                                               machine__resolve (/home/acme/bin/perf)
                                               deliver_event (/home/acme/bin/perf)
                                               __ordered_events__flush.part.0 (/home/acme/bin/perf)
                                               process_thread (/home/acme/bin/perf)
                                               start_thread (/usr/lib64/libpthread-2.29.so)
             0.064 :17345/17345 probe_perf:dso__process_kernel_symbol(__probe_ip: 5680224)
                                               dso__process_kernel_symbol (/home/acme/bin/perf)
                                               dso__load_vmlinux (/home/acme/bin/perf)
                                               dso__load_vmlinux_path (/home/acme/bin/perf)
                                               dso__load (/home/acme/bin/perf)
                                               map__load (/home/acme/bin/perf)
                                               thread__find_map (/home/acme/bin/perf)
                                               machine__resolve (/home/acme/bin/perf)
                                               deliver_event (/home/acme/bin/perf)
                                               __ordered_events__flush.part.0 (/home/acme/bin/perf)
                                               process_thread (/home/acme/bin/perf)
                                               start_thread (/usr/lib64/libpthread-2.29.so)
        #
        # perf stat -e probe_perf:dso__process_kernel_symbol
        ^C
         Performance counter stats for 'system wide':
      
                 107,308      probe_perf:dso__process_kernel_symbol
      
             8.215399813 seconds time elapsed
        #
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-5fy66x5hr5ct9pmw84jkiwvm@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f2baa060
  7. 25 9月, 2019 1 次提交
  8. 20 9月, 2019 2 次提交
  9. 01 9月, 2019 2 次提交
  10. 09 7月, 2019 4 次提交
  11. 26 6月, 2019 2 次提交
  12. 05 6月, 2019 1 次提交
  13. 06 2月, 2019 2 次提交
  14. 05 2月, 2019 2 次提交
    • J
      perf symbols: Filter out hidden symbols from labels · 59a17706
      Jiri Olsa 提交于
      When perf is built with the annobin plugin (RHEL8 build) extra symbols
      are added to its binary:
      
        # nm perf | grep annobin | head -10
        0000000000241100 t .annobin_annotate.c
        0000000000326490 t .annobin_annotate.c
        0000000000249255 t .annobin_annotate.c_end
        00000000003283a8 t .annobin_annotate.c_end
        00000000001bce18 t .annobin_annotate.c_end.hot
        00000000001bce18 t .annobin_annotate.c_end.hot
        00000000001bc3e2 t .annobin_annotate.c_end.unlikely
        00000000001bc400 t .annobin_annotate.c_end.unlikely
        00000000001bce18 t .annobin_annotate.c.hot
        00000000001bce18 t .annobin_annotate.c.hot
        ...
      
      Those symbols have no use for report or annotation and should be
      skipped.  Moreover they interfere with the DWARF unwind test on the PPC
      arch, where they are mixed with checked symbols and then the test fails:
      
        # perf test dwarf -v
        59: Test dwarf unwind                                     :
        --- start ---
        test child forked, pid 8515
        unwind: .annobin_dwarf_unwind.c:ip = 0x10dba40dc (0x2740dc)
        ...
        got: .annobin_dwarf_unwind.c 0x10dba40dc, expecting test__arch_unwind_sample
        unwind: failed with 'no error'
      
      The annobin symbols are defined as NOTYPE/LOCAL/HIDDEN:
      
        # readelf -s ./perf | grep annobin | head -1
          40: 00000000001bce4f     0 NOTYPE  LOCAL  HIDDEN    13 .annobin_init.c
      
      They can still pass the check for the label symbol. Adding check for
      HIDDEN and INTERNAL (as suggested by Nick below) visibility and filter
      out such symbols.
      
      >   Just to be awkward, if you are going to ignore STV_HIDDEN
      >   symbols then you should probably also ignore STV_INTERNAL ones
      >   as well...  Annobin does not generate them, but you never know,
      >   one day some other tool might create some.
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nick Clifton <nickc@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20190128133526.GD15461@kravaSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      59a17706
    • A
      perf symbols: Add fallback definitions for GELF_ST_VISIBILITY() · 843cf70e
      Arnaldo Carvalho de Melo 提交于
      Those aren't present in Alpine Linux 3.4 to edge, so provide fallback
      defines to get the next patch building there keeping the build
      bisectable.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nick Clifton <nickc@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lkml.kernel.org/n/tip-03cg3gya2ju4ba2x6ibb9fuz@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      843cf70e
  15. 18 10月, 2018 1 次提交
  16. 24 9月, 2018 1 次提交
  17. 23 5月, 2018 8 次提交
  18. 28 4月, 2018 1 次提交
  19. 27 4月, 2018 6 次提交