1. 10 2月, 2017 1 次提交
    • A
      perf tests: Avoid possible truncation with dirent->d_name + snprintf · 2e2bbc03
      Arnaldo Carvalho de Melo 提交于
      Addressing a few cases spotted by a new warning in gcc 7:
      
        tests/parse-events.c: In function 'test_pmu_events':
        tests/parse-events.c:1790:39: error: '%s' directive output may be truncated writing up to 255 bytes into a region of size 90 [-Werror=format-truncation=]
           snprintf(name, MAX_NAME, "cpu/event=%s/u", ent->d_name);
                                             ^~
        In file included from /usr/include/stdio.h:939:0,
                         from /git/linux/tools/perf/util/map.h:9,
                         from /git/linux/tools/perf/util/symbol.h:7,
                         from /git/linux/tools/perf/util/evsel.h:10,
                         from tests/parse-events.c:3:
        /usr/include/bits/stdio2.h:64:10: note: '__builtin___snprintf_chk' output between 13 and 268 bytes into a destination of size 100
           return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                __bos (__s), __fmt, __va_arg_pack ());
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        tests/parse-events.c:1798:29: error: '%s' directive output may be truncated writing up to 255 bytes into a region of size 100 [-Werror=format-truncation=]
           snprintf(name, MAX_NAME, "%s:u,cpu/event=%s/u", ent->d_name, ent->d_name);
      
      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>
      Fixes: 945aea22 ("perf tests: Move test objects into 'tests' directory")
      Link: http://lkml.kernel.org/n/tip-ty4q2p8zp1dp3mskvubxskm5@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      2e2bbc03
  2. 01 2月, 2017 1 次提交
  3. 26 1月, 2017 1 次提交
  4. 12 1月, 2017 1 次提交
  5. 16 12月, 2016 1 次提交
  6. 11 12月, 2016 1 次提交
  7. 06 12月, 2016 6 次提交
  8. 29 11月, 2016 2 次提交
    • A
      perf test: Remove "test" and similar strings from test descriptions · 030910c0
      Arnaldo Carvalho de Melo 提交于
      Having "test" in almost all test descriptions is redundant, simplify it
      removing and rewriting tests with such descriptions.
      
      End result:
      
        # perf test
         1: vmlinux symtab matches kallsyms            : Ok
         2: Detect openat syscall event                : Ok
         3: Detect openat syscall event on all cpus    : Ok
         4: Read samples using the mmap interface      : Ok
         5: Parse event definition strings             : Ok
         6: PERF_RECORD_* events & perf_sample fields  : Ok
         7: Parse perf pmu format                      : Ok
         8: DSO data read                              : Ok
         9: DSO data cache                             : Ok
        10: DSO data reopen                            : Ok
        11: Roundtrip evsel->name                      : Ok
        12: Parse sched tracepoints fields             : Ok
        13: syscalls:sys_enter_openat event fields     : Ok
        14: Setup struct perf_event_attr               : Ok
        15: Match and link multiple hists              : Ok
        16: 'import perf' in python                    : Ok
        17: Breakpoint overflow signal handler         : Ok
        18: Breakpoint overflow sampling               : Ok
        19: Number of exit events of a simple workload : Ok
        20: Software clock events period values        : Ok
        21: Object code reading                        : Ok
        22: Sample parsing                             : Ok
        23: Use a dummy software event to keep tracking: Ok
        24: Parse with no sample_id_all bit set        : Ok
        25: Filter hist entries                        : Ok
        26: Lookup mmap thread                         : Ok
        27: Share thread mg                            : Ok
        28: Sort output of hist entries                : Ok
        29: Cumulate child hist entries                : Ok
        30: Track with sched_switch                    : Ok
        31: Filter fds with revents mask in a fdarray  : Ok
        32: Add fd to a fdarray, making it autogrow    : Ok
        33: kmod_path__parse                           : Ok
        34: Thread map                                 : Ok
        35: LLVM search and compile                    :
        35.1: Basic BPF llvm compile                    : Ok
        35.2: kbuild searching                          : Ok
        35.3: Compile source for BPF prologue generation: Ok
        35.4: Compile source for BPF relocation         : Ok
        36: Session topology                           : Ok
        37: BPF filter                                 :
        37.1: Basic BPF filtering                      : Ok
        37.2: BPF prologue generation                  : Ok
        37.3: BPF relocation checker                   : Ok
        38: Synthesize thread map                      : Ok
        39: Synthesize cpu map                         : Ok
        40: Synthesize stat config                     : Ok
        41: Synthesize stat                            : Ok
        42: Synthesize stat round                      : Ok
        43: Synthesize attr update                     : Ok
        44: Event times                                : Ok
        45: Read backward ring buffer                  : Ok
        46: Print cpu map                              : Ok
        47: Probe SDT events                           : Ok
        48: is_printable_array                         : Ok
        49: Print bitmap                               : Ok
        50: perf hooks                                 : Ok
        51: x86 rdpmc                                  : Ok
        52: Convert perf time to TSC                   : Ok
        53: DWARF unwind                               : Ok
        54: x86 instruction decoder - new instructions : Ok
        55: Intel cqm nmi context read                 : Skip
        #
      
      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/n/tip-rx2lbfcrrio2yx1fxcljqy0e@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      030910c0
    • W
      perf tools: Introduce perf hooks · a074865e
      Wang Nan 提交于
      Perf hooks allow hooking user code at perf events. They can be used for
      manipulation of BPF maps, taking snapshot and reporting results. In this
      patch two perf hook points are introduced: record_start and record_end.
      
      To avoid buggy user actions, a SIGSEGV signal handler is introduced into
      'perf record'. It turns off perf hook if it causes a segfault and report
      an error to help debugging.
      
      A test case for perf hook is introduced.
      
      Test result:
        $ ./buildperf/perf test -v hook
        50: Test perf hooks                                          :
        --- start ---
        test child forked, pid 10311
        SIGSEGV is observed as expected, try to recover.
        Fatal error (SEGFAULT) in perf hook 'test'
        test child finished with 0
        ---- end ----
        Test perf hooks: Ok
      Signed-off-by: NWang Nan <wangnan0@huawei.com>
      Cc: Alexei Starovoitov <ast@fb.com>
      Cc: He Kuang <hekuang@huawei.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Joe Stringer <joe@ovn.org>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/20161126070354.141764-5-wangnan0@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      a074865e
  9. 14 11月, 2016 1 次提交
  10. 24 10月, 2016 1 次提交
  11. 29 9月, 2016 1 次提交
  12. 05 9月, 2016 2 次提交
  13. 01 9月, 2016 3 次提交
    • A
      perf test vmlinux: Tolerate symbol aliases · 7e1b6595
      Arnaldo Carvalho de Melo 提交于
      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: NArnaldo Carvalho de Melo <acme@redhat.com>
      7e1b6595
    • A
      perf test vmlinux: Avoid printing headers for empty lists · 54da0769
      Arnaldo Carvalho de Melo 提交于
      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: NArnaldo Carvalho de Melo <acme@redhat.com>
      54da0769
    • A
      perf test vmlinux: Clarify which -v lines are errors or warning · e267769e
      Arnaldo Carvalho de Melo 提交于
      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: NArnaldo Carvalho de Melo <acme@redhat.com>
      e267769e
  14. 24 8月, 2016 2 次提交
  15. 04 8月, 2016 1 次提交
    • A
      perf tests bpf: Use SyS_epoll_wait alias · c369e0a1
      Arnaldo Carvalho de Melo 提交于
      Something made the sys_epoll_wait() function alias not to be found in
      the vmlinux DWARF info, being found only in /proc/kallsyms, which made
      the BPF perf tests to fail:
      
        [root@jouet ~]# perf test BPF
        37: Test BPF filter                                          :
        37.1: Test basic BPF filtering                               : FAILED!
        37.2: Test BPF prologue generation                           : Skip
        37.3: Test BPF relocation checker                            : Skip
        [root@jouet ~]#
      
      Using -v we can see it is failing to find DWARF info for the probed function,
      sys_epoll_wait, which we can find in /proc/kallsyms but not in vmlinux with
      CONFIG_DEBUG_INFO:
      
        [root@jouet ~]# grep -w sys_epoll_wait /proc/kallsyms
        ffffffffbd295b50 T sys_epoll_wait
        [root@jouet ~]#
      
        [root@jouet ~]# readelf -wi /lib/modules/4.7.0+/build/vmlinux | grep -w sys_epoll_wait
        [root@jouet ~]#
      
      If we try to use perf probe:
      
      [root@jouet ~]# perf probe sys_epoll_wait
      Failed to find debug information for address ffffffffbd295b50
      Probe point 'sys_epoll_wait' not found.
        Error: Failed to add events.
      [root@jouet ~]#
      
      It all works if we use SyS_epoll_wait, that is just an alias to the probed
      function:
      
        [root@jouet ~]# grep -i sys_epoll_wait /proc/kallsyms
        ffffffffbd295b50 T SyS_epoll_wait
        ffffffffbd295b50 T sys_epoll_wait
        [root@jouet ~]#
      
      So use it:
      
        [root@jouet ~]# perf test BPF
        37: Test BPF filter                                          :
        37.1: Test basic BPF filtering                               : Ok
        37.2: Test BPF prologue generation                           : Ok
        37.3: Test BPF relocation checker                            : Ok
        [root@jouet ~]#
      
      Further info:
      
        [root@jouet ~]# gcc --version
        gcc (GCC) 6.1.1 20160621 (Red Hat 6.1.1-3)
        [acme@jouet linux]$ cat /etc/fedora-release
        Fedora release 24 (Twenty Four)
      
      Investigation as to why it fails is still underway, but it was always
      going from sys_epoll_wait to SyS_epoll_wait when looking up the DWARF
      info in vmlinux, and this is what is breaking now.
      
      Switching to use SyS_epoll_wait allows this test to proceed and test the
      BPF code it was designed for, so lets have this in to allow passing this
      test while we fix the root cause.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexei Starovoitov <alexei.starovoitov@gmail.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/n/tip-7hekjp0bodwjbb419sl2b55h@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      c369e0a1
  16. 03 8月, 2016 2 次提交
  17. 23 7月, 2016 1 次提交
  18. 19 7月, 2016 1 次提交
  19. 16 7月, 2016 4 次提交
  20. 14 7月, 2016 2 次提交
  21. 13 7月, 2016 5 次提交