1. 01 Sep, 2016 11 commits
    • Arnaldo Carvalho de Melo's avatar
      perf symbols: Check symbol_conf.allow_aliases for kallsyms loading too · c97b40e4
      Arnaldo Carvalho de Melo authored
      We can allow aliases to be kept, but we were checking this just when
      loading vmlinux files, be consistent, do it for any symbol table loading
      code that calls symbol__fixup_duplicate() by making this function check
      .allow_aliases instead.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Fixes: 680d926a ("perf symbols: Allow symbol alias when loading map for symbol name")
      Link: http://lkml.kernel.org/n/tip-z0avp0s6cfjckc4xj3pdfjdz@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c97b40e4
    • Arnaldo Carvalho de Melo's avatar
      perf test vmlinux: Tolerate symbol aliases · 7e1b6595
      Arnaldo Carvalho de Melo authored
      The algorithms used to prune aliases in symbols__fixup_duplicate() uses
      information available on ELF symtabs that are not present on
      /proc/kallsyms, so it picks different aliases as "best" for vmlinux and
      kallsyms.
      
      We could probably improve a bit this by having a list of aliases for the
      "best" symbols picked, instead of throwing this info, but that is left
      for when we find a real need.
      
      With this, 'perf test vmlinux' passes:
      
        # perf test -F 1
         1: vmlinux symtab matches kallsyms: Ok
        #
      
      When we ask for verbose mode, we can see those warning:
      
        # perf test -F -v 1
         1: vmlinux symtab matches kallsyms:
        --- start ---
        Looking at the vmlinux_path (8 entries long)
        Using /lib/modules/4.8.0-rc4+/build/vmlinux for symbols
        WARN: 0xffffffffb7001000: diff name v: xen_hypercall_set_trap_table k: hypercall_page
        WARN: 0xffffffffb7077970: diff end addr for aesni_gcm_dec v: 0xffffffffb707a2f2 k: 0xffffffffb7077a02
        WARN: 0xffffffffb707a300: diff end addr for aesni_gcm_enc v: 0xffffffffb707cc03 k: 0xffffffffb707a392
        WARN: 0xffffffffb707f950: diff end addr for aesni_gcm_enc_avx_gen2 v: 0xffffffffb7084ef6 k: 0xffffffffb707f9c3
        WARN: 0xffffffffb7084f00: diff end addr for aesni_gcm_dec_avx_gen2 v: 0xffffffffb708a691 k: 0xffffffffb7084f73
        WARN: 0xffffffffb708aa10: diff end addr for aesni_gcm_enc_avx_gen4 v: 0xffffffffb708f844 k: 0xffffffffb708aa83
        WARN: 0xffffffffb708f850: diff end addr for aesni_gcm_dec_avx_gen4 v: 0xffffffffb709486f k: 0xffffffffb708f8c3
        WARN: 0xffffffffb71a6e50: diff name v: perf_pmu_commit_txn.part.98 k: perf_pmu_cancel_txn.part.97
        WARN: 0xffffffffb752e480: diff name v: wakeup_expire_count_show.part.5 k: wakeup_active_count_show.part.7
        WARN: 0xffffffffb76e8d00: diff name v: phys_switch_id_show.part.11 k: phys_port_name_show.part.12
        WARN: Maps only in vmlinux:
         ffffffffb7d7d000-ffffffffb7eeaac8 117d000 [kernel].init.text
         ffffffffb7eeaac8-ffffffffc03ad000 12eaac8 [kernel].exit.text
        ---- end ----
        vmlinux symtab matches kallsyms: Ok
        #
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-6v5w1k8rpx4ggczlkw730vt0@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7e1b6595
    • Arnaldo Carvalho de Melo's avatar
      perf test vmlinux: Avoid printing headers for empty lists · 54da0769
      Arnaldo Carvalho de Melo authored
      Before:
      
        # perf test -F -v 1
         1: vmlinux symtab matches kallsyms:
        --- start ---
      <SNIP>
        WARN: Maps only in vmlinux:
         ffffffffb7d7d000-ffffffffb7eeaac8 117d000 [kernel].init.text
         ffffffffb7eeaac8-ffffffffc03ad000 12eaac8 [kernel].exit.text
        WARN: Maps in vmlinux with a different name in kallsyms:
        WARN: Maps only in kallsyms:
        ---- end ----
        vmlinux symtab matches kallsyms: Ok
        #
      
      The two last WARN lines are now suppressed, since there are no such
      cases detected.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-9ww8uvzl682ykaw8ht1tozlr@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      54da0769
    • Arnaldo Carvalho de Melo's avatar
      perf test vmlinux: Clarify which -v lines are errors or warning · e267769e
      Arnaldo Carvalho de Melo authored
      When the 'perf test -v vmlinux' test fails, it is not clear which of the
      lines are errors or warnings, clarify that adding ERR/WARN prefixes:
      
        # perf test -F -v 1
         1: vmlinux symtab matches kallsyms                          :
        --- start ---
        Looking at the vmlinux_path (8 entries long)
        Using /lib/modules/4.8.0-rc4+/build/vmlinux for symbols
        ERR : 0xffffffffb7001000: diff name v: xen_hypercall_set_trap_table k: hypercall_page
        WARN: 0xffffffffb7077970: diff end addr for aesni_gcm_dec v: 0xffffffffb707a2f2 k: 0xffffffffb7077a02
        WARN: 0xffffffffb707a300: diff end addr for aesni_gcm_enc v: 0xffffffffb707cc03 k: 0xffffffffb707a392
        WARN: 0xffffffffb707f950: diff end addr for aesni_gcm_enc_avx_gen2 v: 0xffffffffb7084ef6 k: 0xffffffffb707f9c3
        WARN: 0xffffffffb7084f00: diff end addr for aesni_gcm_dec_avx_gen2 v: 0xffffffffb708a691 k: 0xffffffffb7084f73
        WARN: 0xffffffffb708aa10: diff end addr for aesni_gcm_enc_avx_gen4 v: 0xffffffffb708f844 k: 0xffffffffb708aa83
        WARN: 0xffffffffb708f850: diff end addr for aesni_gcm_dec_avx_gen4 v: 0xffffffffb709486f k: 0xffffffffb708f8c3
        ERR : 0xffffffffb71a6e50: diff name v: perf_pmu_commit_txn.part.98 k: perf_pmu_cancel_txn.part.97
        ERR : 0xffffffffb752e480: diff name v: wakeup_expire_count_show.part.5 k: wakeup_active_count_show.part.7
        ERR : 0xffffffffb76e8d00: diff name v: phys_switch_id_show.part.11 k: phys_port_name_show.part.12
        WARN: Maps only in vmlinux:
         ffffffffb7d7d000-ffffffffb7eeaac8 117d000 [kernel].init.text
         ffffffffb7eeaac8-ffffffffc03ad000 12eaac8 [kernel].exit.text
        WARN: Maps in vmlinux with a different name in kallsyms:
        WARN: Maps only in kallsyms:
        ---- end ----
        vmlinux symtab matches kallsyms: FAILED!
        #
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-n5ml8m7y9x8kzvxt09ipku88@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e267769e
    • Masami Hiramatsu's avatar
      perf probe: Ignore vmlinux Build-id when offline vmlinux given · e50243bb
      Masami Hiramatsu authored
      Ignore vmlinux build-id when user gives offline vmlinux if the command
      does not affect running kernel.
      
      perf-probe has several actions some of them does not change the running
      kernel, like --lines, --vars, and --funcs.
      
      e.g.
        -----
        $ ./perf probe -k ./vmlinux-arm -V do_sys_open:14
        Available variables at do_sys_open:14
                @<do_sys_open+202>
                        char*   filename
                        int     dfd
                        int     fd
                        int     flags
                        struct filename*        tmp
                        struct open_flags       op
                        umode_t mode
        -----
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/147222347320.5088.2582658035296667520.stgit@devboxSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e50243bb
    • Masami Hiramatsu's avatar
      perf probe: Support probing on offline cross-arch binary · 293d5b43
      Masami Hiramatsu authored
      Support probing on offline cross-architecture binary by adding getting
      the target machine arch from ELF and choose correct register string for
      the machine.
      
      Here is an example:
        -----
        $ perf probe --vmlinux=./vmlinux-arm --definition 'do_sys_open $params'
        p:probe/do_sys_open do_sys_open+0 dfd=%r5:s32 filename=%r1:u32 flags=%r6:s32 mode=%r3:u16
        -----
      
      Here, we can get probe/do_sys_open from above and append it to to the target
      machine's tracing/kprobe_events file in the tracefs mountput, usually
      /sys/kernel/debug/tracing/kprobe_events (or /sys/kernel/tracing/kprobe_events).
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/147214229717.23638.6440579792548044658.stgit@devbox
      [ Add definition for EM_AARCH64 to fix the build on at least centos 6, debian 7 & ubuntu 12.04.5 ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      293d5b43
    • Masami Hiramatsu's avatar
      perf probe: Ignore vmlinux buildid if offline kernel is given · 428aff82
      Masami Hiramatsu authored
      Ignore the buildid of running kernel when both of --definition and
      --vmlinux is given because that kernel should be off-line.
      
      This also skips post-processing of kprobe event for relocating symbol
      and checking blacklist, because it can not be done on off-line kernel.
      
      E.g. without this fix perf shows an error as below
        ----
        $ perf probe --vmlinux=./vmlinux-arm --definition do_sys_open
        ./vmlinux-arm with build id 7a1f76dd56e9c4da707cd3d6333f50748141434b not found, continuing without symbols
        Failed to find symbol do_sys_open in kernel
          Error: Failed to add events.
        ----
      with this fix, we can get the definition
        ----
        $ perf probe --vmlinux=./vmlinux-arm --definition do_sys_open
        p:probe/do_sys_open do_sys_open+0
        ----
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/147214228193.23638.12581984840822162131.stgit@devboxSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      428aff82
    • Masami Hiramatsu's avatar
      perf probe: Show trace event definition · 1c20b1d1
      Masami Hiramatsu authored
      Add --definition/-D option for showing the trace-event definition in
      stdout. This can be useful in debugging or combined with a shell script.
      
      e.g.
        ----
        # perf probe --definition 'do_sys_open $params'
        p:probe/do_sys_open _text+2261728 dfd=%di:s32 filename=%si:u64 flags=%dx:s32 mode=%cx:u16
        ----
      Suggested-and-Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/147214226712.23638.2240534040014013658.stgit@devboxSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1c20b1d1
    • Milian Wolff's avatar
      perf config: Show default report configuration in example and docs · 893c5c79
      Milian Wolff authored
      Signed-off-by: default avatarMilian Wolff <milian.wolff@kdab.com>
      LPU-Reference: 20160830134106.21240-2-milian.wolff@kdab.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      893c5c79
    • Milian Wolff's avatar
      perf symbols: Demangle symbols for synthesized @plt entries. · 2a8d41b4
      Milian Wolff authored
      The symbols in the synthesized @plt entries where not demangled before,
      i.e. we could end up with entries such as:
      
          $ perf report
          Samples: 7K of event 'cycles:ppp', Event count (approx.): 6223833141
          Children      Self  Command          Shared Object           Symbol
          -   93.63%    28.89%  lab_mandelbrot   lab_mandelbrot        [.] main
              - 73.81% main
                  - 33.57% hypot
                    27.76% __hypot_finite
                    15.97% __muldc3
                     2.90% __muldc3@plt
                     2.40% _ZNK6QImage6heightEv@plt
                   + 2.14% QColor::rgb
                     1.94% _ZNK6QImage5widthEv@plt
                     1.92% cabs@plt
      
      This patch remedies this issue by also applying demangling to the
      synthesized symbols. The output for the above is now:
      
          $ perf report
          Samples: 7K of event 'cycles:ppp', Event count (approx.): 6223833141
          Children      Self  Command          Shared Object           Symbol
          -   93.63%    28.89%  lab_mandelbrot   lab_mandelbrot        [.] main
              - 73.81% main
                  - 33.57% hypot
                    27.76% __hypot_finite
                    15.97% __muldc3
                     2.90% __muldc3@plt
                     2.40% QImage::height() const@plt
                   + 2.14% QColor::rgb
                     1.94% QImage::width() const@plt
                     1.92% cabs@plt
      Signed-off-by: default avatarMilian Wolff <milian.wolff@kdab.com>
      LPU-Reference: 20160830114102.30863-1-milian.wolff@kdab.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      2a8d41b4
    • Arnaldo Carvalho de Melo's avatar
      perf probe: Do not use map_load filters for function · fd227598
      Arnaldo Carvalho de Melo authored
      It is simpler to just do the loop, no need for globals and the last user
      of such facility disappears.
      
      Testing:
      
        # perf probe -F [a-z]*recvmsg
        aead_recvmsg
        compat_SyS_recvmsg
        compat_sys_recvmsg
        hash_recvmsg
        inet_recvmsg
        kernel_recvmsg
        netlink_recvmsg
        packet_recvmsg
        ping_recvmsg
        raw_recvmsg
        rawv6_recvmsg
        rng_recvmsg
        security_socket_recvmsg
        selinux_socket_recvmsg
        skcipher_recvmsg
        sock_common_recvmsg
        sock_no_recvmsg
        sock_recvmsg
        sys_recvmsg
        tcp_recvmsg
        udp_recvmsg
        udpv6_recvmsg
        unix_dgram_recvmsg
        unix_seqpacket_recvmsg
        unix_stream_recvmsg
        #
      
      Without filters:
      
        # perf probe -F | tail -5
        zswap_pool_create
        zswap_pool_current
        zswap_update_total_size
        zswap_writeback_entry
        zswap_zpool_param_set
        #
        # perf probe -F | wc -l
        33311
        #
      Acked-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/20160831130427.GA13095@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      fd227598
  2. 30 Aug, 2016 2 commits
  3. 24 Aug, 2016 3 commits
  4. 23 Aug, 2016 24 commits