Skip to contentSkip to conversation

perf/core improvements and fixes

GIT PULL New Arnaldo Carvalho de Melo 3 participants 22 messages Aug 14, 2017 perf events

lore
Share & tools
lore

Arnaldo Carvalho de Melo

author maintainer
#0 lore raw

Hi Ingo,

Please consider pulling,

- Arnaldo

Test results at the end of this message, as usual.

The following changes since commit 82119cbe8e1e32cc2a941393e59816e731681310:

Merge tag 'perf-core-for-mingo-4.14-20170801' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2017-08-10 17:07:02 +0200)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-4.14-20170814

for you to fetch changes up to 8fc375d7d36c72b4c2d55f5c24be022a939295d4:

perf test shell: Add uprobes + backtrace ping test (2017-08-11 16:18:49 -0300)

----------------------------------------------------------------
perf/core improvements and fixes:

Infrastructure:

- Do not consider empty files as valid srclines (Milian Wolff)

- Fix wrong size in perf_record_mmap for last kernel module,
which resulted in erroneous symbol resolution in at least s390x (Thomas Richter)

- Add missing newline to expr parser error messages (Andi Kleen)

- Fix saved values rbtree lookup in 'perf stat' (Andi Kleen)

- Add support for shell based tests in 'perf test', add a few that run 'perf probe', 'perf trace', using kprobes, uprobes to check the output of those tools and the effects on the system, checking, for instance, DWARF backtraces from uprobes (Arnaldo Carvalho de Melo)

Arch specific:

- Add ppc64le to audit uname list in the python scripting support (Naveen N. Rao)

- Update POWER9 vendor events tables (Sukadev Bhattiprolu)

- Fix module symbol adjustment for s390x (Thomas Richter)

----------------------------------------------------------------
Andi Kleen (2):
perf stat: Fix saved values rbtree lookup
perf tools: Add missing newline to expr parser error messages

Arnaldo Carvalho de Melo (10):
perf test: Make 'list' subcommand match main 'perf test' numbering/matching perf test: Add 'struct test *' to the test functions
perf test: Add infrastructure to run shell based tests
perf test: Make 'list' use same filtering code as main 'perf test' perf test shell: Add 'probe_vfs_getname' shell test
perf test shell: Install shell tests
perf test shell: Move vfs_getname probe function to lib
perf test shell: Add test using probe:vfs_getname and verifying results perf test shell: Add test using vfs_getname + 'perf trace' perf test shell: Add uprobes + backtrace ping test

Milian Wolff (2):
perf util: Take elf_name as const string in dso__demangle_sym perf srcline: Do not consider empty files as valid srclines

Naveen N. Rao (1):
perf scripting python: Add ppc64le to audit uname list

Sukadev Bhattiprolu (2):
perf vendor events powerpc: remove suffix in mapfile perf vendor events powerpc: Update POWER9 events

Thomas Richter (2):
perf record: Fix wrong size in perf_record_mmap for last kernel module perf report: Fix module symbol adjustment for s390x

 tools/perf/Makefile.perf                           |    6 +-
 tools/perf/arch/s390/util/sym-handling.c           |    7 +
 tools/perf/arch/x86/include/arch-tests.h           |   11 +-
 tools/perf/arch/x86/tests/insn-x86.c               |    2 +-
 tools/perf/arch/x86/tests/intel-cqm.c              |    2 +-
 tools/perf/arch/x86/tests/perf-time-to-tsc.c       |    2 +-
 tools/perf/arch/x86/tests/rdpmc.c                  |    2 +-
 tools/perf/pmu-events/arch/powerpc/mapfile.csv     |   20 +-
 .../perf/pmu-events/arch/powerpc/power9/cache.json |  191 +-
 .../arch/powerpc/power9/floating-point.json        |   42 +-
 .../pmu-events/arch/powerpc/power9/frontend.json   |  517 ++--
 .../pmu-events/arch/powerpc/power9/marked.json     |  905 +++----
 .../pmu-events/arch/powerpc/power9/memory.json     |  178 +-
 .../perf/pmu-events/arch/powerpc/power9/other.json | 2768 ++++++++++++++++----
 .../pmu-events/arch/powerpc/power9/pipeline.json   |  779 +++---
 tools/perf/pmu-events/arch/powerpc/power9/pmc.json |  167 +-
 .../arch/powerpc/power9/translation.json           |  314 +--
 .../python/Perf-Trace-Util/lib/Perf/Trace/Util.py  |    1 +
 tools/perf/tests/attr.c                            |    2 +-
 tools/perf/tests/backward-ring-buffer.c            |    2 +-
 tools/perf/tests/bitmap.c                          |    2 +-
 tools/perf/tests/bp_signal.c                       |    2 +-
 tools/perf/tests/bp_signal_overflow.c              |    2 +-
 tools/perf/tests/bpf.c                             |    4 +-
 tools/perf/tests/builtin-test.c                    |  184 +-
 tools/perf/tests/clang.c                           |    4 +-
 tools/perf/tests/code-reading.c                    |    2 +-
 tools/perf/tests/cpumap.c                          |    4 +-
 tools/perf/tests/dso-data.c                        |    6 +-
 tools/perf/tests/dwarf-unwind.c                    |    2 +-
 tools/perf/tests/event-times.c                     |    2 +-
 tools/perf/tests/event_update.c                    |    2 +-
 tools/perf/tests/evsel-roundtrip-name.c            |    2 +-
 tools/perf/tests/evsel-tp-sched.c                  |    2 +-
 tools/perf/tests/expr.c                            |    2 +-
 tools/perf/tests/fdarray.c                         |    4 +-
 tools/perf/tests/hists_cumulate.c                  |    2 +-
 tools/perf/tests/hists_filter.c                    |    2 +-
 tools/perf/tests/hists_link.c                      |    2 +-
 tools/perf/tests/hists_output.c                    |    2 +-
 tools/perf/tests/is_printable_array.c              |    2 +-
 tools/perf/tests/keep-tracking.c                   |    2 +-
 tools/perf/tests/kmod-path.c                       |    2 +-
 tools/perf/tests/llvm.c                            |    2 +-
 tools/perf/tests/mmap-basic.c                      |    2 +-
 tools/perf/tests/mmap-thread-lookup.c              |    2 +-
 tools/perf/tests/openat-syscall-all-cpus.c         |    2 +-
 tools/perf/tests/openat-syscall-tp-fields.c        |    2 +-
 tools/perf/tests/openat-syscall.c                  |    2 +-
 tools/perf/tests/parse-events.c                    |    2 +-
 tools/perf/tests/parse-no-sample-id-all.c          |    2 +-
 tools/perf/tests/perf-hooks.c                      |    2 +-
 tools/perf/tests/perf-record.c                     |    2 +-
 tools/perf/tests/pmu.c                             |    2 +-
 tools/perf/tests/python-use.c                      |    2 +-
 tools/perf/tests/sample-parsing.c                  |    2 +-
 tools/perf/tests/sdt.c                             |    4 +-
 tools/perf/tests/shell/lib/probe_vfs_getname.sh    |   28 +
 tools/perf/tests/shell/probe_vfs_getname.sh        |   10 +
 .../tests/shell/record+script_probe_vfs_getname.sh |   37 +
 .../perf/tests/shell/trace+probe_libc_inet_pton.sh |   40 +
 tools/perf/tests/shell/trace+probe_vfs_getname.sh  |   31 +
 tools/perf/tests/stat.c                            |    6 +-
 tools/perf/tests/sw-clock.c                        |    2 +-
 tools/perf/tests/switch-tracking.c                 |    2 +-
 tools/perf/tests/task-exit.c                       |    2 +-
 tools/perf/tests/tests.h                           |  113 +-
 tools/perf/tests/thread-map.c                      |    6 +-
 tools/perf/tests/thread-mg-share.c                 |    2 +-
 tools/perf/tests/topology.c                        |    2 +-
 tools/perf/tests/unit_number__scnprintf.c          |    2 +-
 tools/perf/tests/vmlinux-kallsyms.c                |    2 +-
 tools/perf/util/expr.y                             |    2 +-
 tools/perf/util/machine.c                          |    4 +-
 tools/perf/util/srcline.c                          |    6 +
 tools/perf/util/stat-shadow.c                      |    6 +-
 tools/perf/util/symbol-elf.c                       |   12 +-
 tools/perf/util/symbol-minimal.c                   |    2 +-
 tools/perf/util/symbol.c                           |   21 +-
 tools/perf/util/symbol.h                           |    7 +-
 80 files changed, 4054 insertions(+), 2479 deletions(-)
 create mode 100644 tools/perf/tests/shell/lib/probe_vfs_getname.sh
 create mode 100755 tools/perf/tests/shell/probe_vfs_getname.sh
 create mode 100755 tools/perf/tests/shell/record+script_probe_vfs_getname.sh
 create mode 100755 tools/perf/tests/shell/trace+probe_libc_inet_pton.sh
 create mode 100755 tools/perf/tests/shell/trace+probe_vfs_getname.sh

Test results:

The first ones are container (docker) based builds of tools/perf with and without libelf support, objtool where it is supported and samples/bpf/, ditto. Where clang is available, it is also used to build perf with/without libelf.

Several are cross builds, the ones with -x-ARCH, and the android one, and those may not have all the features built, due to lack of multi-arch devel packages, available and being used so far on just a few, like debian:experimental-x-{arm64,mipsel}.

The 'perf test' one will perform a variety of tests exercising tools/perf/util/, tools/lib/{bpf,traceevent,etc}, as well as run perf commands with a variety of command line event specifications to then intercept the sys_perf_event syscall to check that the perf_event_attr fields are set up as expected, among a variety of other unit tests.

The 'perf test' also runs shell scripts exercising the tools, checking if they affect the system in certain ways, like setting up kprobes and uprobes, request callchains for well known programs and check that they are the expected ones, see if 'perf trace' beautifies system call arguments correctly, etc.

Additionally, a new set of tests, script based, runs the tools in a live system, setting probes in place that then gets used by 'perf trace', with its output compared against expected results.

Then there is the 'make -C tools/perf build-test' ones, that build tools/perf/ with a variety of feature sets, exercising the build with an incomplete set of features as well as with a complete one. It is planned to have it run on each of the containers mentioned above, using some container orchestration infrastructure. Get in contact if interested in helping having this in place.

  # dm
   1 alpine:3.4: Ok
   2 alpine:3.5: Ok
   3 alpine:3.6: Ok
   4 alpine:edge: Ok
   5 android-ndk:r12b-arm: Ok
   6 archlinux:latest: Ok
   7 centos:5: Ok
   8 centos:6: Ok
   9 centos:7: Ok
  10 debian:7: Ok
  11 debian:8: Ok
  12 debian:9: Ok
  13 debian:experimental: Ok
  14 debian:experimental-x-arm64: Ok
  15 debian:experimental-x-mips: Ok
  16 debian:experimental-x-mips64: Ok
  17 debian:experimental-x-mipsel: Ok
  18 fedora:20: Ok
  19 fedora:21: Ok
  20 fedora:22: Ok
  21 fedora:23: Ok
  22 fedora:24: Ok
  23 fedora:24-x-ARC-uClibc: Ok
  24 fedora:25: Ok
  25 fedora:26: Ok
  26 fedora:rawhide: Ok
  27 mageia:5: Ok
  28 opensuse:13.2: Ok
  29 opensuse:42.1: Ok
  30 opensuse:42.2: Ok
  31 opensuse:tumbleweed: Ok
  32 oraclelinux:6: Ok
  33 oraclelinux:7: Ok
  34 ubuntu:12.04.5: Ok
  35 ubuntu:14.04.4: Ok
  36 ubuntu:14.04.4-x-linaro-arm64: Ok
  37 ubuntu:15.10: Ok
  38 ubuntu:16.04: Ok
  39 ubuntu:16.04-x-arm: Ok
  40 ubuntu:16.04-x-arm64: Ok
  41 ubuntu:16.04-x-powerpc: Ok
  42 ubuntu:16.04-x-powerpc64: Ok
  43 ubuntu:16.04-x-powerpc64el: Ok
  44 ubuntu:16.04-x-s390: Ok
  45 ubuntu:16.10: Ok
  46 ubuntu:17.04: Ok
  47 ubuntu:17.10: Ok
  #
  # uname -a
  Linux jouet 4.13.0-rc4+ #2 SMP Fri Aug 11 12:39:09 -03 2017 x86_64 x86_64 x86_64 GNU/Linux
  # 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: Simple expression parser                              : Ok
   7: PERF_RECORD_* events & perf_sample fields             : Ok
   8: Parse perf pmu format                                 : Ok
   9: DSO data read                                         : Ok
  10: DSO data cache                                        : Ok
  11: DSO data reopen                                       : Ok
  12: Roundtrip evsel->name                                 : Ok
  13: Parse sched tracepoints fields                        : Ok
  14: syscalls:sys_enter_openat event fields                : Ok
  15: Setup struct perf_event_attr                          : Ok
  16: Match and link multiple hists                         : Ok
  17: 'import perf' in python                               : Ok
  18: Breakpoint overflow signal handler                    : Ok
  19: Breakpoint overflow sampling                          : Ok
  20: Number of exit events of a simple workload            : Ok
  21: Software clock events period values                   : Ok
  22: Object code reading                                   : Ok
  23: Sample parsing                                        : Ok
  24: Use a dummy software event to keep tracking           : Ok
  25: Parse with no sample_id_all bit set                   : Ok
  26: Filter hist entries                                   : Ok
  27: Lookup mmap thread                                    : Ok
  28: Share thread mg                                       : Ok
  29: Sort output of hist entries                           : Ok
  30: Cumulate child hist entries                           : Ok
  31: Track with sched_switch                               : Ok
  32: Filter fds with revents mask in a fdarray             : Ok
  33: Add fd to a fdarray, making it autogrow               : Ok
  34: kmod_path__parse                                      : Ok
  35: Thread map                                            : Ok
  36: LLVM search and compile                               :
  36.1: Basic BPF llvm compile                              : Ok
  36.2: kbuild searching                                    : Ok
  36.3: Compile source for BPF prologue generation          : Ok
  36.4: Compile source for BPF relocation                   : Ok
  37: Session topology                                      : Ok
  38: BPF filter                                            :
  38.1: Basic BPF filtering                                 : Ok
  38.2: BPF pinning                                         : Ok
  38.3: BPF prologue generation                             : Ok
  38.4: BPF relocation checker                              : Ok
  39: Synthesize thread map                                 : Ok
  40: Remove thread map                                     : Ok
  41: Synthesize cpu map                                    : Ok
  42: Synthesize stat config                                : Ok
  43: Synthesize stat                                       : Ok
  44: Synthesize stat round                                 : Ok
  45: Synthesize attr update                                : Ok
  46: Event times                                           : Ok
  47: Read backward ring buffer                             : Ok
  48: Print cpu map                                         : Ok
  49: Probe SDT events                                      : Ok
  50: is_printable_array                                    : Ok
  51: Print bitmap                                          : Ok
  52: perf hooks                                            : Ok
  53: builtin clang support                                 : Skip (not compiled in)
  54: unit_number__scnprintf                                : Ok
  55: x86 rdpmc                                             : Ok
  56: Convert perf time to TSC                              : Ok
  57: DWARF unwind                                          : Ok
  58: x86 instruction decoder - new instructions            : Ok
  59: Intel cqm nmi context read                            : Skip
  60: Use vfs_getname probe to get syscall args filenames   : Ok
  61: probe libc's inet_pton & backtrace it with ping       : Ok
  62: Check open filename arg using perf trace + vfs_getname: Ok
  63: Add vfs_getname probe to get syscall args filenames   : Ok
  #

# The static build test works on Fedora 25, is failing on Fedora 26,

  # this issue is being investigated.
  $ make -C tools/perf build-test
  make: Entering directory '/home/acme/git/linux/tools/perf'
  - tarpkg: ./tests/perf-targz-src-pkg .
               make_no_slang_O: make NO_SLANG=1
         make_install_prefix_O: make install prefix=/tmp/krava
            make_install_bin_O: make install-bin
                  make_debug_O: make DEBUG=1
              make_clean_all_O: make clean all
   make_install_prefix_slash_O: make install prefix=/tmp/krava/
            make_no_auxtrace_O: make NO_AUXTRACE=1
        make_with_babeltrace_O: make LIBBABELTRACE=1
                make_minimal_O: make NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1 NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1 NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1 NO_LIBBPF=1 NO_LIBCRYPTO=1 NO_SDT=1 NO_JVMTI=1
           make_no_libpython_O: make NO_LIBPYTHON=1
            make_no_libaudit_O: make NO_LIBAUDIT=1
                   make_help_O: make help
            make_no_demangle_O: make NO_DEMANGLE=1
  make_no_libdw_dwarf_unwind_O: make NO_LIBDW_DWARF_UNWIND=1
           make_no_libunwind_O: make NO_LIBUNWIND=1
                make_install_O: make install
             make_no_scripts_O: make NO_LIBPYTHON=1 NO_LIBPERL=1
                make_no_newt_O: make NO_NEWT=1
       make_util_pmu_bison_o_O: make util/pmu-bison.o
                 make_perf_o_O: make perf.o
                make_no_gtk2_O: make NO_GTK2=1
                  make_no_ui_O: make NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
              make_no_libbpf_O: make NO_LIBBPF=1
         make_with_clangllvm_O: make LIBCLANGLLVM=1
                   make_tags_O: make tags
             make_util_map_o_O: make util/map.o
                   make_pure_O: make
             make_no_libperl_O: make NO_LIBPERL=1
           make_no_libbionic_O: make NO_LIBBIONIC=1
           make_no_backtrace_O: make NO_BACKTRACE=1
             make_no_libnuma_O: make NO_LIBNUMA=1
              make_no_libelf_O: make NO_LIBELF=1
                    make_doc_O: make doc
  OK
  make: Leaving directory '/home/acme/git/linux/tools/perf'
  $
author maintainer
#1 lore raw

PATCH 1/19 perf scripting python: Add ppc64le to audit uname list

From: "Naveen N. Rao" <[email protected]>

Before patch:

  $ uname -m
  ppc64le
  $ ./perf script -s ./scripts/python/syscall-counts.py
  Install the audit-libs-python package to get syscall names.
  For example:
    # apt-get install python-audit (Ubuntu)
    # yum install audit-libs-python (Fedora)
    etc.

Press control+C to stop and show the summary
^CWarning:
4 out of order events recorded.

syscall events:

event count
---------------------------------------- -----------
4 504638
54 1206

  221                                               42
  55                                                21
  3                                                 12
  167                                               10
  11                                                 8
  6                                                  7
  125                                                6
  5                                                  6
  108                                                5
  162                                                4
  90                                                 4
  45                                                 3
  33                                                 3
  311                                                1
  246                                                1
  238                                                1
  93                                                 1
  91                                                 1

After patch:
./perf script -s ./scripts/python/syscall-counts.py Press control+C to stop and show the summary ^CWarning:
5 out of order events recorded.

syscall events:

event count
---------------------------------------- -----------
write 643411
ioctl 1206

  futex                                             54
  fcntl                                             27
  poll                                              14
  read                                              12
  execve                                             8
  close                                              7
  mprotect                                           6
  open                                               6
  nanosleep                                          5
  fstat                                              5
  mmap                                               4
  inotify_add_watch                                  3
  brk                                                3
  access                                             3
  timerfd_settime                                    1
  clock_gettime                                      1
  epoll_wait                                         1
  ftruncate                                          1
  munmap                                             1
---
 tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py | 1 +
 1 file changed, 1 insertion(+)
tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py +1 -0
index 1d95009592eb..f6c84966e4f8 100644
@@ -57,6 +57,7 @@ try:
 		'ia64'	: audit.MACH_IA64,
 		'ppc'	: audit.MACH_PPC,
 		'ppc64'	: audit.MACH_PPC64,
+		'ppc64le' : audit.MACH_PPC64LE,
 		's390'	: audit.MACH_S390,
 		's390x'	: audit.MACH_S390X,
 		'i386'	: audit.MACH_X86,
Signature · 1 line
2.13.4
author maintainer
#2 lore raw

PATCH 2/19 perf vendor events powerpc: remove suffix in mapfile

In reply to Arnaldo Carvalho de Melo

From: Sukadev Bhattiprolu <[email protected]>

Drop the .json suffix for events directory in the mapfile.csv.

Now that we have separate JSON files for each topic in a CPU (eg: see tools/perf/pmu-events/arch/powerpc/power8/*.json) the .json suffix in the mapfile is misleading and redundant.

---
 tools/perf/pmu-events/arch/powerpc/mapfile.csv | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
tools/perf/pmu-events/arch/powerpc/mapfile.csv +10 -10
index 14318ef215f8..a0f3a11ca19f 100644
@@ -13,13 +13,13 @@
 #
 
 # Power8 entries
-004b0000,1,power8.json,core
-004b0201,1,power8.json,core
-004c0000,1,power8.json,core
-004d0000,1,power8.json,core
-004d0100,1,power8.json,core
-004d0200,1,power8.json,core
-004c0100,1,power8.json,core
-004e0100,1,power9.json,core
-004e0200,1,power9.json,core
-004e1200,1,power9.json,core
+004b0000,1,power8,core
+004b0201,1,power8,core
+004c0000,1,power8,core
+004d0000,1,power8,core
+004d0100,1,power8,core
+004d0200,1,power8,core
+004c0100,1,power8,core
+004e0100,1,power9,core
+004e0200,1,power9,core
+004e1200,1,power9,core
Signature · 1 line
2.13.4
author maintainer
#3 lore raw

PATCH 3/19 perf vendor events powerpc: Update POWER9 events

In reply to Arnaldo Carvalho de Melo

From: Sukadev Bhattiprolu <[email protected]>

Update and cleanup POWER9 PMU events.

---
 .../perf/pmu-events/arch/powerpc/power9/cache.json |  191 +-
 .../arch/powerpc/power9/floating-point.json        |   42 +-
 .../pmu-events/arch/powerpc/power9/frontend.json   |  517 ++--
 .../pmu-events/arch/powerpc/power9/marked.json     |  905 +++----
 .../pmu-events/arch/powerpc/power9/memory.json     |  178 +-
 .../perf/pmu-events/arch/powerpc/power9/other.json | 2768 ++++++++++++++++----
 .../pmu-events/arch/powerpc/power9/pipeline.json   |  779 +++---
 tools/perf/pmu-events/arch/powerpc/power9/pmc.json |  167 +-
 .../arch/powerpc/power9/translation.json           |  314 +--
 9 files changed, 3537 insertions(+), 2324 deletions(-)
tools/perf/pmu-events/arch/powerpc/power9/cache.json +76 -115
index 437c83b7e6af..18f6645f2897 100644
@@ -1,176 +1,137 @@
 [
   {,
-    "EventCode": "0x1002A",
-    "EventName": "PM_CMPLU_STALL_LARX",
-    "BriefDescription": "Finish stall because the NTF instruction was a larx waiting to be satisfied",
-    "PublicDescription": ""
+    "EventCode": "0x300F4",
+    "EventName": "PM_THRD_CONC_RUN_INST",
+    "BriefDescription": "PPC Instructions Finished by this thread when all threads in the core had the run-latch set"
   },
   {,
-    "EventCode": "0x1003C",
-    "EventName": "PM_CMPLU_STALL_DMISS_L2L3",
-    "BriefDescription": "Completion stall by Dcache miss which resolved in L2/L3",
-    "PublicDescription": ""
+    "EventCode": "0x1E056",
+    "EventName": "PM_CMPLU_STALL_FLUSH_ANY_THREAD",
+    "BriefDescription": "Cycles in which the NTC instruction is not allowed to complete because any of the 4 threads in the same core suffered a flush, which blocks completion"
   },
   {,
-    "EventCode": "0x14048",
-    "EventName": "PM_INST_FROM_ON_CHIP_CACHE",
-    "BriefDescription": "The processor's Instruction cache was reloaded either shared or modified data from another core's L2/L3 on the same chip due to an instruction fetch (not prefetch)",
-    "PublicDescription": ""
+    "EventCode": "0x4D016",
+    "EventName": "PM_CMPLU_STALL_FXLONG",
+    "BriefDescription": "Completion stall due to a long latency scalar fixed point instruction (division, square root)"
   },
   {,
-    "EventCode": "0x3E054",
-    "EventName": "PM_LD_MISS_L1",
-    "BriefDescription": "Load Missed L1, counted at execution time (can be greater than loads finished). LMQ merges are not included in this count. i.e. if a load instruction misses on an address that is already allocated on the LMQ, this event will not increment for that load). Note that this count is per slice, so if a load spans multiple slices this event will increment multiple times for a single load.",
-    "PublicDescription": ""
+    "EventCode": "0x2D016",
+    "EventName": "PM_CMPLU_STALL_FXU",
+    "BriefDescription": "Finish stall due to a scalar fixed point or CR instruction in the execution pipeline. These instructions get routed to the ALU, ALU2, and DIV pipes"
   },
   {,
-    "EventCode": "0x400F0",
-    "EventName": "PM_LD_MISS_L1",
-    "BriefDescription": "Load Missed L1, at execution time (not gated by finish, which means this counter can be greater than loads finished)",
-    "PublicDescription": ""
+    "EventCode": "0x1D15C",
+    "EventName": "PM_MRK_DTLB_MISS_1G",
+    "BriefDescription": "Marked Data TLB reload (after a miss) page size 2M. Implies radix translation was used"
   },
   {,
-    "EventCode": "0x1404A",
-    "EventName": "PM_INST_FROM_RL2L3_SHR",
-    "BriefDescription": "The processor's Instruction cache was reloaded with Shared (S) data from another chip's L2 or L3 on the same Node or Group (Remote), as this chip due to an instruction fetch (not prefetch)",
-    "PublicDescription": ""
+    "EventCode": "0x4D12A",
+    "EventName": "PM_MRK_DATA_FROM_RL4_CYC",
+    "BriefDescription": "Duration in cycles to reload from another chip's L4 on the same Node or Group ( Remote) due to a marked load"
   },
   {,
-    "EventCode": "0x1C058",
-    "EventName": "PM_DTLB_MISS_16G",
-    "BriefDescription": "Data TLB Miss page size 16G",
-    "PublicDescription": ""
+    "EventCode": "0x1003C",
+    "EventName": "PM_CMPLU_STALL_DMISS_L2L3",
+    "BriefDescription": "Completion stall by Dcache miss which resolved in L2/L3"
   },
   {,
-    "EventCode": "0x1D15C",
-    "EventName": "PM_MRK_DTLB_MISS_1G",
-    "BriefDescription": "Marked Data TLB reload (after a miss) page size 2M. Implies radix translation was used",
-    "PublicDescription": ""
+    "EventCode": "0x4C014",
+    "EventName": "PM_CMPLU_STALL_LMQ_FULL",
+    "BriefDescription": "Finish stall because the NTF instruction was a load that missed in the L1 and the LMQ was unable to accept this load miss request because it was full"
   },
   {,
-    "EventCode": "0x1E056",
-    "EventName": "PM_CMPLU_STALL_FLUSH_ANY_THREAD",
-    "BriefDescription": "Cycles in which the NTC instruction is not allowed to complete because any of the 4 threads in the same core suffered a flush, which blocks completion",
-    "PublicDescription": ""
+    "EventCode": "0x14048",
+    "EventName": "PM_INST_FROM_ON_CHIP_CACHE",
+    "BriefDescription": "The processor's Instruction cache was reloaded either shared or modified data from another core's L2/L3 on the same chip due to an instruction fetch (not prefetch)"
   },
   {,
-    "EventCode": "0x101E6",
-    "EventName": "PM_THRESH_EXC_4096",
-    "BriefDescription": "Threshold counter exceed a count of 4096",
-    "PublicDescription": ""
+    "EventCode": "0x4D014",
+    "EventName": "PM_CMPLU_STALL_LOAD_FINISH",
+    "BriefDescription": "Finish stall because the NTF instruction was a load instruction with all its dependencies satisfied just going through the LSU pipe to finish"
   },
   {,
-    "EventCode": "0x2C01A",
-    "EventName": "PM_CMPLU_STALL_LHS",
-    "BriefDescription": "Finish stall because the NTF instruction was a load that hit on an older store and it was waiting for store data",
-    "PublicDescription": ""
+    "EventCode": "0x2404A",
+    "EventName": "PM_INST_FROM_RL4",
+    "BriefDescription": "The processor's Instruction cache was reloaded from another chip's L4 on the same Node or Group ( Remote) due to an instruction fetch (not prefetch)"
   },
   {,
-    "EventCode": "0x2D016",
-    "EventName": "PM_CMPLU_STALL_FXU",
-    "BriefDescription": "Finish stall due to a scalar fixed point or CR instruction in the execution pipeline. These instructions get routed to the ALU, ALU2, and DIV pipes",
-    "PublicDescription": ""
+    "EventCode": "0x1404A",
+    "EventName": "PM_INST_FROM_RL2L3_SHR",
+    "BriefDescription": "The processor's Instruction cache was reloaded with Shared (S) data from another chip's L2 or L3 on the same Node or Group (Remote), as this chip due to an instruction fetch (not prefetch)"
   },
   {,
-    "EventCode": "0x24046",
-    "EventName": "PM_INST_FROM_RL2L3_MOD",
-    "BriefDescription": "The processor's Instruction cache was reloaded with Modified (M) data from another chip's L2 or L3 on the same Node or Group (Remote), as this chip due to an instruction fetch (not prefetch)",
-    "PublicDescription": ""
+    "EventCode": "0x401EA",
+    "EventName": "PM_THRESH_EXC_128",
+    "BriefDescription": "Threshold counter exceeded a value of 128"
   },
   {,
-    "EventCode": "0x2404A",
-    "EventName": "PM_INST_FROM_RL4",
-    "BriefDescription": "The processor's Instruction cache was reloaded from another chip's L4 on the same Node or Group ( Remote) due to an instruction fetch (not prefetch)",
-    "PublicDescription": ""
+    "EventCode": "0x400F6",
+    "EventName": "PM_BR_MPRED_CMPL",
+    "BriefDescription": "Number of Branch Mispredicts"
   },
   {,
     "EventCode": "0x2F140",
     "EventName": "PM_MRK_DPTEG_FROM_L2_MEPF",
-    "BriefDescription": "A Page Table Entry was loaded into the TLB from local core's L2 hit without dispatch conflicts on Mepf state. due to a marked data side request. When using Radix Page Translation, this count excludes PDE reloads. Only PTE reloads are included",
-    "PublicDescription": ""
+    "BriefDescription": "A Page Table Entry was loaded into the TLB from local core's L2 hit without dispatch conflicts on Mepf state. due to a marked data side request. When using Radix Page Translation, this count excludes PDE reloads. Only PTE reloads are included"
   },
   {,
-    "EventCode": "0x2D15E",
-    "EventName": "PM_MRK_DTLB_MISS_16G",
-    "BriefDescription": "Marked Data TLB Miss page size 16G",
-    "PublicDescription": ""
-  },
-  {,
-    "EventCode": "0x3F14A",
-    "EventName": "PM_MRK_DPTEG_FROM_RMEM",
-    "BriefDescription": "A Page Table Entry was loaded into the TLB from another chip's memory on the same Node or Group ( Remote) due to a marked data side request. When using Radix Page Translation, this count excludes PDE reloads. Only PTE reloads are included",
-    "PublicDescription": ""
+    "EventCode": "0x101E6",
+    "EventName": "PM_THRESH_EXC_4096",
+    "BriefDescription": "Threshold counter exceed a count of 4096"
   },
   {,
     "EventCode": "0x3D156",
     "EventName": "PM_MRK_DTLB_MISS_64K",
-    "BriefDescription": "Marked Data TLB Miss page size 64K",
-    "PublicDescription": ""
+    "BriefDescription": "Marked Data TLB Miss page size 64K"
   },
   {,
-    "EventCode": "0x3006C",
-    "EventName": "PM_RUN_CYC_SMT2_MODE",
-    "BriefDescription": "Cycles in which this thread's run latch is set and the core is in SMT2 mode",
-    "PublicDescription": ""
+    "EventCode": "0x4C15E",
+    "EventName": "PM_MRK_DTLB_MISS_16M",
+    "BriefDescription": "Marked Data TLB Miss page size 16M"
   },
   {,
-    "EventCode": "0x300F4",
-    "EventName": "PM_THRD_CONC_RUN_INST",
-    "BriefDescription": "PPC Instructions Finished by this thread when all threads in the core had the run-latch set",
-    "PublicDescription": ""
+    "EventCode": "0x2D15E",
+    "EventName": "PM_MRK_DTLB_MISS_16G",
+    "BriefDescription": "Marked Data TLB Miss page size 16G"
   },
   {,
-    "EventCode": "0x4C014",
-    "EventName": "PM_CMPLU_STALL_LMQ_FULL",
-    "BriefDescription": "Finish stall because the NTF instruction was a load that missed in the L1 and the LMQ was unable to accept this load miss request because it was full",
-    "PublicDescription": ""
+    "EventCode": "0x3F14A",
+    "EventName": "PM_MRK_DPTEG_FROM_RMEM",
+    "BriefDescription": "A Page Table Entry was loaded into the TLB from another chip's memory on the same Node or Group ( Remote) due to a marked data side request. When using Radix Page Translation, this count excludes PDE reloads. Only PTE reloads are included"
   },
   {,
     "EventCode": "0x4C016",
     "EventName": "PM_CMPLU_STALL_DMISS_L2L3_CONFLICT",
-    "BriefDescription": "Completion stall due to cache miss that resolves in the L2 or L3 with a conflict",
-    "PublicDescription": ""
-  },
-  {,
-    "EventCode": "0x4D014",
-    "EventName": "PM_CMPLU_STALL_LOAD_FINISH",
-    "BriefDescription": "Finish stall because the NTF instruction was a load instruction with all its dependencies satisfied just going through the LSU pipe to finish",
-    "PublicDescription": ""
+    "BriefDescription": "Completion stall due to cache miss that resolves in the L2 or L3 with a conflict"
   },
   {,
-    "EventCode": "0x4D016",
-    "EventName": "PM_CMPLU_STALL_FXLONG",
-    "BriefDescription": "Completion stall due to a long latency scalar fixed point instruction (division, square root)",
-    "PublicDescription": ""
+    "EventCode": "0x2C01A",
+    "EventName": "PM_CMPLU_STALL_LHS",
+    "BriefDescription": "Finish stall because the NTF instruction was a load that hit on an older store and it was waiting for store data"
   },
   {,
-    "EventCode": "0x4D12A",
-    "EventName": "PM_MRK_DATA_FROM_RL4_CYC",
-    "BriefDescription": "Duration in cycles to reload from another chip's L4 on the same Node or Group ( Remote) due to a marked load",
-    "PublicDescription": ""
+    "EventCode": "0x401E4",
+    "EventName": "PM_MRK_DTLB_MISS",
+    "BriefDescription": "Marked dtlb miss"
   },
   {,
-    "EventCode": "0x4C15E",
-    "EventName": "PM_MRK_DTLB_MISS_16M",
-    "BriefDescription": "Marked Data TLB Miss page size 16M",
-    "PublicDescription": ""
+    "EventCode": "0x24046",
+    "EventName": "PM_INST_FROM_RL2L3_MOD",
+    "BriefDescription": "The processor's Instruction cache was reloaded with Modified (M) data from another chip's L2 or L3 on the same Node or Group (Remote), as this chip due to an instruction fetch (not prefetch)"
   },
   {,
-    "EventCode": "0x401E4",
-    "EventName": "PM_MRK_DTLB_MISS",
-    "BriefDescription": "Marked dtlb miss",
-    "PublicDescription": ""
+    "EventCode": "0x1002A",
+    "EventName": "PM_CMPLU_STALL_LARX",
+    "BriefDescription": "Finish stall because the NTF instruction was a larx waiting to be satisfied"
   },
   {,
-    "EventCode": "0x401EA",
-    "EventName": "PM_THRESH_EXC_128",
-    "BriefDescription": "Threshold counter exceeded a value of 128",
-    "PublicDescription": ""
+    "EventCode": "0x3006C",
+    "EventName": "PM_RUN_CYC_SMT2_MODE",
+    "BriefDescription": "Cycles in which this thread's run latch is set and the core is in SMT2 mode"
   },
   {,
-    "EventCode": "0x400F6",
-    "EventName": "PM_BR_MPRED_CMPL",
-    "BriefDescription": "Number of Branch Mispredicts",
-    "PublicDescription": ""
+    "EventCode": "0x1C058",
+    "EventName": "PM_DTLB_MISS_16G",
+    "BriefDescription": "Data TLB Miss page size 16G"
   }
-]
+]
\ No newline at end of file
tools/perf/pmu-events/arch/powerpc/power9/floating-point.json +15 -27

60 lines not on this page · raw message

tools/perf/pmu-events/arch/powerpc/power9/frontend.json +224 -293

671 lines not on this page · raw message

tools/perf/pmu-events/arch/powerpc/power9/marked.json +385 -520

1,167 lines not on this page · raw message

tools/perf/pmu-events/arch/powerpc/power9/memory.json +76 -102

235 lines not on this page · raw message

tools/perf/pmu-events/arch/powerpc/power9/other.json +2222 -546

614 lines not on this page · raw message

tools/perf/pmu-events/arch/powerpc/power9/pipeline.json +328 -451

779 lines not on this page · raw message

tools/perf/pmu-events/arch/powerpc/power9/pmc.json +74 -93

167 lines not on this page · raw message

tools/perf/pmu-events/arch/powerpc/power9/translation.json +137 -177

314 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.13.4

Part of the diff is not shown here. View the raw message.

author maintainer
#4 lore raw

PATCH 4/19 perf stat: Fix saved values rbtree lookup

In reply to Arnaldo Carvalho de Melo

From: Andi Kleen <[email protected]>

The stat shadow saved values rbtree is indexed by a pointer. Fix the comparison function:

- We cannot return a pointer delta as an int because that loses bits on 64bit.

- Doing pointer arithmetic on the struct pointer only works if the objects are spaced by the multiple of the object size, which is not guaranteed for individual malloc'ed object

Replace it with a proper comparison.

This fixes various problems with values not being found.

---
 tools/perf/util/stat-shadow.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
tools/perf/util/stat-shadow.c +5 -1
index 719d6cb86952..a04cf56d3517 100644
@@ -70,7 +70,11 @@ static int saved_value_cmp(struct rb_node *rb_node, const void *entry)
 		return a->ctx - b->ctx;
 	if (a->cpu != b->cpu)
 		return a->cpu - b->cpu;
-	return a->evsel - b->evsel;
+	if (a->evsel == b->evsel)
+		return 0;
+	if ((char *)a->evsel < (char *)b->evsel)
+		return -1;
+	return +1;
 }
 
 static struct rb_node *saved_value_new(struct rblist *rblist __maybe_unused,
Signature · 1 line
2.13.4
author maintainer
#5 lore raw

PATCH 5/19 perf tools: Add missing newline to expr parser error messages

In reply to Arnaldo Carvalho de Melo

From: Andi Kleen <[email protected]>

---
 tools/perf/util/expr.y | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/expr.y +1 -1
index 954556bea36e..953e65ba2cc7 100644
@@ -62,7 +62,7 @@ all_expr: expr			{ *final_val = $1; }
 
 expr:	  NUMBER
 	| ID			{ if (lookup_id(ctx, $1, &$$) < 0) {
-					pr_debug("%s not found", $1);
+					pr_debug("%s not found\n", $1);
 					YYABORT;
 				  }
 				}
Signature · 1 line
2.13.4
author maintainer
#6 lore raw

PATCH 6/19 perf test: Make 'list' subcommand match main 'perf test' numbering/matching

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

Before:

  # perf test Synth
  39: Synthesize thread map  : Ok
  41: Synthesize cpu map     : Ok
  42: Synthesize stat config : Ok
  43: Synthesize stat        : Ok
  44: Synthesize stat round  : Ok
  45: Synthesize attr update : Ok
  #
  # perf test list Synth
   1: Synthesize thread map
   2: Synthesize cpu map
   3: Synthesize stat config
   4: Synthesize stat
   5: Synthesize stat round
   6: Synthesize attr update
  #

After:

  # perf test Synth
  39: Synthesize thread map  : Ok
  41: Synthesize cpu map     : Ok
  42: Synthesize stat config : Ok
  43: Synthesize stat        : Ok
  44: Synthesize stat round  : Ok
  45: Synthesize attr update : Ok
  #
  # perf test list Synth
  39: Synthesize thread map
  41: Synthesize cpu map
  42: Synthesize stat config
  43: Synthesize stat
  44: Synthesize stat round
  45: Synthesize attr update
  #
Cc Adrian Hunter <[email protected]>
Cc David Ahern <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Matt Fleming <[email protected]>
Cc Michael Petlan <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Thomas Richter <[email protected]>
Cc Wang Nan <[email protected]>
Fixes e8210cefb7e1 ("perf tests: Introduce iterator function for tests")
---
 tools/perf/tests/builtin-test.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tools/perf/tests/builtin-test.c +3 -1
index 3ccfd58a8c3c..436e22993909 100644
@@ -465,10 +465,12 @@ static int perf_test__list(int argc, const char **argv)
 	int i = 0;
 
 	for_each_test(j, t) {
+		++i;
+
 		if (argc > 1 && !strstr(t->desc, argv[1]))
 			continue;
 
-		pr_info("%2d: %s\n", ++i, t->desc);
+		pr_info("%2d: %s\n", i, t->desc);
 	}
 
 	return 0;
Signature · 1 line
2.13.4
author maintainer
#7 lore raw

PATCH 7/19 perf test: Add 'struct test *' to the test functions

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

This way we'll be able to pass more test specific parameters without having to change this function signature.

Will be used by the upcoming 'shell tests', shell scripts that will call perf tools and check if they work as expected, comparing its effects on the system (think 'perf probe foo') the output produced, etc.

---
 tools/perf/arch/x86/include/arch-tests.h     |  11 ++-
 tools/perf/arch/x86/tests/insn-x86.c         |   2 +-
 tools/perf/arch/x86/tests/intel-cqm.c        |   2 +-
 tools/perf/arch/x86/tests/perf-time-to-tsc.c |   2 +-
 tools/perf/arch/x86/tests/rdpmc.c            |   2 +-
 tools/perf/tests/attr.c                      |   2 +-
 tools/perf/tests/backward-ring-buffer.c      |   2 +-
 tools/perf/tests/bitmap.c                    |   2 +-
 tools/perf/tests/bp_signal.c                 |   2 +-
 tools/perf/tests/bp_signal_overflow.c        |   2 +-
 tools/perf/tests/bpf.c                       |   4 +-
 tools/perf/tests/builtin-test.c              |   4 +-
 tools/perf/tests/clang.c                     |   4 +-
 tools/perf/tests/code-reading.c              |   2 +-
 tools/perf/tests/cpumap.c                    |   4 +-
 tools/perf/tests/dso-data.c                  |   6 +-
 tools/perf/tests/dwarf-unwind.c              |   2 +-
 tools/perf/tests/event-times.c               |   2 +-
 tools/perf/tests/event_update.c              |   2 +-
 tools/perf/tests/evsel-roundtrip-name.c      |   2 +-
 tools/perf/tests/evsel-tp-sched.c            |   2 +-
 tools/perf/tests/expr.c                      |   2 +-
 tools/perf/tests/fdarray.c                   |   4 +-
 tools/perf/tests/hists_cumulate.c            |   2 +-
 tools/perf/tests/hists_filter.c              |   2 +-
 tools/perf/tests/hists_link.c                |   2 +-
 tools/perf/tests/hists_output.c              |   2 +-
 tools/perf/tests/is_printable_array.c        |   2 +-
 tools/perf/tests/keep-tracking.c             |   2 +-
 tools/perf/tests/kmod-path.c                 |   2 +-
 tools/perf/tests/llvm.c                      |   2 +-
 tools/perf/tests/mmap-basic.c                |   2 +-
 tools/perf/tests/mmap-thread-lookup.c        |   2 +-
 tools/perf/tests/openat-syscall-all-cpus.c   |   2 +-
 tools/perf/tests/openat-syscall-tp-fields.c  |   2 +-
 tools/perf/tests/openat-syscall.c            |   2 +-
 tools/perf/tests/parse-events.c              |   2 +-
 tools/perf/tests/parse-no-sample-id-all.c    |   2 +-
 tools/perf/tests/perf-hooks.c                |   2 +-
 tools/perf/tests/perf-record.c               |   2 +-
 tools/perf/tests/pmu.c                       |   2 +-
 tools/perf/tests/python-use.c                |   2 +-
 tools/perf/tests/sample-parsing.c            |   2 +-
 tools/perf/tests/sdt.c                       |   4 +-
 tools/perf/tests/stat.c                      |   6 +-
 tools/perf/tests/sw-clock.c                  |   2 +-
 tools/perf/tests/switch-tracking.c           |   2 +-
 tools/perf/tests/task-exit.c                 |   2 +-
 tools/perf/tests/tests.h                     | 112 +++++++++++++--------------
 tools/perf/tests/thread-map.c                |   6 +-
 tools/perf/tests/thread-mg-share.c           |   2 +-
 tools/perf/tests/topology.c                  |   2 +-
 tools/perf/tests/unit_number__scnprintf.c    |   2 +-
 tools/perf/tests/vmlinux-kallsyms.c          |   2 +-
 54 files changed, 127 insertions(+), 124 deletions(-)
tools/perf/arch/x86/include/arch-tests.h +7 -4
index b48de2f5813c..4e0b806a7a0f 100644
@@ -1,11 +1,14 @@
 #ifndef ARCH_TESTS_H
 #define ARCH_TESTS_H
 
+#include <linux/compiler.h>
+struct test;
+
 /* Tests */
-int test__rdpmc(int subtest);
-int test__perf_time_to_tsc(int subtest);
-int test__insn_x86(int subtest);
-int test__intel_cqm_count_nmi_context(int subtest);
+int test__rdpmc(struct test *test __maybe_unused, int subtest);
+int test__perf_time_to_tsc(struct test *test __maybe_unused, int subtest);
+int test__insn_x86(struct test *test __maybe_unused, int subtest);
+int test__intel_cqm_count_nmi_context(struct test *test __maybe_unused, int subtest);
 
 #ifdef HAVE_DWARF_UNWIND_SUPPORT
 struct thread;
tools/perf/arch/x86/tests/insn-x86.c +1 -1
index 08d9b2bc185c..b3860586a0c2 100644
@@ -171,7 +171,7 @@ static int test_data_set(struct test_data *dat_set, int x86_64)
  * verbose (-v) option to see all the instructions and whether or not they
  * decoded successfuly.
  */
-int test__insn_x86(int subtest __maybe_unused)
+int test__insn_x86(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	int ret = 0;
 
tools/perf/arch/x86/tests/intel-cqm.c +1 -1
index f9713a71d77e..57f86b6e7d6f 100644
@@ -36,7 +36,7 @@ static pid_t spawn(void)
  * the last read counter value to avoid triggering a WARN_ON_ONCE() in
  * smp_call_function_many() caused by sending IPIs from NMI context.
  */
-int test__intel_cqm_count_nmi_context(int subtest __maybe_unused)
+int test__intel_cqm_count_nmi_context(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	struct perf_evlist *evlist = NULL;
 	struct perf_evsel *evsel = NULL;
tools/perf/arch/x86/tests/perf-time-to-tsc.c +1 -1
index e3ae9cff2b67..5dd7efb192ce 100644
@@ -37,7 +37,7 @@
  * %0 is returned, otherwise %-1 is returned.  If TSC conversion is not
  * supported then then the test passes but " (not supported)" is printed.
  */
-int test__perf_time_to_tsc(int subtest __maybe_unused)
+int test__perf_time_to_tsc(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	struct record_opts opts = {
 		.mmap_pages	     = UINT_MAX,
tools/perf/arch/x86/tests/rdpmc.c +1 -1
index 500cf96db979..17fec30a0b31 100644
@@ -154,7 +154,7 @@ static int __test__rdpmc(void)
 	return 0;
 }
 
-int test__rdpmc(int subtest __maybe_unused)
+int test__rdpmc(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	int status = 0;
 	int wret = 0;
tools/perf/tests/attr.c +1 -1
index 84c0eb598a67..c9aafed7da15 100644
@@ -169,7 +169,7 @@ static int run_dir(const char *d, const char *perf)
 	return system(cmd);
 }
 
-int test__attr(int subtest __maybe_unused)
+int test__attr(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	struct stat st;
 	char path_perf[PATH_MAX];
tools/perf/tests/backward-ring-buffer.c +1 -1
index 50f6d7afee58..d233ad336463 100644
@@ -75,7 +75,7 @@ static int do_test(struct perf_evlist *evlist, int mmap_pages,
 }
 
 
-int test__backward_ring_buffer(int subtest __maybe_unused)
+int test__backward_ring_buffer(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	int ret = TEST_SKIP, err, sample_count = 0, comm_count = 0;
 	char pid[16], sbuf[STRERR_BUFSIZE];
tools/perf/tests/bitmap.c +1 -1
index 9abe6c13090f..0d7c06584905 100644
@@ -40,7 +40,7 @@ static int test_bitmap(const char *str)
 	return ret;
 }
 
-int test__bitmap_print(int subtest __maybe_unused)
+int test__bitmap_print(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	TEST_ASSERT_VAL("failed to convert map", test_bitmap("1"));
 	TEST_ASSERT_VAL("failed to convert map", test_bitmap("1,5"));
tools/perf/tests/bp_signal.c +1 -1
index 39bbb97cd30a..97937e1bc53a 100644
@@ -164,7 +164,7 @@ static long long bp_count(int fd)
 	return count;
 }
 
-int test__bp_signal(int subtest __maybe_unused)
+int test__bp_signal(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	struct sigaction sa;
 	long long count1, count2, count3;
tools/perf/tests/bp_signal_overflow.c +1 -1
index 3b1ac6f31b15..61ecd8021f49 100644
@@ -57,7 +57,7 @@ static long long bp_count(int fd)
 #define EXECUTIONS 10000
 #define THRESHOLD  100
 
-int test__bp_signal_overflow(int subtest __maybe_unused)
+int test__bp_signal_overflow(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	struct perf_event_attr pe;
 	struct sigaction sa;
tools/perf/tests/bpf.c +2 -2
index 5876da126b58..4422ab636d30 100644
@@ -321,7 +321,7 @@ static int check_env(void)
 	return 0;
 }
 
-int test__bpf(int i)
+int test__bpf(struct test *test __maybe_unused, int i)
 {
 	int err;
 
@@ -351,7 +351,7 @@ const char *test__bpf_subtest_get_desc(int i __maybe_unused)
 	return NULL;
 }
 
-int test__bpf(int i __maybe_unused)
+int test__bpf(struct test *test __maybe_unused, int i __maybe_unused)
 {
 	pr_debug("Skip BPF test because BPF support is not compiled\n");
 	return TEST_SKIP;
tools/perf/tests/builtin-test.c +2 -2
index 436e22993909..0186abbad899 100644
@@ -179,7 +179,7 @@ static struct test generic_tests[] = {
 	},
 	{
 		.desc = "Session topology",
-		.func = test_session_topology,
+		.func = test__session_topology,
 	},
 	{
 		.desc = "BPF filter",
@@ -325,7 +325,7 @@ static int run_test(struct test *test, int subtest)
 			}
 		}
 
-		err = test->func(subtest);
+		err = test->func(test, subtest);
 		if (!dont_fork)
 			exit(err);
 	}
tools/perf/tests/clang.c +2 -2
index c5bb2203f5a9..c60ec916f0f2 100644
@@ -33,12 +33,12 @@ const char *test__clang_subtest_get_desc(int i)
 }
 
 #ifndef HAVE_LIBCLANGLLVM_SUPPORT
-int test__clang(int i __maybe_unused)
+int test__clang(struct test *test __maybe_unused, int i __maybe_unused)
 {
 	return TEST_SKIP;
 }
 #else
-int test__clang(int i)
+int test__clang(struct test *test __maybe_unused, int i)
 {
 	if (i < 0 || i >= (int)ARRAY_SIZE(clang_testcase_table))
 		return TEST_FAIL;
tools/perf/tests/code-reading.c +1 -1
index 94b7c7b02bde..761c5a448c56 100644
@@ -673,7 +673,7 @@ static int do_test_code_reading(bool try_kcore)
 	return err;
 }
 
-int test__code_reading(int subtest __maybe_unused)
+int test__code_reading(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	int ret;
 
tools/perf/tests/cpumap.c +2 -2
index 4478773cdb97..199702252270 100644
@@ -72,7 +72,7 @@ static int process_event_cpus(struct perf_tool *tool __maybe_unused,
 }
 
 
-int test__cpu_map_synthesize(int subtest __maybe_unused)
+int test__cpu_map_synthesize(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	struct cpu_map *cpus;
 
@@ -106,7 +106,7 @@ static int cpu_map_print(const char *str)
 	return !strcmp(buf, str);
 }
 
-int test__cpu_map_print(int subtest __maybe_unused)
+int test__cpu_map_print(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	TEST_ASSERT_VAL("failed to convert map", cpu_map_print("1"));
 	TEST_ASSERT_VAL("failed to convert map", cpu_map_print("1,5"));
tools/perf/tests/dso-data.c +3 -3
index 8f08df5861cb..30aead42d136 100644
@@ -112,7 +112,7 @@ static int dso__data_fd(struct dso *dso, struct machine *machine)
 	return fd;
 }
 
-int test__dso_data(int subtest __maybe_unused)
+int test__dso_data(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	struct machine machine;
 	struct dso *dso;
@@ -247,7 +247,7 @@ static int set_fd_limit(int n)
 	return setrlimit(RLIMIT_NOFILE, &rlim);
 }
 
-int test__dso_data_cache(int subtest __maybe_unused)
+int test__dso_data_cache(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	struct machine machine;
 	long nr_end, nr = open_files_cnt();
@@ -307,7 +307,7 @@ int test__dso_data_cache(int subtest __maybe_unused)
 	return 0;
 }
 
-int test__dso_data_reopen(int subtest __maybe_unused)
+int test__dso_data_reopen(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	struct machine machine;
 	long nr_end, nr = open_files_cnt();
tools/perf/tests/dwarf-unwind.c +1 -1
index 3e56d08f7995..2a7b9b47bbcb 100644
@@ -154,7 +154,7 @@ static noinline int krava_1(struct thread *thread)
 	return krava_2(thread);
 }
 
-int test__dwarf_unwind(int subtest __maybe_unused)
+int test__dwarf_unwind(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	struct machine *machine;
 	struct thread *thread;
tools/perf/tests/event-times.c +1 -1
index 634f20c631d8..b82b981c3259 100644
@@ -213,7 +213,7 @@ static int test_times(int (attach)(struct perf_evlist *),
  * and checks that enabled and running times
  * match.
  */
-int test__event_times(int subtest __maybe_unused)
+int test__event_times(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	int err, ret = 0;
 
tools/perf/tests/event_update.c +1 -1
index 63ecf21750eb..9484da2ec6b4 100644
@@ -76,7 +76,7 @@ static int process_event_cpus(struct perf_tool *tool __maybe_unused,
 	return 0;
 }
 
-int test__event_update(int subtest __maybe_unused)
+int test__event_update(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	struct perf_evlist *evlist;
 	struct perf_evsel *evsel;
tools/perf/tests/evsel-roundtrip-name.c +1 -1
index d2bea6f780f8..d32759b6e38a 100644
@@ -97,7 +97,7 @@ static int __perf_evsel__name_array_test(const char *names[], int nr_names)
 #define perf_evsel__name_array_test(names) \
 	__perf_evsel__name_array_test(names, ARRAY_SIZE(names))
 
-int test__perf_evsel__roundtrip_name_test(int subtest __maybe_unused)
+int test__perf_evsel__roundtrip_name_test(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	int err = 0, ret = 0;
 
tools/perf/tests/evsel-tp-sched.c +1 -1
index 1984b3bbfe15..5fc906d26c5c 100644
@@ -32,7 +32,7 @@ static int perf_evsel__test_field(struct perf_evsel *evsel, const char *name,
 	return ret;
 }
 
-int test__perf_evsel__tp_sched_test(int subtest __maybe_unused)
+int test__perf_evsel__tp_sched_test(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	struct perf_evsel *evsel = perf_evsel__newtp("sched", "sched_switch");
 	int ret = 0;
tools/perf/tests/expr.c +1 -1
index 6c6a3749aaf6..e93903295532 100644
@@ -13,7 +13,7 @@ static int test(struct parse_ctx *ctx, const char *e, double val2)
 	return 0;
 }
 
-int test__expr(int subtest __maybe_unused)
+int test__expr(struct test *t __maybe_unused, int subtest __maybe_unused)
 {
 	const char *p;
 	const char **other;
tools/perf/tests/fdarray.c +2 -2
index bc5982f42dc3..7d3a9e2ff897 100644
@@ -26,7 +26,7 @@ static int fdarray__fprintf_prefix(struct fdarray *fda, const char *prefix, FILE
 	return printed + fdarray__fprintf(fda, fp);
 }
 
-int test__fdarray__filter(int subtest __maybe_unused)
+int test__fdarray__filter(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	int nr_fds, expected_fd[2], fd, err = TEST_FAIL;
 	struct fdarray *fda = fdarray__new(5, 5);
@@ -104,7 +104,7 @@ int test__fdarray__filter(int subtest __maybe_unused)
 	return err;
 }
 
-int test__fdarray__add(int subtest __maybe_unused)
+int test__fdarray__add(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	int err = TEST_FAIL;
 	struct fdarray *fda = fdarray__new(2, 2);
tools/perf/tests/hists_cumulate.c +1 -1
index d549a9f2c41b..8d19c0200cb7 100644
@@ -687,7 +687,7 @@ static int test4(struct perf_evsel *evsel, struct machine *machine)
 	return err;
 }
 
-int test__hists_cumulate(int subtest __maybe_unused)
+int test__hists_cumulate(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	int err = TEST_FAIL;
 	struct machines machines;
tools/perf/tests/hists_filter.c +1 -1
index df9c91f49af1..755ca551b810 100644
@@ -101,7 +101,7 @@ static int add_hist_entries(struct perf_evlist *evlist,
 	return TEST_FAIL;
 }
 
-int test__hists_filter(int subtest __maybe_unused)
+int test__hists_filter(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	int err = TEST_FAIL;
 	struct machines machines;
tools/perf/tests/hists_link.c +1 -1
index a26cbb79e988..073c9c2856bc 100644
@@ -264,7 +264,7 @@ static int validate_link(struct hists *leader, struct hists *other)
 	return __validate_link(leader, 0) || __validate_link(other, 1);
 }
 
-int test__hists_link(int subtest __maybe_unused)
+int test__hists_link(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	int err = -1;
 	struct hists *hists, *first_hists;
tools/perf/tests/hists_output.c +1 -1
index 06e5080182d3..282d62eaebe2 100644
@@ -573,7 +573,7 @@ static int test5(struct perf_evsel *evsel, struct machine *machine)
 	return err;
 }
 
-int test__hists_output(int subtest __maybe_unused)
+int test__hists_output(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	int err = TEST_FAIL;
 	struct machines machines;
tools/perf/tests/is_printable_array.c +1 -1
index a5192f6a20d7..38f765767587 100644
@@ -4,7 +4,7 @@
 #include "debug.h"
 #include "print_binary.h"
 
-int test__is_printable_array(int subtest __maybe_unused)
+int test__is_printable_array(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	char buf1[] = { 'k', 'r', 4, 'v', 'a', 0 };
 	char buf2[] = { 'k', 'r', 'a', 'v', 4, 0 };
tools/perf/tests/keep-tracking.c +1 -1
index 614e45a3c603..739428603b71 100644
@@ -49,7 +49,7 @@ static int find_comm(struct perf_evlist *evlist, const char *comm)
  * when an event is disabled but a dummy software event is not disabled.  If the
  * test passes %0 is returned, otherwise %-1 is returned.
  */
-int test__keep_tracking(int subtest __maybe_unused)
+int test__keep_tracking(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	struct record_opts opts = {
 		.mmap_pages	     = UINT_MAX,
tools/perf/tests/kmod-path.c +1 -1
index 6cd9e5107f77..8b9d4ba06c0e 100644
@@ -50,7 +50,7 @@ static int test_is_kernel_module(const char *path, int cpumode, bool expect)
 #define M(path, c, e) \
 	TEST_ASSERT_VAL("failed", !test_is_kernel_module(path, c, e))
 
-int test__kmod_path__parse(int subtest __maybe_unused)
+int test__kmod_path__parse(struct test *t __maybe_unused, int subtest __maybe_unused)
 {
 	/* path                alloc_name  alloc_ext   kmod  comp   name     ext */
 	T("/xxxx/xxxx/x-x.ko", true      , true      , true, false, "[x_x]", NULL);
tools/perf/tests/llvm.c +1 -1
index 482b5365e68d..5187b50dbafe 100644
@@ -132,7 +132,7 @@ test_llvm__fetch_bpf_obj(void **p_obj_buf,
 	return ret;
 }
 
-int test__llvm(int subtest)
+int test__llvm(struct test *test __maybe_unused, int subtest)
 {
 	int ret;
 	void *obj_buf = NULL;
tools/perf/tests/mmap-basic.c +1 -1
index 15c770856aac..bc8a70ee46d8 100644
@@ -22,7 +22,7 @@
  * Then it checks if the number of syscalls reported as perf events by
  * the kernel corresponds to the number of syscalls made.
  */
-int test__basic_mmap(int subtest __maybe_unused)
+int test__basic_mmap(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	int err = -1;
 	union perf_event *event;
tools/perf/tests/mmap-thread-lookup.c +1 -1
index 6ea4d8a5d26b..f94a4196e7c9 100644
@@ -221,7 +221,7 @@ static int mmap_events(synth_cb synth)
  *
  * by using all thread objects.
  */
-int test__mmap_thread_lookup(int subtest __maybe_unused)
+int test__mmap_thread_lookup(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	/* perf_event__synthesize_threads synthesize */
 	TEST_ASSERT_VAL("failed with sythesizing all",
tools/perf/tests/openat-syscall-all-cpus.c +1 -1
index 1a74dd9fd067..87265117fd7f 100644
@@ -16,7 +16,7 @@
 #include "debug.h"
 #include "stat.h"
 
-int test__openat_syscall_event_on_all_cpus(int subtest __maybe_unused)
+int test__openat_syscall_event_on_all_cpus(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	int err = -1, fd, cpu;
 	struct cpu_map *cpus;
tools/perf/tests/openat-syscall-tp-fields.c +1 -1
index 9788fac91095..b6ee1c41f45d 100644
@@ -14,7 +14,7 @@
 #define AT_FDCWD       -100
 #endif
 
-int test__syscall_openat_tp_fields(int subtest __maybe_unused)
+int test__syscall_openat_tp_fields(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	struct record_opts opts = {
 		.target = {
tools/perf/tests/openat-syscall.c +1 -1
index e44506e21ee7..85bb6729d303 100644
@@ -10,7 +10,7 @@
 #include "debug.h"
 #include "tests.h"
 
-int test__openat_syscall_event(int subtest __maybe_unused)
+int test__openat_syscall_event(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	int err = -1, fd;
 	struct perf_evsel *evsel;
tools/perf/tests/parse-events.c +1 -1
index 812a053d1941..0f0b025faa4b 100644
@@ -1810,7 +1810,7 @@ static int test_pmu_events(void)
 	return ret;
 }
 
-int test__parse_events(int subtest __maybe_unused)
+int test__parse_events(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	int ret1, ret2 = 0;
 
tools/perf/tests/parse-no-sample-id-all.c +1 -1
index c6207db09f12..91867dcc39f0 100644
@@ -68,7 +68,7 @@ struct test_attr_event {
  *
  * Return: %0 on success, %-1 if the test fails.
  */
-int test__parse_no_sample_id_all(int subtest __maybe_unused)
+int test__parse_no_sample_id_all(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	int err;
 
tools/perf/tests/perf-hooks.c +1 -1
index 665ecc19671c..bf2517d6de70 100644
@@ -27,7 +27,7 @@ static void the_hook(void *_hook_flags)
 	*p = 0;
 }
 
-int test__perf_hooks(int subtest __maybe_unused)
+int test__perf_hooks(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	int hook_flags = 0;
 
tools/perf/tests/perf-record.c +1 -1
index d37cd9588cc0..19b650064b70 100644
@@ -37,7 +37,7 @@ static int sched__get_first_possible_cpu(pid_t pid, cpu_set_t *maskp)
 	return cpu;
 }
 
-int test__PERF_RECORD(int subtest __maybe_unused)
+int test__PERF_RECORD(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	struct record_opts opts = {
 		.target = {
tools/perf/tests/pmu.c +1 -1
index a6d7aef30030..9f7f589f9c54 100644
@@ -135,7 +135,7 @@ static struct list_head *test_terms_list(void)
 	return &terms;
 }
 
-int test__pmu(int subtest __maybe_unused)
+int test__pmu(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	char *format = test_format_dir_get();
 	LIST_HEAD(formats);
tools/perf/tests/python-use.c +1 -1
index fa79509da535..598a7e058ad4 100644
@@ -9,7 +9,7 @@
 
 extern int verbose;
 
-int test__python_use(int subtest __maybe_unused)
+int test__python_use(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	char *cmd;
 	int ret;
tools/perf/tests/sample-parsing.c +1 -1
index bac5c3885b3b..6d028f42b3cf 100644
@@ -292,7 +292,7 @@ static int do_test(u64 sample_type, u64 sample_regs, u64 read_format)
  * checks sample format bits separately and together.  If the test passes %0 is
  * returned, otherwise %-1 is returned.
  */
-int test__sample_parsing(int subtest __maybe_unused)
+int test__sample_parsing(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	const u64 rf[] = {4, 5, 6, 7, 12, 13, 14, 15};
 	u64 sample_type;
tools/perf/tests/sdt.c +2 -2
index d80171526f6f..a9903d9b8bc2 100644
@@ -71,7 +71,7 @@ static int search_cached_probe(const char *target,
 	return ret;
 }
 
-int test__sdt_event(int subtests __maybe_unused)
+int test__sdt_event(struct test *test __maybe_unused, int subtests __maybe_unused)
 {
 	int ret = TEST_FAIL;
 	char __tempdir[] = "./test-buildid-XXXXXX";
@@ -109,7 +109,7 @@ int test__sdt_event(int subtests __maybe_unused)
 	return ret;
 }
 #else
-int test__sdt_event(int subtests __maybe_unused)
+int test__sdt_event(struct test *test __maybe_unused, int subtests __maybe_unused)
 {
 	pr_debug("Skip SDT event test because SDT support is not compiled\n");
 	return TEST_SKIP;
tools/perf/tests/stat.c +3 -3
index 6a20ff2326bb..7f988a939036 100644
@@ -45,7 +45,7 @@ static int process_stat_config_event(struct perf_tool *tool __maybe_unused,
 	return 0;
 }
 
-int test__synthesize_stat_config(int subtest __maybe_unused)
+int test__synthesize_stat_config(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	struct perf_stat_config stat_config = {
 		.aggr_mode	= AGGR_CORE,
@@ -75,7 +75,7 @@ static int process_stat_event(struct perf_tool *tool __maybe_unused,
 	return 0;
 }
 
-int test__synthesize_stat(int subtest __maybe_unused)
+int test__synthesize_stat(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	struct perf_counts_values count;
 
@@ -101,7 +101,7 @@ static int process_stat_round_event(struct perf_tool *tool __maybe_unused,
 	return 0;
 }
 
-int test__synthesize_stat_round(int subtest __maybe_unused)
+int test__synthesize_stat_round(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	TEST_ASSERT_VAL("failed to synthesize stat_config",
 		!perf_event__synthesize_stat_round(NULL, 0xdeadbeef, PERF_STAT_ROUND_TYPE__INTERVAL,
tools/perf/tests/sw-clock.c +1 -1
index 828494db4a19..d88511f6072c 100644
@@ -124,7 +124,7 @@ static int __test__sw_clock_freq(enum perf_sw_ids clock_id)
 	return err;
 }
 
-int test__sw_clock_freq(int subtest __maybe_unused)
+int test__sw_clock_freq(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	int ret;
 
tools/perf/tests/switch-tracking.c +1 -1
index 65474fd80da7..2acd78555192 100644
@@ -306,7 +306,7 @@ static int process_events(struct perf_evlist *evlist,
  * evsel->system_wide and evsel->tracking flags (respectively) with other events
  * sometimes enabled or disabled.
  */
-int test__switch_tracking(int subtest __maybe_unused)
+int test__switch_tracking(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	const char *sched_switch = "sched:sched_switch";
 	struct switch_tracking switch_tracking = { .tids = NULL, };
tools/perf/tests/task-exit.c +1 -1
index cf00ebad2ef5..f0881d0dd9c9 100644
@@ -32,7 +32,7 @@ static void workload_exec_failed_signal(int signo __maybe_unused,
  * if the number of exit event reported by the kernel is 1 or not
  * in order to check the kernel returns correct number of event.
  */
-int test__task_exit(int subtest __maybe_unused)
+int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	int err = -1;
 	union perf_event *event;
tools/perf/tests/tests.h +56 -56

130 lines not on this page · raw message

tools/perf/tests/thread-map.c +3 -3
index a63d6945807b..b3423c744f46 100644
@@ -9,7 +9,7 @@
 #define NAME	(const char *) "perf"
 #define NAMEUL	(unsigned long) NAME
 
-int test__thread_map(int subtest __maybe_unused)
+int test__thread_map(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	struct thread_map *map;
 
@@ -76,7 +76,7 @@ static int process_event(struct perf_tool *tool __maybe_unused,
 	return 0;
 }
 
-int test__thread_map_synthesize(int subtest __maybe_unused)
+int test__thread_map_synthesize(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	struct thread_map *threads;
 
@@ -95,7 +95,7 @@ int test__thread_map_synthesize(int subtest __maybe_unused)
 	return 0;
 }
 
-int test__thread_map_remove(int subtest __maybe_unused)
+int test__thread_map_remove(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	struct thread_map *threads;
 	char *str;
tools/perf/tests/thread-mg-share.c +1 -1
index 76686dd6f5ec..b9c7f58db6c4 100644
@@ -4,7 +4,7 @@
 #include "map.h"
 #include "debug.h"
 
-int test__thread_mg_share(int subtest __maybe_unused)
+int test__thread_mg_share(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	struct machines machines;
 	struct machine *machine;
tools/perf/tests/topology.c +1 -1
index 803f893550d6..19b0561fd6f6 100644
@@ -86,7 +86,7 @@ static int check_cpu_topology(char *path, struct cpu_map *map)
 	return 0;
 }
 
-int test_session_topology(int subtest __maybe_unused)
+int test__session_topology(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	char path[PATH_MAX];
 	struct cpu_map *map;
tools/perf/tests/unit_number__scnprintf.c +1 -1
index 44589de084b8..15cd1cf8c129 100644
@@ -5,7 +5,7 @@
 #include "units.h"
 #include "debug.h"
 
-int test__unit_number__scnprint(int subtest __maybe_unused)
+int test__unit_number__scnprint(struct test *t __maybe_unused, int subtest __maybe_unused)
 {
 	struct {
 		u64		 n;
tools/perf/tests/vmlinux-kallsyms.c +1 -1
index 8456175fc234..86cb8868f67f 100644
@@ -11,7 +11,7 @@
 
 #define UM(x) kallsyms_map->unmap_ip(kallsyms_map, (x))
 
-int test__vmlinux_matches_kallsyms(int subtest __maybe_unused)
+int test__vmlinux_matches_kallsyms(struct test *test __maybe_unused, int subtest __maybe_unused)
 {
 	int err = -1;
 	struct rb_node *nd;
Signature · 1 line
2.13.4
author maintainer
#8 lore raw

PATCH 8/19 perf test: Add infrastructure to run shell based tests

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

To allow testing by directly using perf tools in scripts, checking that the effects on the system are the ones expected and that the output produced is as well the desired one.

For instance, adding a probe at a well known location with 'perf probe', then checking that the results from using that probe to record are the desired ones, etc.

The next csets will introduce tests using this new testing infrastructure.

The scripts should return 0 for Ok, 1 for FAIL and 2 for SKIP.

---
 tools/perf/tests/builtin-test.c | 170 +++++++++++++++++++++++++++++++++++++++-
 tools/perf/tests/tests.h        |   1 +
 2 files changed, 170 insertions(+), 1 deletion(-)
tools/perf/tests/builtin-test.c +169 -1
index 0186abbad899..2bd158e3c02f 100644
@@ -6,7 +6,10 @@
 #include <errno.h>
 #include <unistd.h>
 #include <string.h>
+#include <sys/types.h>
+#include <dirent.h>
 #include <sys/wait.h>
+#include <sys/stat.h>
 #include "builtin.h"
 #include "hist.h"
 #include "intlist.h"
@@ -14,8 +17,10 @@
 #include "debug.h"
 #include "color.h"
 #include <subcmd/parse-options.h>
+#include "string2.h"
 #include "symbol.h"
 #include <linux/kernel.h>
+#include <subcmd/exec-cmd.h>
 
 static bool dont_fork;
 
@@ -383,12 +388,143 @@ static int test_and_print(struct test *t, bool force_skip, int subtest)
 	return err;
 }
 
+static const char *shell_test__description(char *description, size_t size,
+					   const char *path, const char *name)
+{
+	FILE *fp;
+	char filename[PATH_MAX];
+
+	path__join(filename, sizeof(filename), path, name);
+	fp = fopen(filename, "r");
+	if (!fp)
+		return NULL;
+
+	description = fgets(description, size, fp);
+	fclose(fp);
+
+	return description ? trim(description + 1) : NULL;
+}
+
+#define for_each_shell_test(dir, ent)		\
+	while ((ent = readdir(dir)) != NULL)	\
+		if (ent->d_type == DT_REG && ent->d_name[0] != '.')
+
+static const char *shell_tests__dir(char *path, size_t size)
+{
+	const char *devel_dirs[] = { "./tools/perf/tests", "./tests", };
+        char *exec_path;
+	unsigned int i;
+
+	for (i = 0; i < ARRAY_SIZE(devel_dirs); ++i) {
+		struct stat st;
+		if (!lstat(devel_dirs[i], &st)) {
+			scnprintf(path, size, "%s/shell", devel_dirs[i]);
+			if (!lstat(devel_dirs[i], &st))
+				return path;
+		}
+	}
+
+        /* Then installed path. */
+        exec_path = get_argv_exec_path();
+        scnprintf(path, size, "%s/tests/shell", exec_path);
+	free(exec_path);
+	return path;
+}
+
+static int shell_tests__max_desc_width(void)
+{
+	DIR *dir;
+	struct dirent *ent;
+	char path_dir[PATH_MAX];
+	const char *path = shell_tests__dir(path_dir, sizeof(path_dir));
+	int width = 0;
+
+	if (path == NULL)
+		return -1;
+
+	dir = opendir(path);
+	if (!dir)
+		return -1;
+
+	for_each_shell_test(dir, ent) {
+		char bf[256];
+		const char *desc = shell_test__description(bf, sizeof(bf), path, ent->d_name);
+
+		if (desc) {
+			int len = strlen(desc);
+
+			if (width < len)
+				width = len;
+		}
+	}
+
+	closedir(dir);
+	return width;
+}
+
+struct shell_test {
+	const char *dir;
+	const char *file;
+};
+
+static int shell_test__run(struct test *test, int subdir __maybe_unused)
+{
+	int err;
+	char script[PATH_MAX];
+	struct shell_test *st = test->priv;
+
+	path__join(script, sizeof(script), st->dir, st->file);
+
+	err = system(script);
+	if (!err)
+		return TEST_OK;
+
+	return WEXITSTATUS(err) == 2 ? TEST_SKIP : TEST_FAIL;
+}
+
+static int run_shell_tests(int argc, const char *argv[], int i, int width)
+{
+	DIR *dir;
+	struct dirent *ent;
+	char path_dir[PATH_MAX];
+	struct shell_test st = {
+		.dir = shell_tests__dir(path_dir, sizeof(path_dir)),
+	};
+
+	if (st.dir == NULL)
+		return -1;
+
+	dir = opendir(st.dir);
+	if (!dir)
+		return -1;
+
+	for_each_shell_test(dir, ent) {
+		int curr = i++;
+		char desc[256];
+		struct test test = {
+			.desc = shell_test__description(desc, sizeof(desc), st.dir, ent->d_name),
+			.func = shell_test__run,
+			.priv = &st,
+		};
+
+		if (!perf_test__matches(&test, curr, argc, argv))
+			continue;
+
+		st.file = ent->d_name;
+		pr_info("%2d: %-*s:", i, width, test.desc);
+		test_and_print(&test, false, -1);
+	}
+
+	closedir(dir);
+	return 0;
+}
+
 static int __cmd_test(int argc, const char *argv[], struct intlist *skiplist)
 {
 	struct test *t;
 	unsigned int j;
 	int i = 0;
-	int width = 0;
+	int width = shell_tests__max_desc_width();
 
 	for_each_test(j, t) {
 		int len = strlen(t->desc);
@@ -455,6 +591,36 @@ static int __cmd_test(int argc, const char *argv[], struct intlist *skiplist)
 		}
 	}
 
+	return run_shell_tests(argc, argv, i, width);
+}
+
+static int perf_test__list_shell(int argc, const char **argv, int i)
+{
+	DIR *dir;
+	struct dirent *ent;
+	char path_dir[PATH_MAX];
+	const char *path = shell_tests__dir(path_dir, sizeof(path_dir));
+
+	if (path == NULL)
+		return -1;
+
+	dir = opendir(path);
+	if (!dir)
+		return -1;
+
+	for_each_shell_test(dir, ent) {
+		char bf[256];
+		const char *desc = shell_test__description(bf, sizeof(bf), path, ent->d_name);
+
+		++i;
+
+		if (argc > 1 && !strstr(desc, argv[1]))
+			continue;
+
+		pr_info("%2d: %s\n", i, desc);
+	}
+
+	closedir(dir);
 	return 0;
 }
 
@@ -473,6 +639,8 @@ static int perf_test__list(int argc, const char **argv)
 		pr_info("%2d: %s\n", i, t->desc);
 	}
 
+	perf_test__list_shell(argc, argv, i);
+
 	return 0;
 }
 
tools/perf/tests/tests.h +1 -0
index bc207ac48fde..c46ae818aac8 100644
@@ -35,6 +35,7 @@ struct test {
 		const char *(*get_desc)(int subtest);
 	} subtest;
 	bool (*is_supported)(void);
+	void *priv;
 };
 
 /* Tests */
Signature · 1 line
2.13.4
author maintainer
#9 lore raw

PATCH 9/19 perf test: Make 'list' use same filtering code as main 'perf test'

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

Before:

  # perf test Synth
  39: Synthesize thread map  : Ok
  41: Synthesize cpu map     : Ok
  42: Synthesize stat config : Ok
  43: Synthesize stat        : Ok
  44: Synthesize stat round  : Ok
  45: Synthesize attr update : Ok
  # perf test list Synth
  #

After:

  # perf test Synth
  39: Synthesize thread map  : Ok
  41: Synthesize cpu map     : Ok
  42: Synthesize stat config : Ok
  43: Synthesize stat        : Ok
  44: Synthesize stat round  : Ok
  45: Synthesize attr update : Ok
  # perf test list Synth
  39: Synthesize thread map
  41: Synthesize cpu map
  42: Synthesize stat config
  43: Synthesize stat
  44: Synthesize stat round
  45: Synthesize attr update
  #
---
 tools/perf/tests/builtin-test.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
tools/perf/tests/builtin-test.c +10 -8
index 2bd158e3c02f..9ecc44e68990 100644
@@ -609,15 +609,16 @@ static int perf_test__list_shell(int argc, const char **argv, int i)
 		return -1;
 
 	for_each_shell_test(dir, ent) {
+		int curr = i++;
 		char bf[256];
-		const char *desc = shell_test__description(bf, sizeof(bf), path, ent->d_name);
-
-		++i;
+		struct test t = {
+			.desc = shell_test__description(bf, sizeof(bf), path, ent->d_name),
+		};
 
-		if (argc > 1 && !strstr(desc, argv[1]))
+		if (!perf_test__matches(&t, curr, argc, argv))
 			continue;
 
-		pr_info("%2d: %s\n", i, desc);
+		pr_info("%2d: %s\n", i, t.desc);
 	}
 
 	closedir(dir);
@@ -631,9 +632,10 @@ static int perf_test__list(int argc, const char **argv)
 	int i = 0;
 
 	for_each_test(j, t) {
-		++i;
+		int curr = i++;
 
-		if (argc > 1 && !strstr(t->desc, argv[1]))
+		if (!perf_test__matches(t, curr, argc, argv) ||
+		    (t->is_supported && !t->is_supported()))
 			continue;
 
 		pr_info("%2d: %s\n", i, t->desc);
@@ -668,7 +670,7 @@ int cmd_test(int argc, const char **argv)
 
 	argc = parse_options_subcommand(argc, argv, test_options, test_subcommands, test_usage, 0);
 	if (argc >= 1 && !strcmp(argv[0], "list"))
-		return perf_test__list(argc, argv);
+		return perf_test__list(argc - 1, argv + 1);
 
 	symbol_conf.priv_size = sizeof(int);
 	symbol_conf.sort_by_name = true;
Signature · 1 line
2.13.4
author maintainer
#10 lore raw

PATCH 10/19 perf test shell: Add 'probe_vfs_getname' shell test

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

First perf shell test:

  # perf test vfs_getname
  60: Add vfs_getname probe to get syscall args filenames: Ok
  #

In verbose mode:

  # perf test -v vfs_getname
  60: Add vfs_getname probe to get syscall args filenames:
  --- start ---
  test child forked, pid 19146
  Added new event:
    probe:vfs_getname    (on getname_flags:72 with pathname=result->name:string)

You can now use it in all perf tools, such as:

perf record -e probe:vfs_getname -aR sleep 1

test child finished with 0
---- end ----
Add vfs_getname probe to get syscall args filenames: Ok #

And if the vmlinux file is not found:

  # mv ../build/v4.12.0-rc6+/vmlinux ../build/v4.12.0-rc6+/vmlinux.hidden
  # perf test vfs_getname
  60: Add vfs_getname probe to get syscall args filenames: Skip
  #
---
 tools/perf/tests/shell/probe_vfs_getname.sh | 30 +++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100755 tools/perf/tests/shell/probe_vfs_getname.sh
tools/perf/tests/shell/probe_vfs_getname.sh new file +30 -0
new file mode 100755
index 000000000000..d5f5248de927
@@ -0,0 +1,30 @@
+# Add vfs_getname probe to get syscall args filenames
+#
+# Arnaldo Carvalho de Melo <[email protected]>, 2017
+
+perf probe -l | grep -q probe:vfs_getname
+had_vfs_getname=$?
+
+cleanup_probe_vfs_getname() {
+	if [ $had_vfs_getname -eq 1 ] ; then
+		perf probe -q -d probe:vfs_getname
+	fi
+}
+
+add_probe_vfs_getname() {
+	local verbose=$1
+	if [ $had_vfs_getname -eq 1 ] ; then
+               line=$(perf probe -L getname_flags | egrep 'result.*=.*filename;' | sed -r 's/[[:space:]]+([[:digit:]]+)[[:space:]]+result->uptr.*/\1/')
+               perf probe $verbose "vfs_getname=getname_flags:${line} pathname=result->name:string"
+	fi
+}
+
+skip_if_no_debuginfo() {
+	add_probe_vfs_getname -v 2>&1 | grep -q "^Failed to find the path for kernel" && return 2
+	return 1
+}
+
+add_probe_vfs_getname || skip_if_no_debuginfo
+err=$?
+cleanup_probe_vfs_getname
+exit $err
Signature · 1 line
2.13.4
author maintainer
#11 lore raw

PATCH 11/19 perf test shell: Install shell tests

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

Now that we have shell tests, install them.

Developers don't need this pass, as 'perf test' will look first at the in tree scripts at tools/perf/tests/shell/.

---
 tools/perf/Makefile.perf | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tools/perf/Makefile.perf +3 -1
index c1f7884979e2..eb1356774c7d 100644
@@ -760,7 +760,9 @@ install-tests: all install-gtk
 		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'; \
 		$(INSTALL) tests/attr.py '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'; \
 		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'; \
-		$(INSTALL) tests/attr/* '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'
+		$(INSTALL) tests/attr/* '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'; \
+		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell'; \
+		$(INSTALL) tests/shell/*.sh '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell'
 
 install-bin: install-tools install-tests install-traceevent-plugins
 
Signature · 1 line
2.13.4
author maintainer
#12 lore raw

PATCH 12/19 perf test shell: Move vfs_getname probe function to lib

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

Multiple tests will be able to reuse these functions, to test things like perf report, 'trace', etc, using this probe.

---
 tools/perf/Makefile.perf                        |  4 +++-
 tools/perf/tests/shell/lib/probe_vfs_getname.sh | 28 +++++++++++++++++++++++++
 tools/perf/tests/shell/probe_vfs_getname.sh     | 22 +------------------
 3 files changed, 32 insertions(+), 22 deletions(-)
 create mode 100644 tools/perf/tests/shell/lib/probe_vfs_getname.sh
tools/perf/Makefile.perf +3 -1
index eb1356774c7d..70ddc65f898d 100644
@@ -762,7 +762,9 @@ install-tests: all install-gtk
 		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'; \
 		$(INSTALL) tests/attr/* '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'; \
 		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell'; \
-		$(INSTALL) tests/shell/*.sh '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell'
+		$(INSTALL) tests/shell/*.sh '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell'; \
+		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/lib'; \
+		$(INSTALL) tests/shell/lib/*.sh '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/lib'
 
 install-bin: install-tools install-tests install-traceevent-plugins
 
tools/perf/tests/shell/lib/probe_vfs_getname.sh new file +28 -0
new file mode 100644
index 000000000000..42308040f882
@@ -0,0 +1,28 @@
+# Arnaldo Carvalho de Melo <[email protected]>, 2017
+
+perf probe -l | grep -q probe:vfs_getname
+had_vfs_getname=$?
+
+cleanup_probe_vfs_getname() {
+	if [ $had_vfs_getname -eq 1 ] ; then
+		perf probe -q -d probe:vfs_getname
+	fi
+}
+
+add_probe_vfs_getname() {
+	local verbose=$1
+	if [ $had_vfs_getname -eq 1 ] ; then
+               line=$(perf probe -L getname_flags | egrep 'result.*=.*filename;' | sed -r 's/[[:space:]]+([[:digit:]]+)[[:space:]]+result->uptr.*/\1/')
+               perf probe $verbose "vfs_getname=getname_flags:${line} pathname=result->name:string"
+	fi
+}
+
+skip_if_no_debuginfo() {
+	add_probe_vfs_getname -v 2>&1 | grep -q "^Failed to find the path for kernel" && return 2
+	return 1
+}
+
+skip_if_no_debuginfo() {
+	add_probe_vfs_getname -v 2>&1 | grep -q "^Failed to find the path for kernel" && return 2
+	return 1
+}
tools/perf/tests/shell/probe_vfs_getname.sh +1 -21
index d5f5248de927..c8380137beef 100755
@@ -2,27 +2,7 @@
 #
 # Arnaldo Carvalho de Melo <[email protected]>, 2017
 
-perf probe -l | grep -q probe:vfs_getname
-had_vfs_getname=$?
-
-cleanup_probe_vfs_getname() {
-	if [ $had_vfs_getname -eq 1 ] ; then
-		perf probe -q -d probe:vfs_getname
-	fi
-}
-
-add_probe_vfs_getname() {
-	local verbose=$1
-	if [ $had_vfs_getname -eq 1 ] ; then
-               line=$(perf probe -L getname_flags | egrep 'result.*=.*filename;' | sed -r 's/[[:space:]]+([[:digit:]]+)[[:space:]]+result->uptr.*/\1/')
-               perf probe $verbose "vfs_getname=getname_flags:${line} pathname=result->name:string"
-	fi
-}
-
-skip_if_no_debuginfo() {
-	add_probe_vfs_getname -v 2>&1 | grep -q "^Failed to find the path for kernel" && return 2
-	return 1
-}
+. $(dirname $0)/lib/probe_vfs_getname.sh
 
 add_probe_vfs_getname || skip_if_no_debuginfo
 err=$?
Signature · 1 line
2.13.4
author maintainer
#13 lore raw

PATCH 13/19 perf test shell: Add test using probe:vfs_getname and verifying results

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

This test uses the 'perf test shell' library to add probe:vfs_getname to the system then use it with 'perf record' using 'touch' to write to a temp file, then checks that that was captured by the vfs_getname probe in the generated perf.data file, with the temp file name as the pathname argument.

Using it:

  # perf test "Use vfs_getname"
  60: Use vfs_getname probe to get syscall args filenames: Ok
  # perf test -v "Use vfs_getname"
  60: Use vfs_getname probe to get syscall args filenames:
  --- start ---
  test child forked, pid 16414
  Added new event:
    probe:vfs_getname    (on getname_flags:72 with pathname=result->name:string)

You can now use it in all perf tools, such as:

perf record -e probe:vfs_getname -aR sleep 1

Recording open file:
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.022 MB /tmp/vaca.perf.data.QZsn7 (13 samples) ] Looking at perf.data file for vfs_getname records for the file we touched:

             touch 16421 [002] 1255152.879561: probe:vfs_getname: (ffffffffa626e608) pathname="/tmp/vaca.l10SL"

test child finished with 0
---- end ----
Use vfs_getname probe to get syscall args filenames: Ok #

---
 .../tests/shell/record+script_probe_vfs_getname.sh | 37 ++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100755 tools/perf/tests/shell/record+script_probe_vfs_getname.sh
tools/perf/tests/shell/record+script_probe_vfs_getname.sh new file +37 -0
new file mode 100755
index 000000000000..2725c5db699a
@@ -0,0 +1,37 @@
+# Use vfs_getname probe to get syscall args filenames
+
+# Uses the 'perf test shell' library to add probe:vfs_getname to the system
+# then use it with 'perf record' using 'touch' to write to a temp file, then
+# checks that that was captured by the vfs_getname probe in the generated
+# perf.data file, with the temp file name as the pathname argument.
+
+# Arnaldo Carvalho de Melo <[email protected]>, 2017
+
+. $(dirname $0)/lib/probe_vfs_getname.sh
+
+perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX)
+file=$(mktemp /tmp/temporary_file.XXXXX)
+
+record_open_file() {
+	echo "Recording open file:"
+	perf record -o ${perfdata} -e probe:vfs_getname touch $file
+}
+
+perf_script_filenames() {
+	echo "Looking at perf.data file for vfs_getname records for the file we touched:"
+	perf script -i ${perfdata} | \
+	egrep " +touch +[0-9]+ +\[[0-9]+\] +[0-9]+\.[0-9]+: +probe:vfs_getname: +\([[:xdigit:]]+\) +pathname=\"${file}\""
+}
+
+add_probe_vfs_getname || skip_if_no_debuginfo
+err=$?
+if [ $err -ne 0 ] ; then
+	exit $err
+fi
+
+record_open_file && perf_script_filenames
+err=$?
+rm -f ${perfdata}
+rm -f ${file}
+cleanup_probe_vfs_getname
+exit $err
Signature · 1 line
2.13.4
author maintainer
#14 lore raw

PATCH 14/19 perf test shell: Add test using vfs_getname + 'perf trace'

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

Uses the 'perf test shell' library to add probe:vfs_getname to the system then use it with 'perf trace' using 'touch' to write to a temp file, then checks that that was captured by the vfs_getname was used by 'perf trace', that already handles "probe:vfs_getname" if present, and used in the "open" syscall "filename" argument beautifier.

Testing it:

  # perf test "trace + vfs_getname"
  61: Check open filename arg using perf trace + vfs_getname: Ok
  #
  # perf test -v "trace + vfs_getname"
  61: Check open filename arg using perf trace + vfs_getname:
  --- start ---
  test child forked, pid 30846
  Added new event:
    probe:vfs_getname    (on getname_flags:72 with pathname=result->name:string)

You can now use it in all perf tools, such as:

perf record -e probe:vfs_getname -aR sleep 1

       2.237 ( 0.012 ms): touch/30855 open(filename: /tmp/temporary_file.kmoWQ, flags: CREAT|NOCTTY|NONBLOCK|WRONLY, mode: IRUGO|IWUGO) = 3

test child finished with 0
---- end ----
Check open filename arg using perf trace + vfs_getname: Ok #

---
 tools/perf/tests/shell/trace+probe_vfs_getname.sh | 31 +++++++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100755 tools/perf/tests/shell/trace+probe_vfs_getname.sh
tools/perf/tests/shell/trace+probe_vfs_getname.sh new file +31 -0
new file mode 100755
index 000000000000..d0fba0c5e354
@@ -0,0 +1,31 @@
+# Check open filename arg using perf trace + vfs_getname
+
+# Uses the 'perf test shell' library to add probe:vfs_getname to the system
+# then use it with 'perf trace' using 'touch' to write to a temp file, then
+# checks that that was captured by the vfs_getname was used by 'perf trace',
+# that already handles "probe:vfs_getname" if present, and used in the
+# "open" syscall "filename" argument beautifier.
+
+# Arnaldo Carvalho de Melo <[email protected]>, 2017
+
+. $(dirname $0)/lib/probe_vfs_getname.sh
+
+file=$(mktemp /tmp/temporary_file.XXXXX)
+
+trace_open_vfs_getname() {
+	perf trace -e open touch $file 2>&1 | \
+	egrep " +[0-9]+\.[0-9]+ +\( +[0-9]+\.[0-9]+ ms\): +touch\/[0-9]+ open\(filename: +${file}, +flags: CREAT\|NOCTTY\|NONBLOCK\|WRONLY, +mode: +IRUGO\|IWUGO\) += +[0-9]+$"
+}
+
+
+add_probe_vfs_getname || skip_if_no_debuginfo
+err=$?
+if [ $err -ne 0 ] ; then
+	exit $err
+fi
+
+trace_open_vfs_getname
+err=$?
+rm -f ${file}
+cleanup_probe_vfs_getname
+exit $err
Signature · 1 line
2.13.4
author maintainer
#15 lore raw

PATCH 15/19 perf util: Take elf_name as const string in dso__demangle_sym

In reply to Arnaldo Carvalho de Melo

From: Milian Wolff <[email protected]>

The input string is not modified and thus can be passed in as a pointer to const data.

---
 tools/perf/util/symbol-elf.c     | 2 +-
 tools/perf/util/symbol-minimal.c | 2 +-
 tools/perf/util/symbol.h         | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
tools/perf/util/symbol-elf.c +1 -1
index 502505cf236a..7cf18f14e152 100644
@@ -391,7 +391,7 @@ int dso__synthesize_plt_symbols(struct dso *dso, struct symsrc *ss, struct map *
 	return 0;
 }
 
-char *dso__demangle_sym(struct dso *dso, int kmodule, char *elf_name)
+char *dso__demangle_sym(struct dso *dso, int kmodule, const char *elf_name)
 {
 	return demangle_sym(dso, kmodule, elf_name);
 }
tools/perf/util/symbol-minimal.c +1 -1
index 40bf5d4c0bfd..1a5aa35b0100 100644
@@ -377,7 +377,7 @@ void symbol__elf_init(void)
 
 char *dso__demangle_sym(struct dso *dso __maybe_unused,
 			int kmodule __maybe_unused,
-			char *elf_name __maybe_unused)
+			const char *elf_name __maybe_unused)
 {
 	return NULL;
 }
tools/perf/util/symbol.h +1 -1
index 41ebba9a2eb2..f0b08810d7fa 100644
@@ -306,7 +306,7 @@ int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *syms_ss,
 int dso__synthesize_plt_symbols(struct dso *dso, struct symsrc *ss,
 				struct map *map);
 
-char *dso__demangle_sym(struct dso *dso, int kmodule, char *elf_name);
+char *dso__demangle_sym(struct dso *dso, int kmodule, const char *elf_name);
 
 void __symbols__insert(struct rb_root *symbols, struct symbol *sym, bool kernel);
 void symbols__insert(struct rb_root *symbols, struct symbol *sym);
Signature · 1 line
2.13.4
author maintainer
#16 lore raw

PATCH 16/19 perf srcline: Do not consider empty files as valid srclines

In reply to Arnaldo Carvalho de Melo

From: Milian Wolff <[email protected]>

Sometimes we get a non-null, but empty, string for the filename from bfd. This then results in srclines of the form ":0", which is different from the canonical SRCLINE_UNKNOWN in the form "??:0". Set the file to NULL if it is empty to fix this.

---
 tools/perf/util/srcline.c | 6 ++++++
 1 file changed, 6 insertions(+)
tools/perf/util/srcline.c +6 -0
index ebc88a74e67b..ed8e8d2de942 100644
@@ -155,6 +155,9 @@ static void find_address_in_section(bfd *abfd, asection *section, void *data)
 	a2l->found = bfd_find_nearest_line(abfd, section, a2l->syms, pc - vma,
 					   &a2l->filename, &a2l->funcname,
 					   &a2l->line);
+
+	if (a2l->filename && !strlen(a2l->filename))
+		a2l->filename = NULL;
 }
 
 static struct a2l_data *addr2line_init(const char *path)
@@ -248,6 +251,9 @@ static int addr2line(const char *dso_name, u64 addr,
 					     &a2l->funcname, &a2l->line) &&
 		       cnt++ < MAX_INLINE_NEST) {
 
+			if (a2l->filename && !strlen(a2l->filename))
+				a2l->filename = NULL;
+
 			if (node != NULL) {
 				if (inline_list__append_dso_a2l(dso, node))
 					return 0;
Signature · 1 line
2.13.4
author maintainer
#17 lore raw

PATCH 17/19 perf record: Fix wrong size in perf_record_mmap for last kernel module

In reply to Arnaldo Carvalho de Melo

From: Thomas Richter <[email protected]>

During work on perf report for s390 I ran into the following issue:

0 0x318 [0x78]: PERF_RECORD_MMAP -1/0:

        [0x3ff804d6990(0xfffffc007fb2966f) @ 0]:
        x /lib/modules/4.12.0perf1+/kernel/drivers/s390/net/qeth_l2.ko

This is a PERF_RECORD_MMAP entry of the perf.data file with an invalid module size for qeth_l2.ko (the s390 ethernet device driver).

Even a mainframe does not have 0xfffffc007fb2966f bytes of main memory.

It turned out that this wrong size is created by the perf record command. What happens is this function call sequence from __cmd_record():

perf_session__new():
perf_session__create_kernel_maps():
machine__create_kernel_maps():
machine__create_modules(): Creates map for all loaded kernel modules.
modules__parse(): Reads /proc/modules and extracts module name and
load address (1st and last column)
machine__create_module(): Called for every module found in /proc/modules.
Creates a new map for every module found and enters module name and start address into the map. Since the module end address is unknown it is set to zero.

This ends up with a kernel module map list sorted by module start addresses. All module end addresses are zero.

Last machine__create_kernel_maps() calls function map_groups__fixup_end(). This function iterates through the maps and assigns each map entry's end address the successor map entry start address. The last entry of the map group has no successor, so ~0 is used as end to consume the remaining memory.

Later __cmd_record calls function record__synthesize() which in turn calls perf_event__synthesize_kernel_mmap() and perf_event__synthesize_modules() to create PERF_REPORT_MMAP entries into the perf.data file.

On s390 this results in the last module qeth_l2.ko (which has highest start address, see module table:

        [root@s8360047 perf]# cat /proc/modules
        qeth_l2 86016 1 - Live 0x000003ff804d6000
        qeth 266240 1 qeth_l2, Live 0x000003ff80296000
        ccwgroup 24576 1 qeth, Live 0x000003ff80218000
        vmur 36864 0 - Live 0x000003ff80182000
        qdio 143360 2 qeth_l2,qeth, Live 0x000003ff80002000
        [root@s8360047 perf]# )

to be the last entry and its map has an end address of ~0.

When the PERF_RECORD_MMAP entry is created for kernel module qeth_l2.ko its start address and length is written. The length is calculated in line:

    event->mmap.len   = pos->end - pos->start;

and results in 0xffffffffffffffff - 0x3ff804d6990(*) = 0xfffffc007fb2966f

(*) On s390 the module start address is actually determined by a __weak function named arch__fix_module_text_start() in machine__create_module().

I think this improvable. We can use the module size (2nd column of /proc/modules) to get each loaded kernel module size and calculate its end address. Only for map entries which do not have a valid end address (end is still zero) we can use the heuristic we have now, that is use successor start address or ~0.

LPU-Reference: [email protected]

---
 tools/perf/util/machine.c    |  4 +++-
 tools/perf/util/symbol-elf.c |  2 +-
 tools/perf/util/symbol.c     | 21 ++++++++++++++-------
 tools/perf/util/symbol.h     |  2 +-
 4 files changed, 19 insertions(+), 10 deletions(-)
tools/perf/util/machine.c +3 -1
index d4df353051af..5c8eacaca4f4 100644
@@ -1138,7 +1138,8 @@ int __weak arch__fix_module_text_start(u64 *start __maybe_unused,
 	return 0;
 }
 
-static int machine__create_module(void *arg, const char *name, u64 start)
+static int machine__create_module(void *arg, const char *name, u64 start,
+				  u64 size)
 {
 	struct machine *machine = arg;
 	struct map *map;
@@ -1149,6 +1150,7 @@ static int machine__create_module(void *arg, const char *name, u64 start)
 	map = machine__findnew_module_map(machine, start, name);
 	if (map == NULL)
 		return -1;
+	map->end = start + size;
 
 	dso__kernel_module_get_build_id(map->dso, machine->root_dir);
 
tools/perf/util/symbol-elf.c +1 -1
index 7cf18f14e152..98deabb9b47e 100644
@@ -1442,7 +1442,7 @@ static int kcore_copy__parse_kallsyms(struct kcore_copy_info *kci,
 
 static int kcore_copy__process_modules(void *arg,
 				       const char *name __maybe_unused,
-				       u64 start)
+				       u64 start, u64 size __maybe_unused)
 {
 	struct kcore_copy_info *kci = arg;
 
tools/perf/util/symbol.c +14 -7
index 971b990557b4..5909ee4c7ade 100644
@@ -233,7 +233,8 @@ void __map_groups__fixup_end(struct map_groups *mg, enum map_type type)
 		goto out_unlock;
 
 	for (next = map__next(curr); next; next = map__next(curr)) {
-		curr->end = next->start;
+		if (!curr->end)
+			curr->end = next->start;
 		curr = next;
 	}
 
@@ -241,7 +242,8 @@ void __map_groups__fixup_end(struct map_groups *mg, enum map_type type)
 	 * We still haven't the actual symbols, so guess the
 	 * last map final address.
 	 */
-	curr->end = ~0ULL;
+	if (!curr->end)
+		curr->end = ~0ULL;
 
 out_unlock:
 	pthread_rwlock_unlock(&maps->lock);
@@ -552,7 +554,7 @@ void dso__sort_by_name(struct dso *dso, enum map_type type)
 
 int modules__parse(const char *filename, void *arg,
 		   int (*process_module)(void *arg, const char *name,
-					 u64 start))
+					 u64 start, u64 size))
 {
 	char *line = NULL;
 	size_t n;
@@ -565,8 +567,8 @@ int modules__parse(const char *filename, void *arg,
 
 	while (1) {
 		char name[PATH_MAX];
-		u64 start;
-		char *sep;
+		u64 start, size;
+		char *sep, *endptr;
 		ssize_t line_len;
 
 		line_len = getline(&line, &n, file);
@@ -598,7 +600,11 @@ int modules__parse(const char *filename, void *arg,
 
 		scnprintf(name, sizeof(name), "[%s]", line);
 
-		err = process_module(arg, name, start);
+		size = strtoul(sep + 1, &endptr, 0);
+		if (*endptr != ' ' && *endptr != '\t')
+			continue;
+
+		err = process_module(arg, name, start, size);
 		if (err)
 			break;
 	}
@@ -945,7 +951,8 @@ static struct module_info *find_module(const char *name,
 	return NULL;
 }
 
-static int __read_proc_modules(void *arg, const char *name, u64 start)
+static int __read_proc_modules(void *arg, const char *name, u64 start,
+			       u64 size __maybe_unused)
 {
 	struct rb_root *modules = arg;
 	struct module_info *mi;
tools/perf/util/symbol.h +1 -1
index f0b08810d7fa..b221671070e2 100644
@@ -273,7 +273,7 @@ int filename__read_build_id(const char *filename, void *bf, size_t size);
 int sysfs__read_build_id(const char *filename, void *bf, size_t size);
 int modules__parse(const char *filename, void *arg,
 		   int (*process_module)(void *arg, const char *name,
-					 u64 start));
+					 u64 start, u64 size));
 int filename__read_debuglink(const char *filename, char *debuglink,
 			     size_t size);
 
Signature · 1 line
2.13.4
author maintainer
#18 lore raw

PATCH 18/19 perf report: Fix module symbol adjustment for s390x

In reply to Arnaldo Carvalho de Melo

From: Thomas Richter <[email protected]>

The 'perf report' tool does not display the addresses of kernel module symbols correctly.

For example symbol qeth_send_ipa_cmd in kernel module qeth.ko has this relative address for function qeth_send_ipa_cmd():

[root@s8360047 linux]# nm -g drivers/s390/net/qeth.ko | fgrep send_ipa_cmd 0000000000013088 T qeth_send_ipa_cmd

The module is loaded at address:

[root@s8360047 linux]# cat /sys/module/qeth/sections/.text 0x000003ff80296d20
[root@s8360047 linux]#

This should result in a start address of:

0x13088 + 0x3ff80296d20 = 0x3ff802a9da8

Using crash to verify the address on a live system:

[root@s8360046 linux]# crash vmlinux

crash 7.1.9++
Copyright (C) 2002-2016 Red Hat, Inc. Copyright (C) 2004, 2005, 2006, 2010 IBM Corporation

[...]

crash> mod -s qeth drivers/s390/net/qeth.ko

       MODULE       NAME        SIZE  OBJECT FILE
       3ff8028d700  qeth      151552  drivers/s390/net/qeth.ko

crash> sym qeth_send_ipa_cmd
3ff802a9da8 (T) qeth_send_ipa_cmd [qeth] /root/linux/drivers/s390/net/qeth_core_main.c: 2944 crash>

Now perf report displays the address of symbol qeth_send_ipa_cmd:
symbol__new:

qeth_send_ipa_cmd 0x130f0-0x132ce

There is a difference of 0x68 between the entry in the symbol table (see nm command above) and perf. The difference is from the offset the .text segment of qeth.ko:

[root@s8360047 perf]# readelf -a drivers/s390/net/qeth.ko Section Headers:

  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
  [ 0]                   NULL             0000000000000000  00000000
       0000000000000000  0000000000000000           0     0     0
  [ 1] .note.gnu.build-i NOTE             0000000000000000  00000040
       0000000000000024  0000000000000000   A       0     0     4
  [ 2] .text             PROGBITS         0000000000000000  00000068
       000000000001c8a0  0000000000000000  AX       0     0     8

As seen the .text segment has an offset of 0x68 with start address 0x0. Therefore 0x68 is added to the address of qeth_send_ipa_cmd and thus 0x13088 + 0x68 = 0x130f0 is displayed.

This is wrong, perf report needs to display the start address of symbol qeth_send_ipa_cmd at 0x13088 + qeth.ko.text section start address.

The qeth.ko module .text start address is available in the qeth.ko DSO map. Just identify the kernel module symbols and correct the addresses.

With the fix I see this correct address for symbol: symbol__new:
qeth_send_ipa_cmd 0x3ff802a9da8-0x3ff802a9f86

LPU-Reference: [email protected]

---
 tools/perf/arch/s390/util/sym-handling.c | 7 +++++++
 tools/perf/util/symbol-elf.c             | 8 +++++++-
 tools/perf/util/symbol.h                 | 3 +++
 3 files changed, 17 insertions(+), 1 deletion(-)
tools/perf/arch/s390/util/sym-handling.c +7 -0
index b6cd056ccf71..e103f6e46afe 100644
@@ -19,4 +19,11 @@ bool elf__needs_adjust_symbols(GElf_Ehdr ehdr)
 	return ehdr.e_type == ET_REL || ehdr.e_type == ET_DYN;
 }
 
+void arch__adjust_sym_map_offset(GElf_Sym *sym,
+				 GElf_Shdr *shdr __maybe_unused,
+				 struct map *map)
+{
+	if (map->type == MAP__FUNCTION)
+		sym->st_value += map->start;
+}
 #endif
tools/perf/util/symbol-elf.c +7 -1
index 98deabb9b47e..a70479061fce 100644
@@ -793,6 +793,12 @@ static u64 ref_reloc(struct kmap *kmap)
 void __weak arch__sym_update(struct symbol *s __maybe_unused,
 		GElf_Sym *sym __maybe_unused) { }
 
+void __weak arch__adjust_sym_map_offset(GElf_Sym *sym, GElf_Shdr *shdr,
+				       struct map *map __maybe_unused)
+{
+	sym->st_value -= shdr->sh_addr - shdr->sh_offset;
+}
+
 int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *syms_ss,
 		  struct symsrc *runtime_ss, int kmodule)
 {
@@ -973,7 +979,7 @@ int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *syms_ss,
 
 			/* Adjust symbol to map to file offset */
 			if (adjust_kernel_syms)
-				sym.st_value -= shdr.sh_addr - shdr.sh_offset;
+				arch__adjust_sym_map_offset(&sym, &shdr, map);
 
 			if (strcmp(section_name,
 				   (curr_dso->short_name +
tools/perf/util/symbol.h +3 -0
index b221671070e2..d00a012cfdfb 100644
@@ -343,6 +343,9 @@ int setup_intlist(struct intlist **list, const char *list_str,
 #ifdef HAVE_LIBELF_SUPPORT
 bool elf__needs_adjust_symbols(GElf_Ehdr ehdr);
 void arch__sym_update(struct symbol *s, GElf_Sym *sym);
+void arch__adjust_sym_map_offset(GElf_Sym *sym,
+				 GElf_Shdr *shdr __maybe_unused,
+				 struct map *map __maybe_unused);
 #endif
 
 #define SYMBOL_A 0
Signature · 1 line
2.13.4
author maintainer
#19 lore raw

PATCH 19/19 perf test shell: Add uprobes + backtrace ping test

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

Installs a probe on libc's inet_pton function, that will use uprobes, then use 'perf trace' on a ping to localhost asking for just one packet with the a backtrace 3 levels deep, check that it is what we expect. This needs no debuginfo package, all is done using the libc ELF symtab and the CFI info in the binaries.

Testing it:

  # perf test ping
  61: probe libc's inet_pton & backtrace it with ping       : Ok

In verbose mode:

  # perf test -v ping
  61: probe libc's inet_pton & backtrace it with ping       :
  --- start ---
  test child forked, pid 1007
  PING ::1(::1) 56 data bytes
  64 bytes from ::1: icmp_seq=1 ttl=64 time=0.058 ms
  --- ::1 ping statistics ---
  1 packets transmitted, 1 received, 0% packet loss, time 0ms
  rtt min/avg/max/mdev = 0.058/0.058/0.058/0.000 ms
  0.000 probe_libc:inet_pton:(7f75fce12a20))
  __GI___inet_pton (/usr/lib64/libc-2.24.so)
  getaddrinfo (/usr/lib64/libc-2.24.so)
  _init (/usr/bin/ping)
  test child finished with 0
  ---- end ----
  probe libc's inet_pton & backtrace it with ping: Ok
  #
---
 .../perf/tests/shell/trace+probe_libc_inet_pton.sh | 40 ++++++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100755 tools/perf/tests/shell/trace+probe_libc_inet_pton.sh
tools/perf/tests/shell/trace+probe_libc_inet_pton.sh new file +40 -0
new file mode 100755
index 000000000000..1b9a276e2ace
@@ -0,0 +1,40 @@
+# probe libc's inet_pton & backtrace it with ping
+
+# Installs a probe on libc's inet_pton function, that will use uprobes,
+# then use 'perf trace' on a ping to localhost asking for just one packet
+# with the a backtrace 3 levels deep, check that it is what we expect.
+# This needs no debuginfo package, all is done using the libc ELF symtab
+# and the CFI info in the binaries.
+
+# Arnaldo Carvalho de Melo <[email protected]>, 2017
+
+trace_libc_inet_pton_backtrace() {
+	idx=0
+	expected[0]="PING.*bytes"
+	expected[1]="64 bytes from ::1.*"
+	expected[2]=".*ping statistics.*"
+	expected[3]=".*packets transmitted.*"
+	expected[4]="rtt min.*"
+	expected[5]="[0-9]+\.[0-9]+[[:space:]]+probe_libc:inet_pton:\([[:xdigit:]]+\)"
+	expected[6]=".*inet_pton[[:space:]]\(/usr/lib.*/libc-[0-9]+\.[0-9]+\.so\)$"
+	expected[7]="getaddrinfo[[:space:]]\(/usr/lib.*/libc-[0-9]+\.[0-9]+\.so\)$"
+	expected[8]=".*\(.*/bin/ping.*\)$"
+
+	perf trace --no-syscalls -e probe_libc:inet_pton/max-stack=3/ ping -6 -c 1 ::1 |& grep -v ^$ | while read line ; do
+		echo $line
+		echo "$line" | egrep -q "${expected[$idx]}"
+		if [ $? -ne 0 ] ; then
+			printf "FAIL: expected backtrace entry %d \"%s\" got \"%s\"\n" $idx "${expected[$idx]}" "$line"
+			exit 1
+		fi
+		let idx+=1
+		[ $idx -eq 9 ] && break
+	done
+}
+
+perf probe -q /lib64/libc-*.so inet_pton && \
+trace_libc_inet_pton_backtrace
+err=$?
+rm -f ${file}
+perf probe -q -d probe_libc:inet_pton
+exit $err
Signature · 1 line
2.13.4
#20 lore raw
In reply to Arnaldo Carvalho de Melo
Quoted 160 lines · Arnaldo Carvalho de Melo

Hi Ingo,

Please consider pulling,

- Arnaldo

Test results at the end of this message, as usual.

The following changes since commit 82119cbe8e1e32cc2a941393e59816e731681310:

Merge tag 'perf-core-for-mingo-4.14-20170801' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2017-08-10 17:07:02 +0200)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-4.14-20170814

for you to fetch changes up to 8fc375d7d36c72b4c2d55f5c24be022a939295d4:

perf test shell: Add uprobes + backtrace ping test (2017-08-11 16:18:49 -0300)

----------------------------------------------------------------
perf/core improvements and fixes:

Infrastructure:

- Do not consider empty files as valid srclines (Milian Wolff)

- Fix wrong size in perf_record_mmap for last kernel module,
which resulted in erroneous symbol resolution in at least s390x (Thomas Richter)

- Add missing newline to expr parser error messages (Andi Kleen)

- Fix saved values rbtree lookup in 'perf stat' (Andi Kleen)

- Add support for shell based tests in 'perf test', add a few that run 'perf probe', 'perf trace', using kprobes, uprobes to check the output of those tools and the effects on the system, checking, for instance, DWARF backtraces from uprobes (Arnaldo Carvalho de Melo)

Arch specific:

- Add ppc64le to audit uname list in the python scripting support (Naveen N. Rao)

- Update POWER9 vendor events tables (Sukadev Bhattiprolu)

- Fix module symbol adjustment for s390x (Thomas Richter)

----------------------------------------------------------------
Andi Kleen (2):
perf stat: Fix saved values rbtree lookup
perf tools: Add missing newline to expr parser error messages

Arnaldo Carvalho de Melo (10):
perf test: Make 'list' subcommand match main 'perf test' numbering/matching perf test: Add 'struct test *' to the test functions
perf test: Add infrastructure to run shell based tests
perf test: Make 'list' use same filtering code as main 'perf test' perf test shell: Add 'probe_vfs_getname' shell test
perf test shell: Install shell tests
perf test shell: Move vfs_getname probe function to lib
perf test shell: Add test using probe:vfs_getname and verifying results perf test shell: Add test using vfs_getname + 'perf trace' perf test shell: Add uprobes + backtrace ping test

Milian Wolff (2):
perf util: Take elf_name as const string in dso__demangle_sym perf srcline: Do not consider empty files as valid srclines

Naveen N. Rao (1):
perf scripting python: Add ppc64le to audit uname list

Sukadev Bhattiprolu (2):
perf vendor events powerpc: remove suffix in mapfile perf vendor events powerpc: Update POWER9 events

Thomas Richter (2):
perf record: Fix wrong size in perf_record_mmap for last kernel module perf report: Fix module symbol adjustment for s390x

 tools/perf/Makefile.perf                           |    6 +-
 tools/perf/arch/s390/util/sym-handling.c           |    7 +
 tools/perf/arch/x86/include/arch-tests.h           |   11 +-
 tools/perf/arch/x86/tests/insn-x86.c               |    2 +-
 tools/perf/arch/x86/tests/intel-cqm.c              |    2 +-
 tools/perf/arch/x86/tests/perf-time-to-tsc.c       |    2 +-
 tools/perf/arch/x86/tests/rdpmc.c                  |    2 +-
 tools/perf/pmu-events/arch/powerpc/mapfile.csv     |   20 +-
 .../perf/pmu-events/arch/powerpc/power9/cache.json |  191 +-
 .../arch/powerpc/power9/floating-point.json        |   42 +-
 .../pmu-events/arch/powerpc/power9/frontend.json   |  517 ++--
 .../pmu-events/arch/powerpc/power9/marked.json     |  905 +++----
 .../pmu-events/arch/powerpc/power9/memory.json     |  178 +-
 .../perf/pmu-events/arch/powerpc/power9/other.json | 2768 ++++++++++++++++----
 .../pmu-events/arch/powerpc/power9/pipeline.json   |  779 +++---
 tools/perf/pmu-events/arch/powerpc/power9/pmc.json |  167 +-
 .../arch/powerpc/power9/translation.json           |  314 +--
 .../python/Perf-Trace-Util/lib/Perf/Trace/Util.py  |    1 +
 tools/perf/tests/attr.c                            |    2 +-
 tools/perf/tests/backward-ring-buffer.c            |    2 +-
 tools/perf/tests/bitmap.c                          |    2 +-
 tools/perf/tests/bp_signal.c                       |    2 +-
 tools/perf/tests/bp_signal_overflow.c              |    2 +-
 tools/perf/tests/bpf.c                             |    4 +-
 tools/perf/tests/builtin-test.c                    |  184 +-
 tools/perf/tests/clang.c                           |    4 +-
 tools/perf/tests/code-reading.c                    |    2 +-
 tools/perf/tests/cpumap.c                          |    4 +-
 tools/perf/tests/dso-data.c                        |    6 +-
 tools/perf/tests/dwarf-unwind.c                    |    2 +-
 tools/perf/tests/event-times.c                     |    2 +-
 tools/perf/tests/event_update.c                    |    2 +-
 tools/perf/tests/evsel-roundtrip-name.c            |    2 +-
 tools/perf/tests/evsel-tp-sched.c                  |    2 +-
 tools/perf/tests/expr.c                            |    2 +-
 tools/perf/tests/fdarray.c                         |    4 +-
 tools/perf/tests/hists_cumulate.c                  |    2 +-
 tools/perf/tests/hists_filter.c                    |    2 +-
 tools/perf/tests/hists_link.c                      |    2 +-
 tools/perf/tests/hists_output.c                    |    2 +-
 tools/perf/tests/is_printable_array.c              |    2 +-
 tools/perf/tests/keep-tracking.c                   |    2 +-
 tools/perf/tests/kmod-path.c                       |    2 +-
 tools/perf/tests/llvm.c                            |    2 +-
 tools/perf/tests/mmap-basic.c                      |    2 +-
 tools/perf/tests/mmap-thread-lookup.c              |    2 +-
 tools/perf/tests/openat-syscall-all-cpus.c         |    2 +-
 tools/perf/tests/openat-syscall-tp-fields.c        |    2 +-
 tools/perf/tests/openat-syscall.c                  |    2 +-
 tools/perf/tests/parse-events.c                    |    2 +-
 tools/perf/tests/parse-no-sample-id-all.c          |    2 +-
 tools/perf/tests/perf-hooks.c                      |    2 +-
 tools/perf/tests/perf-record.c                     |    2 +-
 tools/perf/tests/pmu.c                             |    2 +-
 tools/perf/tests/python-use.c                      |    2 +-
 tools/perf/tests/sample-parsing.c                  |    2 +-
 tools/perf/tests/sdt.c                             |    4 +-
 tools/perf/tests/shell/lib/probe_vfs_getname.sh    |   28 +
 tools/perf/tests/shell/probe_vfs_getname.sh        |   10 +
 .../tests/shell/record+script_probe_vfs_getname.sh |   37 +
 .../perf/tests/shell/trace+probe_libc_inet_pton.sh |   40 +
 tools/perf/tests/shell/trace+probe_vfs_getname.sh  |   31 +
 tools/perf/tests/stat.c                            |    6 +-
 tools/perf/tests/sw-clock.c                        |    2 +-
 tools/perf/tests/switch-tracking.c                 |    2 +-
 tools/perf/tests/task-exit.c                       |    2 +-
 tools/perf/tests/tests.h                           |  113 +-
 tools/perf/tests/thread-map.c                      |    6 +-
 tools/perf/tests/thread-mg-share.c                 |    2 +-
 tools/perf/tests/topology.c                        |    2 +-
 tools/perf/tests/unit_number__scnprintf.c          |    2 +-
 tools/perf/tests/vmlinux-kallsyms.c                |    2 +-
 tools/perf/util/expr.y                             |    2 +-
 tools/perf/util/machine.c                          |    4 +-
 tools/perf/util/srcline.c                          |    6 +
 tools/perf/util/stat-shadow.c                      |    6 +-
 tools/perf/util/symbol-elf.c                       |   12 +-
 tools/perf/util/symbol-minimal.c                   |    2 +-
Quoted 8 lines
 tools/perf/util/symbol.c                           |   21 +-
 tools/perf/util/symbol.h                           |    7 +-
 80 files changed, 4054 insertions(+), 2479 deletions(-)
 create mode 100644 tools/perf/tests/shell/lib/probe_vfs_getname.sh
 create mode 100755 tools/perf/tests/shell/probe_vfs_getname.sh
 create mode 100755 tools/perf/tests/shell/record+script_probe_vfs_getname.sh
 create mode 100755 tools/perf/tests/shell/trace+probe_libc_inet_pton.sh
 create mode 100755 tools/perf/tests/shell/trace+probe_vfs_getname.sh

Pulled, thanks a lot Arnaldo!

Ingo

#21 lore raw

Em Mon, Aug 14, 2017 at 07:39:48PM +0200, Ingo Molnar escreveu:

Quoted 7 lines · Arnaldo Carvalho de Melo
Quoted 6 lines

Infrastructure:

- Add support for shell based tests in 'perf test', add a few that run 'perf probe', 'perf trace', using kprobes, uprobes to check the output of those tools and the effects on the system, checking, for instance, DWARF backtraces from uprobes (Arnaldo Carvalho de Melo)

<SNIP>

Quoted 7 lines
Quoted 5 lines
 create mode 100644 tools/perf/tests/shell/lib/probe_vfs_getname.sh
 create mode 100755 tools/perf/tests/shell/probe_vfs_getname.sh
 create mode 100755 tools/perf/tests/shell/record+script_probe_vfs_getname.sh
 create mode 100755 tools/perf/tests/shell/trace+probe_libc_inet_pton.sh
 create mode 100755 tools/perf/tests/shell/trace+probe_vfs_getname.sh

Pulled, thanks a lot Arnaldo!

Thanks! I'm working with Kim Phillips to fix some issues he noticed while testing on his ARM systems where 'perf probe' is not available, my perf/core branch has several fixes to handle this that will be in my next pull request.

- Arnaldo