linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [GIT PULL 00/35] perf/core improvements and fixes
@ 2019-03-07 17:43 Arnaldo Carvalho de Melo
  2019-03-07 17:43 ` [PATCH 01/35] perf, bpf: Consider events with attr.bpf_event as side-band events Arnaldo Carvalho de Melo
                   ` (35 more replies)
  0 siblings, 36 replies; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-03-07 17:43 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel,
	linux-perf-users, Arnaldo Carvalho de Melo, Adrian Hunter,
	Alexander Shishkin, Andi Kleen, Gustavo A . R . Silva, Jin Yao,
	Mathias Krause, Michael Sartain, Nageswara R Sastry,
	Ravi Bangoria, Seeteena Thoufeek, Song Liu, Tony Jones,
	Travis Downs, Yang Wei, 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 c978b9460fe1d4a1e1effa0abd6bd69b18a098a8:

  Merge tag 'perf-core-for-mingo-5.1-20190225' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2019-02-28 08:29:50 +0100)

are available in the Git repository at:

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

for you to fetch changes up to b8f7d86b5849ea7bb84bddc0345a3799049764d4:

  perf data: Force perf_data__open|close zero data->file.path (2019-03-06 18:21:00 -0300)

----------------------------------------------------------------
perf bpf:

  Arnaldo Carvalho de Melo:

  - Automatically add BTF ELF markers to 'perf trace' BPF programs, so that
    tools such as 'bpftool map dump' can pretty print map keys and values.

perf c2c:

  Jiri Olsa:

  - Fix report for empty NUMA node.

perf diff:

  Jin Yao:

  - Support --time, --cpu, --pid and --tid filter options.

perf probe:

  Arnaldo Carvalho de Melo:

  - Clarify error message about not finding kernel modules debuginfo.

perf record:

  Jiri Olsa:

  - Fixup probing for max attr.precise_ip.

perf trace:

  Arnaldo Carvalho de Melo:

  - Add missing %s lost in the 'msg_flags' recvmmsg arg when adding prefix suppression logic.

perf annotate:

  Arnaldo Carvalho de Melo:

  - Calculate the max instruction name, align column to that, removing the
    hardcoded max 6 chars and cope with instructions with names longer than that,
    such as vpmovmskb, vpcmpeqb, etc.

kernel:

  Song Liu:

  - Consider events with attr.bpf_event set as side-band.

  Gustavo A. R. Silva:

  - Mark expected switch fall-through in perf_event_parse_addr_filter().

Libraries:

  Jiri Olsa:

  - Fix leaks and double frees on error paths.

libtraceevent:

  Tony Jones:

  - Fix buffer overflow in arg_eval().

python scripting:

  Tony Jones:

  - More python3 fixes.

Trivial:

  Yang Wei:

  - Remove needless extra semicolon in clang C++ glue code.

Intel PT/BTS:

  Adrian Hunter:

  - Improve auxtrace address filter error message when there is no DSO.

  - Fix divide by zero when TSC is not available.

  - Further improvements to the export to sqlite/posgresql python scripts
    and to the GUI sqlviewer, exporting 'parent_id' so that we have enable
    the creation of call trees.

  Andi Kleen:

  - Generalize function to copy from thread addr space from intel-bts code.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

----------------------------------------------------------------
Adrian Hunter (10):
      perf auxtrace: Improve address filter error message when there is no DSO
      perf intel-pt: Fix divide by zero when TSC is not available
      perf db-export: Add calls parent_id to enable creation of call trees
      perf scripts python: export-to-sqlite.py: Export calls parent_id
      perf scripts python: export-to-postgresql.py: Fix invalid input syntax for integer error
      perf scripts python: export-to-postgresql.py: Export calls parent_id
      perf scripts python: exported-sql-viewer.py: Factor out TreeWindowBase
      perf scripts python: exported-sql-viewer.py: Improve TreeModel abstraction
      perf scripts python: exported-sql-viewer.py: Factor out CallGraphModelBase
      perf scripts python: exported-sql-viewer.py: Add call tree

Andi Kleen (1):
      perf thread: Generalize function to copy from thread addr space from intel-bts code

Arnaldo Carvalho de Melo (4):
      perf probe: Clarify error message about not finding kernel modules debuginfo
      perf beauty msg_flags: Add missing %s lost when adding prefix suppression logic
      perf bpf: Automatically add BTF ELF markers
      perf annotate: Calculate the max instruction name, align column to that

Gustavo A. R. Silva (1):
      perf: Mark expected switch fall-through

Jin Yao (4):
      perf time-utils: Refactor time range parsing code
      perf diff: Support --time filter option
      perf diff: Support --cpu filter option
      perf diff: Support --pid/--tid filter options

Jiri Olsa (7):
      perf c2c: Fix c2c report for empty numa node
      perf hist: Add error path into hist_entry__init
      perf hist: Fix memory leak of srcline
      perf tools: Read and store caps/max_precise in perf_pmu
      perf evsel: Probe for precise_ip with simple attr
      perf session: Fix double free in perf_data__close
      perf data: Force perf_data__open|close zero data->file.path

Song Liu (1):
      perf, bpf: Consider events with attr.bpf_event as side-band events

Tony Jones (6):
      tools lib traceevent: Fix buffer overflow in arg_eval
      perf script python: Remove mixed indentation
      perf script python: Add Python3 support to futex-contention.py
      perf script python: add Python3 support to check-perf-trace.py
      perf script python: Add Python3 support to event_analyzing_sample.py
      perf script python: Add Python3 support to intel-pt-events.py

Yang Wei (1):
      perf clang: Remove needless extra semicolon

 kernel/events/core.c                               |   4 +-
 tools/lib/traceevent/event-parse.c                 |   2 +-
 tools/perf/Documentation/perf-diff.txt             |  56 ++++
 tools/perf/arch/arm64/annotate/instructions.c      |   2 +-
 tools/perf/arch/s390/annotate/instructions.c       |   2 +-
 tools/perf/builtin-c2c.c                           |   8 +-
 tools/perf/builtin-diff.c                          | 168 +++++++++-
 tools/perf/builtin-report.c                        |  38 +--
 tools/perf/builtin-script.c                        |  39 +--
 tools/perf/include/bpf/bpf.h                       |   8 +-
 tools/perf/scripts/python/check-perf-trace.py      |  76 ++---
 tools/perf/scripts/python/compaction-times.py      |   8 +-
 .../perf/scripts/python/event_analyzing_sample.py  |  48 +--
 tools/perf/scripts/python/export-to-postgresql.py  |  16 +-
 tools/perf/scripts/python/export-to-sqlite.py      |  12 +-
 tools/perf/scripts/python/exported-sql-viewer.py   | 354 ++++++++++++++++-----
 .../perf/scripts/python/failed-syscalls-by-pid.py  |  38 +--
 tools/perf/scripts/python/futex-contention.py      |  10 +-
 tools/perf/scripts/python/intel-pt-events.py       |  60 ++--
 tools/perf/scripts/python/mem-phys-addr.py         |   7 +-
 tools/perf/scripts/python/net_dropmonitor.py       |   2 +-
 tools/perf/scripts/python/netdev-times.py          |  12 +-
 tools/perf/scripts/python/sched-migration.py       |   6 +-
 tools/perf/scripts/python/sctop.py                 |  13 +-
 tools/perf/scripts/python/stackcollapse.py         |   2 +-
 tools/perf/scripts/python/syscall-counts-by-pid.py |  47 ++-
 tools/perf/scripts/python/syscall-counts.py        |  31 +-
 tools/perf/trace/beauty/msg_flags.c                |   2 +-
 tools/perf/util/annotate.c                         |  74 +++--
 tools/perf/util/annotate.h                         |   7 +-
 tools/perf/util/auxtrace.c                         |   3 +-
 tools/perf/util/c++/clang.cpp                      |   2 +-
 tools/perf/util/data.c                             |   4 +-
 tools/perf/util/db-export.c                        |  15 +-
 tools/perf/util/db-export.h                        |   3 +-
 tools/perf/util/evlist.c                           |  25 +-
 tools/perf/util/evsel.c                            |   8 -
 tools/perf/util/hist.c                             |  51 +--
 tools/perf/util/intel-bts.c                        |  20 +-
 tools/perf/util/intel-pt.c                         |   2 +
 tools/perf/util/pmu.c                              |  14 +
 tools/perf/util/pmu.h                              |   1 +
 tools/perf/util/probe-event.c                      |   9 +-
 .../util/scripting-engines/trace-event-python.c    |   8 +-
 tools/perf/util/session.c                          |   4 +-
 tools/perf/util/thread-stack.c                     |  16 +-
 tools/perf/util/thread-stack.h                     |   6 +-
 tools/perf/util/thread.c                           |  23 ++
 tools/perf/util/thread.h                           |   3 +
 tools/perf/util/time-utils.c                       |  51 ++-
 tools/perf/util/time-utils.h                       |   6 +
 51 files changed, 978 insertions(+), 448 deletions(-)

Test results:

The first ones are container based builds of tools/perf with and without libelf
support.  Where clang is available, it is also used to build perf with/without
libelf, and building with LIBCLANGLLVM=1 (built-in clang) with gcc and clang
when clang and its devel libraries are installed.

The objtool and samples/bpf/ builds are disabled now that I'm switching from
using the sources in a local volume to fetching them from a http server to
build it inside the container, to make it easier to build in a container cluster.
Those will come back later.

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.

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.

  $ export PERF_TARBALL=http://192.168.124.1/perf/perf-5.0.0-rc8.tar.xz
  # dm
   1 alpine:3.4                    : Ok   gcc (Alpine 5.3.0) 5.3.0
   2 alpine:3.5                    : Ok   gcc (Alpine 6.2.1) 6.2.1 20160822
   3 alpine:3.6                    : Ok   gcc (Alpine 6.3.0) 6.3.0
   4 alpine:3.7                    : Ok   gcc (Alpine 6.4.0) 6.4.0
   5 alpine:3.8                    : Ok   gcc (Alpine 6.4.0) 6.4.0
   6 alpine:3.9                    : Ok   gcc (Alpine 8.2.0) 8.2.0
   7 alpine:edge                   : Ok   gcc (Alpine 8.2.0) 8.2.0
   8 amazonlinux:1                 : Ok   gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28)
   9 amazonlinux:2                 : Ok   gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)
  10 android-ndk:r12b-arm          : Ok   arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease)
  11 android-ndk:r15c-arm          : Ok   arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease)
  12 centos:5                      : Ok   gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-55)
  13 centos:6                      : Ok   gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23)
  14 centos:7                      : Ok   gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36)
  15 clearlinux:latest             : Ok   gcc (Clear Linux OS for Intel Architecture) 8.2.1 20180502
  16 debian:7                      : Ok   gcc (Debian 4.7.2-5) 4.7.2
  17 debian:8                      : Ok   gcc (Debian 4.9.2-10+deb8u2) 4.9.2
  18 debian:9                      : Ok   gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516
  19 debian:experimental           : Ok   gcc (Debian 8.2.0-17) 8.2.1 20190204
  20 debian:experimental-x-arm64   : Ok   aarch64-linux-gnu-gcc (Debian 8.2.0-11) 8.2.0
  21 debian:experimental-x-mips    : Ok   mips-linux-gnu-gcc (Debian 8.2.0-11) 8.2.0
  22 debian:experimental-x-mips64  : Ok   mips64-linux-gnuabi64-gcc (Debian 8.2.0-16) 8.2.0
  23 fedora:20                     : Ok   gcc (GCC) 4.8.3 20140911 (Red Hat 4.8.3-7)
  24 fedora:21                     : Ok   gcc (GCC) 4.9.2 20150212 (Red Hat 4.9.2-6)
  25 fedora:22                     : Ok   gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6)
  26 fedora:23                     : Ok   gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6)
  27 fedora:24                     : Ok   gcc (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1)
  28 fedora:24-x-ARC-uClibc        : Ok   arc-linux-gcc (ARCompact ISA Linux uClibc toolchain 2017.09-rc2) 7.1.1 20170710
  29 fedora:25                     : Ok   gcc (GCC) 6.4.1 20170727 (Red Hat 6.4.1-1)
  30 fedora:26                     : Ok   gcc (GCC) 7.3.1 20180130 (Red Hat 7.3.1-2)
  31 fedora:27                     : Ok   gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-6)
  32 fedora:28                     : Ok   gcc (GCC) 8.2.1 20181215 (Red Hat 8.2.1-6)
  33 fedora:29                     : Ok   gcc (GCC) 8.2.1 20181215 (Red Hat 8.2.1-6)
  34 fedora:30                     : Ok   gcc (GCC) 9.0.1 20190203 (Red Hat 9.0.1-0.3)
  35 fedora:rawhide                : Ok   gcc (GCC) 9.0.1 20190209 (Red Hat 9.0.1-0.4)
  36 gentoo-stage3-amd64:latest    : Ok   gcc (Gentoo 7.3.0-r3 p1.4) 7.3.0
  37 mageia:5                      : Ok   gcc (GCC) 4.9.2
  38 mageia:6                      : Ok   gcc (Mageia 5.5.0-1.mga6) 5.5.0
  39 opensuse:13.2                 : Ok   gcc (SUSE Linux) 4.8.3 20140627 [gcc-4_8-branch revision 212064]
  40 opensuse:15.0                 : Ok   gcc (SUSE Linux) 7.3.1 20180323 [gcc-7-branch revision 258812]
  41 opensuse:15.1                 : Ok   gcc (SUSE Linux) 7.4.0
  42 opensuse:42.1                 : Ok   gcc (SUSE Linux) 4.8.5
  43 opensuse:42.2                 : Ok   gcc (SUSE Linux) 4.8.5
  44 opensuse:42.3                 : Ok   gcc (SUSE Linux) 4.8.5
  45 opensuse:tumbleweed           : Ok   gcc (SUSE Linux) 8.2.1 20190103 [gcc-8-branch revision 267549]
  46 oraclelinux:6                 : Ok   gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23.0.1)
  47 oraclelinux:7                 : Ok   gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36.0.1)
  48 ubuntu:12.04.5                : Ok   gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
  49 ubuntu:14.04.4                : Ok   gcc (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4
  50 ubuntu:14.04.4-x-linaro-arm64 : Ok   aarch64-linux-gnu-gcc (Linaro GCC 5.5-2017.10) 5.5.0
  51 ubuntu:16.04                  : Ok   gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609
  52 ubuntu:16.04-x-arm            : Ok   arm-linux-gnueabihf-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
  53 ubuntu:16.04-x-arm64          : Ok   aarch64-linux-gnu-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
  54 ubuntu:16.04-x-powerpc        : Ok   powerpc-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
  55 ubuntu:16.04-x-powerpc64      : Ok   powerpc64-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
  56 ubuntu:16.04-x-powerpc64el    : Ok   powerpc64le-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
  57 ubuntu:16.04-x-s390           : Ok   s390x-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
  58 ubuntu:17.10                  : Ok   gcc (Ubuntu 7.2.0-8ubuntu3.2) 7.2.0
  59 ubuntu:18.04                  : Ok   gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
  60 ubuntu:18.04-x-arm            : Ok   arm-linux-gnueabihf-gcc (Ubuntu/Linaro 7.3.0-27ubuntu1~18.04) 7.3.0
  61 ubuntu:18.04-x-arm64          : Ok   aarch64-linux-gnu-gcc (Ubuntu/Linaro 7.3.0-27ubuntu1~18.04) 7.3.0
  62 ubuntu:18.04-x-m68k           : Ok   m68k-linux-gnu-gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
  63 ubuntu:18.04-x-powerpc        : Ok   powerpc-linux-gnu-gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
  64 ubuntu:18.04-x-powerpc64      : Ok   powerpc64-linux-gnu-gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
  65 ubuntu:18.04-x-powerpc64el    : Ok   powerpc64le-linux-gnu-gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
  66 ubuntu:18.04-x-riscv64        : Ok   riscv64-linux-gnu-gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
  67 ubuntu:18.04-x-s390           : Ok   s390x-linux-gnu-gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
  68 ubuntu:18.04-x-sh4            : Ok   sh4-linux-gnu-gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
  69 ubuntu:18.04-x-sparc64        : Ok   sparc64-linux-gnu-gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
  70 ubuntu:18.10                  : Ok   gcc (Ubuntu 8.2.0-7ubuntu1) 8.2.0
  71 ubuntu:19.04                  : Ok   gcc (Ubuntu 8.2.0-20ubuntu1) 8.2.0
  72 ubuntu:19.04-x-alpha          : Ok   alpha-linux-gnu-gcc (Ubuntu 8.2.0-20ubuntu1) 8.2.0
  73 ubuntu:19.04-x-arm64          : Ok   aarch64-linux-gnu-gcc (Ubuntu/Linaro 8.2.0-20ubuntu1) 8.2.0
  74 ubuntu:19.04-x-hppa           : Ok   hppa-linux-gnu-gcc (Ubuntu 8.2.0-20ubuntu1) 8.2.0
  #

  # uname -a
  Linux quaco 5.0.0+ #1 SMP Thu Mar 7 10:32:55 -03 2019 x86_64 x86_64 x86_64 GNU/Linux
  # git log --oneline -1
  b8f7d86b5849 perf data: Force perf_data__open|close zero data->file.path
  # perf version --build-options
  perf version 5.0.rc8.gb8f7d8
                   dwarf: [ on  ]  # HAVE_DWARF_SUPPORT
      dwarf_getlocations: [ on  ]  # HAVE_DWARF_GETLOCATIONS_SUPPORT
                   glibc: [ on  ]  # HAVE_GLIBC_SUPPORT
                    gtk2: [ on  ]  # HAVE_GTK2_SUPPORT
           syscall_table: [ on  ]  # HAVE_SYSCALL_TABLE_SUPPORT
                  libbfd: [ on  ]  # HAVE_LIBBFD_SUPPORT
                  libelf: [ on  ]  # HAVE_LIBELF_SUPPORT
                 libnuma: [ on  ]  # HAVE_LIBNUMA_SUPPORT
  numa_num_possible_cpus: [ on  ]  # HAVE_LIBNUMA_SUPPORT
                 libperl: [ on  ]  # HAVE_LIBPERL_SUPPORT
               libpython: [ on  ]  # HAVE_LIBPYTHON_SUPPORT
                libslang: [ on  ]  # HAVE_SLANG_SUPPORT
               libcrypto: [ on  ]  # HAVE_LIBCRYPTO_SUPPORT
               libunwind: [ on  ]  # HAVE_LIBUNWIND_SUPPORT
      libdw-dwarf-unwind: [ on  ]  # HAVE_DWARF_SUPPORT
                    zlib: [ on  ]  # HAVE_ZLIB_SUPPORT
                    lzma: [ on  ]  # HAVE_LZMA_SUPPORT
               get_cpuid: [ on  ]  # HAVE_AUXTRACE_SUPPORT
                     bpf: [ on  ]  # HAVE_LIBBPF_SUPPORT
  # 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: Test data source output                               : Ok
   6: Parse event definition strings                        : Ok
   7: Simple expression parser                              : Ok
   8: PERF_RECORD_* events & perf_sample fields             : Ok
   9: Parse perf pmu format                                 : Ok
  10: DSO data read                                         : Ok
  11: DSO data cache                                        : Ok
  12: DSO data reopen                                       : Ok
  13: Roundtrip evsel->name                                 : Ok
  14: Parse sched tracepoints fields                        : Ok
  15: syscalls:sys_enter_openat event fields                : Ok
  16: Setup struct perf_event_attr                          : Ok
  17: Match and link multiple hists                         : Ok
  18: 'import perf' in python                               : Ok
  19: Breakpoint overflow signal handler                    : Ok
  20: Breakpoint overflow sampling                          : Ok
  21: Breakpoint accounting                                 : Ok
  22: Watchpoint                                            :
  22.1: Read Only Watchpoint                                : Skip
  22.2: Write Only Watchpoint                               : Ok
  22.3: Read / Write Watchpoint                             : Ok
  22.4: Modify Watchpoint                                   : Ok
  23: Number of exit events of a simple workload            : Ok
  24: Software clock events period values                   : Ok
  25: Object code reading                                   : Ok
  26: Sample parsing                                        : Ok
  27: Use a dummy software event to keep tracking           : Ok
  28: Parse with no sample_id_all bit set                   : Ok
  29: Filter hist entries                                   : Ok
  30: Lookup mmap thread                                    : Ok
  31: Share thread mg                                       : Ok
  32: Sort output of hist entries                           : Ok
  33: Cumulate child hist entries                           : Ok
  34: Track with sched_switch                               : Ok
  35: Filter fds with revents mask in a fdarray             : Ok
  36: Add fd to a fdarray, making it autogrow               : Ok
  37: kmod_path__parse                                      : Ok
  38: Thread map                                            : Ok
  39: LLVM search and compile                               :
  39.1: Basic BPF llvm compile                              : Ok
  39.2: kbuild searching                                    : Ok
  39.3: Compile source for BPF prologue generation          : Ok
  39.4: Compile source for BPF relocation                   : Ok
  40: Session topology                                      : Ok
  41: BPF filter                                            :
  41.1: Basic BPF filtering                                 : Ok
  41.2: BPF pinning                                         : Ok
  41.3: BPF prologue generation                             : Ok
  41.4: BPF relocation checker                              : Ok
  42: Synthesize thread map                                 : Ok
  43: Remove thread map                                     : Ok
  44: Synthesize cpu map                                    : Ok
  45: Synthesize stat config                                : Ok
  46: Synthesize stat                                       : Ok
  47: Synthesize stat round                                 : Ok
  48: Synthesize attr update                                : Ok
  49: Event times                                           : Ok
  50: Read backward ring buffer                             : Ok
  51: Print cpu map                                         : Ok
  52: Probe SDT events                                      : Ok
  53: is_printable_array                                    : Ok
  54: Print bitmap                                          : Ok
  55: perf hooks                                            : Ok
  56: builtin clang support                                 : Skip (not compiled in)
  57: unit_number__scnprintf                                : Ok
  58: mem2node                                              : Ok
  59: x86 rdpmc                                             : Ok
  60: Convert perf time to TSC                              : Ok
  61: DWARF unwind                                          : Ok
  62: x86 instruction decoder - new instructions            : Ok
  63: x86 bp modify                                         : Ok
  64: probe libc's inet_pton & backtrace it with ping       : Ok
  65: Use vfs_getname probe to get syscall args filenames   : Ok
  66: Add vfs_getname probe to get syscall args filenames   : Ok
  67: Check open filename arg using perf trace + vfs_getname: Ok

  $ make -C tools/perf build-test
  make: Entering directory '/home/acme/git/perf/tools/perf'
  - tarpkg: ./tests/perf-targz-src-pkg .
        make_with_babeltrace_O: make LIBBABELTRACE=1
                  make_debug_O: make DEBUG=1
       make_util_pmu_bison_o_O: make util/pmu-bison.o
           make_no_libpython_O: make NO_LIBPYTHON=1
            make_no_demangle_O: make NO_DEMANGLE=1
                   make_pure_O: make
           make_no_backtrace_O: make NO_BACKTRACE=1
                  make_no_ui_O: make NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
             make_no_libnuma_O: make NO_LIBNUMA=1
                 make_perf_o_O: make perf.o
            make_install_bin_O: make install-bin
   make_install_prefix_slash_O: make install prefix=/tmp/krava/
            make_no_libaudit_O: make NO_LIBAUDIT=1
           make_no_libunwind_O: make NO_LIBUNWIND=1
                make_no_newt_O: make NO_NEWT=1
             make_no_libperl_O: make NO_LIBPERL=1
              make_no_libbpf_O: make NO_LIBBPF=1
                make_no_gtk2_O: make NO_GTK2=1
                    make_doc_O: make doc
         make_with_clangllvm_O: make LIBCLANGLLVM=1
                 make_cscope_O: make cscope
                 make_static_O: make LDFLAGS=-static
              make_no_libelf_O: make NO_LIBELF=1
  make_no_libdw_dwarf_unwind_O: make NO_LIBDW_DWARF_UNWIND=1
           make_no_libbionic_O: make NO_LIBBIONIC=1
              make_clean_all_O: make clean all
                make_install_O: make install
                   make_tags_O: make tags
         make_install_prefix_O: make install prefix=/tmp/krava
             make_util_map_o_O: make util/map.o
                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_scripts_O: make NO_LIBPYTHON=1 NO_LIBPERL=1
                   make_help_O: make help
            make_no_auxtrace_O: make NO_AUXTRACE=1
               make_no_slang_O: make NO_SLANG=1
  OK
  make: Leaving directory '/home/acme/git/perf/tools/perf'
  $

^ permalink raw reply	[flat|nested] 50+ messages in thread

* [PATCH 01/35] perf, bpf: Consider events with attr.bpf_event as side-band events
  2019-03-07 17:43 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
@ 2019-03-07 17:43 ` Arnaldo Carvalho de Melo
  2019-03-07 17:44 ` [PATCH 02/35] perf probe: Clarify error message about not finding kernel modules debuginfo Arnaldo Carvalho de Melo
                   ` (34 subsequent siblings)
  35 siblings, 0 replies; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-03-07 17:43 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel,
	linux-perf-users, Song Liu, Alexei Starovoitov, Daniel Borkmann,
	Peter Zijlstra, kernel-team, netdev, Arnaldo Carvalho de Melo

From: Song Liu <songliubraving@fb.com>

Events with attr.bpf_event set should be considered as side-band events,
as they carry information about BPF programs.

Signed-off-by: Song Liu <songliubraving@fb.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: kernel-team@fb.com
Cc: netdev@vger.kernel.org
Fixes: 6ee52e2a3fe4 ("perf, bpf: Introduce PERF_RECORD_BPF_EVENT")
Link: http://lkml.kernel.org/r/20190226002019.3748539-2-songliubraving@fb.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 kernel/events/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 5f59d848171e..dd9698ad3d66 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -4238,7 +4238,8 @@ static bool is_sb_event(struct perf_event *event)
 	if (attr->mmap || attr->mmap_data || attr->mmap2 ||
 	    attr->comm || attr->comm_exec ||
 	    attr->task || attr->ksymbol ||
-	    attr->context_switch)
+	    attr->context_switch ||
+	    attr->bpf_event)
 		return true;
 	return false;
 }
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 50+ messages in thread

* [PATCH 02/35] perf probe: Clarify error message about not finding kernel modules debuginfo
  2019-03-07 17:43 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
  2019-03-07 17:43 ` [PATCH 01/35] perf, bpf: Consider events with attr.bpf_event as side-band events Arnaldo Carvalho de Melo
@ 2019-03-07 17:44 ` Arnaldo Carvalho de Melo
  2019-03-07 23:30   ` Masami Hiramatsu
  2019-03-07 17:44 ` [PATCH 03/35] tools lib traceevent: Fix buffer overflow in arg_eval Arnaldo Carvalho de Melo
                   ` (33 subsequent siblings)
  35 siblings, 1 reply; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-03-07 17:44 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel,
	linux-perf-users, Arnaldo Carvalho de Melo, Adrian Hunter,
	Marcelo Ricardo Leitner, Masami Hiramatsu

From: Arnaldo Carvalho de Melo <acme@redhat.com>

'perf probe' supports using just the kernel module name, but that will
work only when the module is loaded, or using the full pathname to the
file with the DWARF debug info, but the warning was cryptic:

Before:

  # perf probe -m cls_flower -L fl_change
  Failed to find the path for cls_flower: No such file or directory
    Error: Failed to show lines.
  #

After:

  # perf probe -m cls_flower -L fl_change
  Module cls_flower is not loaded, please specify its full path name.
    Error: Failed to show lines.
  # perf probe -m /lib/modules/5.0.0-rc7+/kernel/net/sched/cls_flower.ko -L fl_change | head -7
  <fl_change@/home/acme/git/linux/net/sched/cls_flower.c:0>
        0  static int fl_change(struct net *net, struct sk_buff *in_skb,
         		       struct tcf_proto *tp, unsigned long base,
         		       u32 handle, struct nlattr **tca,
         		       void **arg, bool ovr, struct netlink_ext_ack *extack)
        4  {
        5  	struct cls_fl_head *head = rtnl_dereference(tp->root);
  #

The behaviour doesn't change when the module is loaded:

  # modprobe cls_flower
  # perf probe -m cls_flower -L fl_change | head -7
  <fl_change@/home/acme/git/linux/net/sched/cls_flower.c:0>
        0  static int fl_change(struct net *net, struct sk_buff *in_skb,
                               struct tcf_proto *tp, unsigned long base,
                               u32 handle, struct nlattr **tca,
                               void **arg, bool ovr, struct netlink_ext_ack *extack)
        4  {
        5         struct cls_fl_head *head = rtnl_dereference(tp->root);
  #

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Marcelo Ricardo Leitner <mleitner@redhat.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lkml.kernel.org/n/tip-q4njvk9mshra00jacqjbzfn5@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/probe-event.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 0030f9b9bf7e..a1b8d9649ca7 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -472,9 +472,12 @@ static struct debuginfo *open_debuginfo(const char *module, struct nsinfo *nsi,
 					strcpy(reason, "(unknown)");
 			} else
 				dso__strerror_load(dso, reason, STRERR_BUFSIZE);
-			if (!silent)
-				pr_err("Failed to find the path for %s: %s\n",
-					module ?: "kernel", reason);
+			if (!silent) {
+				if (module)
+					pr_err("Module %s is not loaded, please specify its full path name.\n", module);
+				else
+					pr_err("Failed to find the path for the kernel: %s\n", reason);
+			}
 			return NULL;
 		}
 		path = dso->long_name;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 50+ messages in thread

* [PATCH 03/35] tools lib traceevent: Fix buffer overflow in arg_eval
  2019-03-07 17:43 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
  2019-03-07 17:43 ` [PATCH 01/35] perf, bpf: Consider events with attr.bpf_event as side-band events Arnaldo Carvalho de Melo
  2019-03-07 17:44 ` [PATCH 02/35] perf probe: Clarify error message about not finding kernel modules debuginfo Arnaldo Carvalho de Melo
@ 2019-03-07 17:44 ` Arnaldo Carvalho de Melo
  2019-03-07 17:44 ` [PATCH 04/35] perf: Mark expected switch fall-through Arnaldo Carvalho de Melo
                   ` (32 subsequent siblings)
  35 siblings, 0 replies; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-03-07 17:44 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel,
	linux-perf-users, Tony Jones, Michael Sartain, Mathias Krause,
	Steven Rostedt, Frederic Weisbecker, Arnaldo Carvalho de Melo

From: Tony Jones <tonyj@suse.de>

Fix buffer overflow observed when running perf test.

The overflow is when trying to evaluate "1ULL << (64 - 1)" which is
resulting in -9223372036854775808 which overflows the 20 character
buffer.

If is possible this bug has been reported before but I still don't see
any fix checked in:

See: https://www.spinics.net/lists/linux-perf-users/msg07714.html

Reported-by: Michael Sartain <mikesart@fastmail.com>
Reported-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: Tony Jones <tonyj@suse.de>
Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Fixes: f7d82350e597 ("tools/events: Add files to create libtraceevent.a")
Link: http://lkml.kernel.org/r/20190228015532.8941-1-tonyj@suse.de
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/traceevent/event-parse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index abd4fa5d3088..87494c7c619d 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -2457,7 +2457,7 @@ static int arg_num_eval(struct tep_print_arg *arg, long long *val)
 static char *arg_eval (struct tep_print_arg *arg)
 {
 	long long val;
-	static char buf[20];
+	static char buf[24];
 
 	switch (arg->type) {
 	case TEP_PRINT_ATOM:
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 50+ messages in thread

* [PATCH 04/35] perf: Mark expected switch fall-through
  2019-03-07 17:43 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (2 preceding siblings ...)
  2019-03-07 17:44 ` [PATCH 03/35] tools lib traceevent: Fix buffer overflow in arg_eval Arnaldo Carvalho de Melo
@ 2019-03-07 17:44 ` Arnaldo Carvalho de Melo
  2019-03-07 17:44 ` [PATCH 05/35] perf time-utils: Refactor time range parsing code Arnaldo Carvalho de Melo
                   ` (31 subsequent siblings)
  35 siblings, 0 replies; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-03-07 17:44 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel,
	linux-perf-users, Gustavo A. R. Silva, Alexander Shishkin,
	Jiri Olsa, Kees Kook, Peter Zijlstra, Arnaldo Carvalho de Melo

From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

This patch fixes the following warning:

  kernel/events/core.c: In function ‘perf_event_parse_addr_filter’:
  kernel/events/core.c:9154:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
      kernel = 1;
      ~~~~~~~^~~
  kernel/events/core.c:9156:3: note: here
     case IF_SRC_FILEADDR:
     ^~~~

Warning level 3 was used: -Wimplicit-fallthrough=3

This patch is part of the ongoing efforts to enable -Wimplicit-fallthrough.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Gustavo A. R. Silva <gustavo@embeddedor.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Kees Kook <keescook@chromium.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20190212205430.GA8446@embeddedor
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 kernel/events/core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index dd9698ad3d66..6fb27b564730 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -9175,6 +9175,7 @@ perf_event_parse_addr_filter(struct perf_event *event, char *fstr,
 		case IF_SRC_KERNELADDR:
 		case IF_SRC_KERNEL:
 			kernel = 1;
+			/* fall through */
 
 		case IF_SRC_FILEADDR:
 		case IF_SRC_FILE:
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 50+ messages in thread

* [PATCH 05/35] perf time-utils: Refactor time range parsing code
  2019-03-07 17:43 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (3 preceding siblings ...)
  2019-03-07 17:44 ` [PATCH 04/35] perf: Mark expected switch fall-through Arnaldo Carvalho de Melo
@ 2019-03-07 17:44 ` Arnaldo Carvalho de Melo
  2019-03-07 17:44 ` [PATCH 06/35] perf auxtrace: Improve address filter error message when there is no DSO Arnaldo Carvalho de Melo
                   ` (30 subsequent siblings)
  35 siblings, 0 replies; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-03-07 17:44 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel,
	linux-perf-users, Jin Yao, Arnaldo Carvalho de Melo,
	Alexander Shishkin, Andi Kleen, Jin Yao, Kan Liang,
	Peter Zijlstra

From: Jin Yao <yao.jin@linux.intel.com>

Jiri points out that we don't need any time checking and time string
parsing if the --time option is not set. That makes sense.

This patch refactors the time range parsing code, move the duplicated
code from perf report and perf script to time_utils and check if --time
option is set before parsing the time string. This patch is no logic
change expected. So the usage of --time is same as before.

For example:

Select the first and second 10% time slices:
  perf report --time 10%/1,10%/2
  perf script --time 10%/1,10%/2

Select the slices from 0% to 10% and from 30% to 40%:
  perf report --time 0%-10%,30%-40%
  perf script --time 0%-10%,30%-40%

Select the time slices from timestamp 3971 to 3973
  perf report --time 3971,3973
  perf script --time 3971,3973

Committer testing:

Using the above examples, check before and after to see if it remains
the same:

  $ perf record -F 10000 -- find . -name "*.[ch]" -exec cat {} + > /dev/null
  [ perf record: Woken up 3 times to write data ]
  [ perf record: Captured and wrote 1.626 MB perf.data (42392 samples) ]
  $
  $ perf report --time 10%/1,10%/2 > /tmp/report.before.1
  $ perf script --time 10%/1,10%/2 > /tmp/script.before.1
  $ perf report --time 0%-10%,30%-40% > /tmp/report.before.2
  $ perf script --time 0%-10%,30%-40% > /tmp/script.before.2
  $ perf report --time 180457.375844,180457.377717 > /tmp/report.before.3
  $ perf script --time 180457.375844,180457.377717 > /tmp/script.before.3

For example, the 3rd test produces this slice:

  $ cat /tmp/script.before.3
        cat  3147 180457.375844:   2143 cycles:uppp:      7f79362590d9 cfree@GLIBC_2.2.5+0x9 (/usr/lib64/libc-2.28.so)
        cat  3147 180457.375986:   2245 cycles:uppp:      558b70f3d86e [unknown] (/usr/bin/cat)
        cat  3147 180457.376012:   2164 cycles:uppp:      7f7936257430 _int_malloc+0x8c0 (/usr/lib64/libc-2.28.so)
        cat  3147 180457.376140:   2921 cycles:uppp:      558b70f3a554 [unknown] (/usr/bin/cat)
        cat  3147 180457.376296:   2844 cycles:uppp:      7f7936258abe malloc+0x4e (/usr/lib64/libc-2.28.so)
        cat  3147 180457.376431:   2717 cycles:uppp:      558b70f3b0ca [unknown] (/usr/bin/cat)
        cat  3147 180457.376667:   2630 cycles:uppp:      558b70f3d86e [unknown] (/usr/bin/cat)
        cat  3147 180457.376795:   2442 cycles:uppp:      7f79362bff55 read+0x15 (/usr/lib64/libc-2.28.so)
        cat  3147 180457.376927:   2376 cycles:uppp:  ffffffff9aa00163 [unknown] ([unknown])
        cat  3147 180457.376954:   2307 cycles:uppp:      7f7936257438 _int_malloc+0x8c8 (/usr/lib64/libc-2.28.so)
        cat  3147 180457.377116:   3091 cycles:uppp:      7f7936258a70 malloc+0x0 (/usr/lib64/libc-2.28.so)
        cat  3147 180457.377362:   2945 cycles:uppp:      558b70f3a3b0 [unknown] (/usr/bin/cat)
        cat  3147 180457.377517:   2727 cycles:uppp:      558b70f3a9aa [unknown] (/usr/bin/cat)
  $

Install 'coreutils-debuginfo' to see cat's guts (symbols), but then, the
above chunk translates into this 'perf report' output:

  $ cat /tmp/report.before.3
  # To display the perf.data header info, please use --header/--header-only options.
  #
  #
  # Total Lost Samples: 0
  #
  # Samples: 13  of event 'cycles:uppp' (time slices: 180457.375844,180457.377717)
  # Event count (approx.): 33552
  #
  # Overhead  Command  Shared Object     Symbol
  # ........  .......  ................  ......................
  #
      17.69%  cat      libc-2.28.so      [.] malloc
      14.53%  cat      cat               [.] 0x000000000000586e
      13.33%  cat      libc-2.28.so      [.] _int_malloc
       8.78%  cat      cat               [.] 0x00000000000023b0
       8.71%  cat      cat               [.] 0x0000000000002554
       8.13%  cat      cat               [.] 0x00000000000029aa
       8.10%  cat      cat               [.] 0x00000000000030ca
       7.28%  cat      libc-2.28.so      [.] read
       7.08%  cat      [unknown]         [k] 0xffffffff9aa00163
       6.39%  cat      libc-2.28.so      [.] cfree@GLIBC_2.2.5

  #
  # (Tip: Order by the overhead of source file name and line number: perf report -s srcline)
  #
  $

Now lets see after applying this patch, nothing should change:

  $ perf report --time 10%/1,10%/2 > /tmp/report.after.1
  $ perf script --time 10%/1,10%/2 > /tmp/script.after.1
  $ perf report --time 0%-10%,30%-40% > /tmp/report.after.2
  $ perf script --time 0%-10%,30%-40% > /tmp/script.after.2
  $ perf report --time 180457.375844,180457.377717 > /tmp/report.after.3
  $ perf script --time 180457.375844,180457.377717 > /tmp/script.after.3
  $ diff -u /tmp/report.before.1 /tmp/report.after.1
  $ diff -u /tmp/script.before.1 /tmp/script.after.1
  $ diff -u /tmp/report.before.2 /tmp/report.after.2
  --- /tmp/report.before.2	2019-03-01 11:01:53.526094883 -0300
  +++ /tmp/report.after.2	2019-03-01 11:09:18.231770467 -0300
  @@ -352,5 +352,5 @@

   #
  -# (Tip: Generate a script for your data: perf script -g <lang>)
  +# (Tip: Treat branches as callchains: perf report --branch-history)
   #
  $ diff -u /tmp/script.before.2 /tmp/script.after.2
  $ diff -u /tmp/report.before.3 /tmp/report.after.3
  --- /tmp/report.before.3	2019-03-01 11:03:08.890045588 -0300
  +++ /tmp/report.after.3	2019-03-01 11:09:40.660224002 -0300
  @@ -22,5 +22,5 @@

   #
  -# (Tip: Order by the overhead of source file name and line number: perf report -s srcline)
  +# (Tip: List events using substring match: perf list <keyword>)
   #
  $ diff -u /tmp/script.before.3 /tmp/script.after.3
  $

Cool, just the 'perf report' tips changed, QED.

Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jin Yao <yao.jin@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1551435186-6008-1-git-send-email-yao.jin@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-report.c  | 38 ++++++---------------------
 tools/perf/builtin-script.c  | 39 ++++++---------------------
 tools/perf/util/time-utils.c | 51 +++++++++++++++++++++++++++++++++++-
 tools/perf/util/time-utils.h |  6 +++++
 4 files changed, 72 insertions(+), 62 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 1532ebde6c4b..ee93c18a6685 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -1375,36 +1375,13 @@ int cmd_report(int argc, const char **argv)
 	if (symbol__init(&session->header.env) < 0)
 		goto error;
 
-	report.ptime_range = perf_time__range_alloc(report.time_str,
-						    &report.range_size);
-	if (!report.ptime_range) {
-		ret = -ENOMEM;
-		goto error;
-	}
-
-	if (perf_time__parse_str(report.ptime_range, report.time_str) != 0) {
-		if (session->evlist->first_sample_time == 0 &&
-		    session->evlist->last_sample_time == 0) {
-			pr_err("HINT: no first/last sample time found in perf data.\n"
-			       "Please use latest perf binary to execute 'perf record'\n"
-			       "(if '--buildid-all' is enabled, please set '--timestamp-boundary').\n");
-			ret = -EINVAL;
-			goto error;
-		}
-
-		report.range_num = perf_time__percent_parse_str(
-					report.ptime_range, report.range_size,
-					report.time_str,
-					session->evlist->first_sample_time,
-					session->evlist->last_sample_time);
-
-		if (report.range_num < 0) {
-			pr_err("Invalid time string\n");
-			ret = -EINVAL;
+	if (report.time_str) {
+		ret = perf_time__parse_for_ranges(report.time_str, session,
+						  &report.ptime_range,
+						  &report.range_size,
+						  &report.range_num);
+		if (ret < 0)
 			goto error;
-		}
-	} else {
-		report.range_num = 1;
 	}
 
 	if (session->tevent.pevent &&
@@ -1426,7 +1403,8 @@ int cmd_report(int argc, const char **argv)
 		ret = 0;
 
 error:
-	zfree(&report.ptime_range);
+	if (report.ptime_range)
+		zfree(&report.ptime_range);
 
 	perf_session__delete(session);
 	return ret;
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 2d8cb1d1682c..53f78cf3113f 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -3699,37 +3699,13 @@ int cmd_script(int argc, const char **argv)
 	if (err < 0)
 		goto out_delete;
 
-	script.ptime_range = perf_time__range_alloc(script.time_str,
-						    &script.range_size);
-	if (!script.ptime_range) {
-		err = -ENOMEM;
-		goto out_delete;
-	}
-
-	/* needs to be parsed after looking up reference time */
-	if (perf_time__parse_str(script.ptime_range, script.time_str) != 0) {
-		if (session->evlist->first_sample_time == 0 &&
-		    session->evlist->last_sample_time == 0) {
-			pr_err("HINT: no first/last sample time found in perf data.\n"
-			       "Please use latest perf binary to execute 'perf record'\n"
-			       "(if '--buildid-all' is enabled, please set '--timestamp-boundary').\n");
-			err = -EINVAL;
-			goto out_delete;
-		}
-
-		script.range_num = perf_time__percent_parse_str(
-					script.ptime_range, script.range_size,
-					script.time_str,
-					session->evlist->first_sample_time,
-					session->evlist->last_sample_time);
-
-		if (script.range_num < 0) {
-			pr_err("Invalid time string\n");
-			err = -EINVAL;
+	if (script.time_str) {
+		err = perf_time__parse_for_ranges(script.time_str, session,
+						  &script.ptime_range,
+						  &script.range_size,
+						  &script.range_num);
+		if (err < 0)
 			goto out_delete;
-		}
-	} else {
-		script.range_num = 1;
 	}
 
 	err = __cmd_script(&script);
@@ -3737,7 +3713,8 @@ int cmd_script(int argc, const char **argv)
 	flush_scripting();
 
 out_delete:
-	zfree(&script.ptime_range);
+	if (script.ptime_range)
+		zfree(&script.ptime_range);
 
 	perf_evlist__free_stats(session->evlist);
 	perf_session__delete(session);
diff --git a/tools/perf/util/time-utils.c b/tools/perf/util/time-utils.c
index 6193b46050a5..0f53baec660e 100644
--- a/tools/perf/util/time-utils.c
+++ b/tools/perf/util/time-utils.c
@@ -11,6 +11,8 @@
 #include "perf.h"
 #include "debug.h"
 #include "time-utils.h"
+#include "session.h"
+#include "evlist.h"
 
 int parse_nsec_time(const char *str, u64 *ptime)
 {
@@ -374,7 +376,7 @@ bool perf_time__ranges_skip_sample(struct perf_time_interval *ptime_buf,
 	struct perf_time_interval *ptime;
 	int i;
 
-	if ((timestamp == 0) || (num == 0))
+	if ((!ptime_buf) || (timestamp == 0) || (num == 0))
 		return false;
 
 	if (num == 1)
@@ -396,6 +398,53 @@ bool perf_time__ranges_skip_sample(struct perf_time_interval *ptime_buf,
 	return (i == num) ? true : false;
 }
 
+int perf_time__parse_for_ranges(const char *time_str,
+				struct perf_session *session,
+				struct perf_time_interval **ranges,
+				int *range_size, int *range_num)
+{
+	struct perf_time_interval *ptime_range;
+	int size, num, ret;
+
+	ptime_range = perf_time__range_alloc(time_str, &size);
+	if (!ptime_range)
+		return -ENOMEM;
+
+	if (perf_time__parse_str(ptime_range, time_str) != 0) {
+		if (session->evlist->first_sample_time == 0 &&
+		    session->evlist->last_sample_time == 0) {
+			pr_err("HINT: no first/last sample time found in perf data.\n"
+			       "Please use latest perf binary to execute 'perf record'\n"
+			       "(if '--buildid-all' is enabled, please set '--timestamp-boundary').\n");
+			ret = -EINVAL;
+			goto error;
+		}
+
+		num = perf_time__percent_parse_str(
+				ptime_range, size,
+				time_str,
+				session->evlist->first_sample_time,
+				session->evlist->last_sample_time);
+
+		if (num < 0) {
+			pr_err("Invalid time string\n");
+			ret = -EINVAL;
+			goto error;
+		}
+	} else {
+		num = 1;
+	}
+
+	*range_size = size;
+	*range_num = num;
+	*ranges = ptime_range;
+	return 0;
+
+error:
+	free(ptime_range);
+	return ret;
+}
+
 int timestamp__scnprintf_usec(u64 timestamp, char *buf, size_t sz)
 {
 	u64  sec = timestamp / NSEC_PER_SEC;
diff --git a/tools/perf/util/time-utils.h b/tools/perf/util/time-utils.h
index 70b177d2b98c..b923de44e36f 100644
--- a/tools/perf/util/time-utils.h
+++ b/tools/perf/util/time-utils.h
@@ -23,6 +23,12 @@ bool perf_time__skip_sample(struct perf_time_interval *ptime, u64 timestamp);
 bool perf_time__ranges_skip_sample(struct perf_time_interval *ptime_buf,
 				   int num, u64 timestamp);
 
+struct perf_session;
+
+int perf_time__parse_for_ranges(const char *str, struct perf_session *session,
+				struct perf_time_interval **ranges,
+				int *range_size, int *range_num);
+
 int timestamp__scnprintf_usec(u64 timestamp, char *buf, size_t sz);
 
 int fetch_current_timestamp(char *buf, size_t sz);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 50+ messages in thread

* [PATCH 06/35] perf auxtrace: Improve address filter error message when there is no DSO
  2019-03-07 17:43 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (4 preceding siblings ...)
  2019-03-07 17:44 ` [PATCH 05/35] perf time-utils: Refactor time range parsing code Arnaldo Carvalho de Melo
@ 2019-03-07 17:44 ` Arnaldo Carvalho de Melo
  2019-03-07 17:44 ` [PATCH 07/35] perf intel-pt: Fix divide by zero when TSC is not available Arnaldo Carvalho de Melo
                   ` (29 subsequent siblings)
  35 siblings, 0 replies; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-03-07 17:44 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel,
	linux-perf-users, Adrian Hunter, Alexander Shishkin,
	Arnaldo Carvalho de Melo, Jiri Olsa

From: Adrian Hunter <adrian.hunter@intel.com>

The message does not indicate the possibility that the symbol is not
found because the file does not exist.

Before:

  $ perf record -e intel_pt//u --filter 'filter strcmp / strcpy @ foo ' ls
  Symbol 'strcmp' not found.
  Note that symbols must be functions.
  Failed to parse address filter: 'filter strcmp / strcpy @ foo '
  Filter format is: filter|start|stop|tracestop <start symbol or address> [/ <end symbol or size>] [@<file name>]
  Where multiple filters are separated by space or comma.

After:

  $ perf record -e intel_pt//u --filter 'filter strcmp / strcpy @ foo ' ls
  File 'foo' not found or has no symbols.
  Symbol 'strcmp' not found.
  Note that symbols must be functions.
  Failed to parse address filter: 'filter strcmp / strcpy @ foo '
  Filter format is: filter|start|stop|tracestop <start symbol or address> [/ <end symbol or size>] [@<file name>]
  Where multiple filters are separated by space or comma.

Reported-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: https://lkml.kernel.org/n/tip-dvngzxd0jkplzw1ary69dilb@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/auxtrace.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c
index 267e54df511b..fb76b6b232d4 100644
--- a/tools/perf/util/auxtrace.c
+++ b/tools/perf/util/auxtrace.c
@@ -1918,7 +1918,8 @@ static struct dso *load_dso(const char *name)
 	if (!map)
 		return NULL;
 
-	map__load(map);
+	if (map__load(map) < 0)
+		pr_err("File '%s' not found or has no symbols.\n", name);
 
 	dso = dso__get(map->dso);
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 50+ messages in thread

* [PATCH 07/35] perf intel-pt: Fix divide by zero when TSC is not available
  2019-03-07 17:43 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (5 preceding siblings ...)
  2019-03-07 17:44 ` [PATCH 06/35] perf auxtrace: Improve address filter error message when there is no DSO Arnaldo Carvalho de Melo
@ 2019-03-07 17:44 ` Arnaldo Carvalho de Melo
  2019-03-07 17:44 ` [PATCH 08/35] perf db-export: Add calls parent_id to enable creation of call trees Arnaldo Carvalho de Melo
                   ` (28 subsequent siblings)
  35 siblings, 0 replies; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-03-07 17:44 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel,
	linux-perf-users, Adrian Hunter, Jiri Olsa, stable,
	Arnaldo Carvalho de Melo

From: Adrian Hunter <adrian.hunter@intel.com>

When TSC is not available, "timeless" decoding is used but a divide by
zero occurs if perf_time_to_tsc() is called.

Ensure the divisor is not zero.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: stable@vger.kernel.org # v4.9+
Link: https://lkml.kernel.org/n/tip-1i4j0wqoc8vlbkcizqqxpsf4@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/intel-pt.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c
index 3b497bab4324..6d288237887b 100644
--- a/tools/perf/util/intel-pt.c
+++ b/tools/perf/util/intel-pt.c
@@ -2531,6 +2531,8 @@ int intel_pt_process_auxtrace_info(union perf_event *event,
 	}
 
 	pt->timeless_decoding = intel_pt_timeless_decoding(pt);
+	if (pt->timeless_decoding && !pt->tc.time_mult)
+		pt->tc.time_mult = 1;
 	pt->have_tsc = intel_pt_have_tsc(pt);
 	pt->sampling_mode = false;
 	pt->est_tsc = !pt->timeless_decoding;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 50+ messages in thread

* [PATCH 08/35] perf db-export: Add calls parent_id to enable creation of call trees
  2019-03-07 17:43 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (6 preceding siblings ...)
  2019-03-07 17:44 ` [PATCH 07/35] perf intel-pt: Fix divide by zero when TSC is not available Arnaldo Carvalho de Melo
@ 2019-03-07 17:44 ` Arnaldo Carvalho de Melo
  2019-03-07 17:44 ` [PATCH 09/35] perf scripts python: export-to-sqlite.py: Export calls parent_id Arnaldo Carvalho de Melo
                   ` (27 subsequent siblings)
  35 siblings, 0 replies; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-03-07 17:44 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel,
	linux-perf-users, Adrian Hunter, Jiri Olsa,
	Arnaldo Carvalho de Melo

From: Adrian Hunter <adrian.hunter@intel.com>

The call_path can be used to find the parent symbol for a call but not
the exact parent call. To do that add parent_id to the call_return
export. This enables the creation of a call tree from the exported data.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: https://lkml.kernel.org/n/tip-6j7tzdxo67cox6kan7k22oo6@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/db-export.c                      | 15 ++++++++++-----
 tools/perf/util/db-export.h                      |  3 ++-
 .../util/scripting-engines/trace-event-python.c  |  8 +++++---
 tools/perf/util/thread-stack.c                   | 16 ++++++++++++++--
 tools/perf/util/thread-stack.h                   |  6 ++++--
 5 files changed, 35 insertions(+), 13 deletions(-)

diff --git a/tools/perf/util/db-export.c b/tools/perf/util/db-export.c
index de9b4769d06c..d7315a00c731 100644
--- a/tools/perf/util/db-export.c
+++ b/tools/perf/util/db-export.c
@@ -510,18 +510,23 @@ int db_export__call_path(struct db_export *dbe, struct call_path *cp)
 	return 0;
 }
 
-int db_export__call_return(struct db_export *dbe, struct call_return *cr)
+int db_export__call_return(struct db_export *dbe, struct call_return *cr,
+			   u64 *parent_db_id)
 {
 	int err;
 
-	if (cr->db_id)
-		return 0;
-
 	err = db_export__call_path(dbe, cr->cp);
 	if (err)
 		return err;
 
-	cr->db_id = ++dbe->call_return_last_db_id;
+	if (!cr->db_id)
+		cr->db_id = ++dbe->call_return_last_db_id;
+
+	if (parent_db_id) {
+		if (!*parent_db_id)
+			*parent_db_id = ++dbe->call_return_last_db_id;
+		cr->parent_db_id = *parent_db_id;
+	}
 
 	if (dbe->export_call_return)
 		return dbe->export_call_return(dbe, cr);
diff --git a/tools/perf/util/db-export.h b/tools/perf/util/db-export.h
index 67bc6b8ad2d6..4e2424c89df9 100644
--- a/tools/perf/util/db-export.h
+++ b/tools/perf/util/db-export.h
@@ -104,6 +104,7 @@ int db_export__sample(struct db_export *dbe, union perf_event *event,
 int db_export__branch_types(struct db_export *dbe);
 
 int db_export__call_path(struct db_export *dbe, struct call_path *cp);
-int db_export__call_return(struct db_export *dbe, struct call_return *cr);
+int db_export__call_return(struct db_export *dbe, struct call_return *cr,
+			   u64 *parent_db_id);
 
 #endif
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c
index 0e17db41b49b..09604c6508f0 100644
--- a/tools/perf/util/scripting-engines/trace-event-python.c
+++ b/tools/perf/util/scripting-engines/trace-event-python.c
@@ -1173,7 +1173,7 @@ static int python_export_call_return(struct db_export *dbe,
 	u64 comm_db_id = cr->comm ? cr->comm->db_id : 0;
 	PyObject *t;
 
-	t = tuple_new(11);
+	t = tuple_new(12);
 
 	tuple_set_u64(t, 0, cr->db_id);
 	tuple_set_u64(t, 1, cr->thread->db_id);
@@ -1186,6 +1186,7 @@ static int python_export_call_return(struct db_export *dbe,
 	tuple_set_u64(t, 8, cr->return_ref);
 	tuple_set_u64(t, 9, cr->cp->parent->db_id);
 	tuple_set_s32(t, 10, cr->flags);
+	tuple_set_u64(t, 11, cr->parent_db_id);
 
 	call_object(tables->call_return_handler, t, "call_return_table");
 
@@ -1194,11 +1195,12 @@ static int python_export_call_return(struct db_export *dbe,
 	return 0;
 }
 
-static int python_process_call_return(struct call_return *cr, void *data)
+static int python_process_call_return(struct call_return *cr, u64 *parent_db_id,
+				      void *data)
 {
 	struct db_export *dbe = data;
 
-	return db_export__call_return(dbe, cr);
+	return db_export__call_return(dbe, cr, parent_db_id);
 }
 
 static void python_process_general_event(struct perf_sample *sample,
diff --git a/tools/perf/util/thread-stack.c b/tools/perf/util/thread-stack.c
index a8b45168513c..41942c2aaa18 100644
--- a/tools/perf/util/thread-stack.c
+++ b/tools/perf/util/thread-stack.c
@@ -49,6 +49,7 @@ enum retpoline_state_t {
  * @timestamp: timestamp (if known)
  * @ref: external reference (e.g. db_id of sample)
  * @branch_count: the branch count when the entry was created
+ * @db_id: id used for db-export
  * @cp: call path
  * @no_call: a 'call' was not seen
  * @trace_end: a 'call' but trace ended
@@ -59,6 +60,7 @@ struct thread_stack_entry {
 	u64 timestamp;
 	u64 ref;
 	u64 branch_count;
+	u64 db_id;
 	struct call_path *cp;
 	bool no_call;
 	bool trace_end;
@@ -280,12 +282,14 @@ static int thread_stack__call_return(struct thread *thread,
 		.comm = ts->comm,
 		.db_id = 0,
 	};
+	u64 *parent_db_id;
 
 	tse = &ts->stack[idx];
 	cr.cp = tse->cp;
 	cr.call_time = tse->timestamp;
 	cr.return_time = timestamp;
 	cr.branch_count = ts->branch_count - tse->branch_count;
+	cr.db_id = tse->db_id;
 	cr.call_ref = tse->ref;
 	cr.return_ref = ref;
 	if (tse->no_call)
@@ -295,7 +299,14 @@ static int thread_stack__call_return(struct thread *thread,
 	if (tse->non_call)
 		cr.flags |= CALL_RETURN_NON_CALL;
 
-	return crp->process(&cr, crp->data);
+	/*
+	 * The parent db_id must be assigned before exporting the child. Note
+	 * it is not possible to export the parent first because its information
+	 * is not yet complete because its 'return' has not yet been processed.
+	 */
+	parent_db_id = idx ? &(tse - 1)->db_id : NULL;
+
+	return crp->process(&cr, parent_db_id, crp->data);
 }
 
 static int __thread_stack__flush(struct thread *thread, struct thread_stack *ts)
@@ -484,7 +495,7 @@ void thread_stack__sample(struct thread *thread, int cpu,
 }
 
 struct call_return_processor *
-call_return_processor__new(int (*process)(struct call_return *cr, void *data),
+call_return_processor__new(int (*process)(struct call_return *cr, u64 *parent_db_id, void *data),
 			   void *data)
 {
 	struct call_return_processor *crp;
@@ -537,6 +548,7 @@ static int thread_stack__push_cp(struct thread_stack *ts, u64 ret_addr,
 	tse->no_call = no_call;
 	tse->trace_end = trace_end;
 	tse->non_call = false;
+	tse->db_id = 0;
 
 	return 0;
 }
diff --git a/tools/perf/util/thread-stack.h b/tools/perf/util/thread-stack.h
index b7c04e19ad41..9c45f947f5a9 100644
--- a/tools/perf/util/thread-stack.h
+++ b/tools/perf/util/thread-stack.h
@@ -55,6 +55,7 @@ enum {
  * @call_ref: external reference to 'call' sample (e.g. db_id)
  * @return_ref:  external reference to 'return' sample (e.g. db_id)
  * @db_id: id used for db-export
+ * @parent_db_id: id of parent call used for db-export
  * @flags: Call/Return flags
  */
 struct call_return {
@@ -67,6 +68,7 @@ struct call_return {
 	u64 call_ref;
 	u64 return_ref;
 	u64 db_id;
+	u64 parent_db_id;
 	u32 flags;
 };
 
@@ -79,7 +81,7 @@ struct call_return {
  */
 struct call_return_processor {
 	struct call_path_root *cpr;
-	int (*process)(struct call_return *cr, void *data);
+	int (*process)(struct call_return *cr, u64 *parent_db_id, void *data);
 	void *data;
 };
 
@@ -93,7 +95,7 @@ void thread_stack__free(struct thread *thread);
 size_t thread_stack__depth(struct thread *thread, int cpu);
 
 struct call_return_processor *
-call_return_processor__new(int (*process)(struct call_return *cr, void *data),
+call_return_processor__new(int (*process)(struct call_return *cr, u64 *parent_db_id, void *data),
 			   void *data);
 void call_return_processor__free(struct call_return_processor *crp);
 int thread_stack__process(struct thread *thread, struct comm *comm,
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 50+ messages in thread

* [PATCH 09/35] perf scripts python: export-to-sqlite.py: Export calls parent_id
  2019-03-07 17:43 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (7 preceding siblings ...)
  2019-03-07 17:44 ` [PATCH 08/35] perf db-export: Add calls parent_id to enable creation of call trees Arnaldo Carvalho de Melo
@ 2019-03-07 17:44 ` Arnaldo Carvalho de Melo
  2019-03-07 17:44 ` [PATCH 10/35] perf scripts python: export-to-postgresql.py: Fix invalid input syntax for integer error Arnaldo Carvalho de Melo
                   ` (26 subsequent siblings)
  35 siblings, 0 replies; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-03-07 17:44 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel,
	linux-perf-users, Adrian Hunter, Jiri Olsa,
	Arnaldo Carvalho de Melo

From: Adrian Hunter <adrian.hunter@intel.com>

Export to the 'calls' table the newly created 'parent_id'.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: https://lkml.kernel.org/n/tip-b09oukl48rsl9azkp2wmh0bl@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/scripts/python/export-to-sqlite.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/tools/perf/scripts/python/export-to-sqlite.py b/tools/perf/scripts/python/export-to-sqlite.py
index ed237f2ed03f..eb63e6c7107f 100644
--- a/tools/perf/scripts/python/export-to-sqlite.py
+++ b/tools/perf/scripts/python/export-to-sqlite.py
@@ -222,7 +222,8 @@ if perf_db_export_calls:
 		'call_id	bigint,'
 		'return_id	bigint,'
 		'parent_call_path_id	bigint,'
-		'flags		integer)')
+		'flags		integer,'
+		'parent_id	bigint)')
 
 # printf was added to sqlite in version 3.8.3
 sqlite_has_printf = False
@@ -321,7 +322,8 @@ if perf_db_export_calls:
 			'call_id,'
 			'return_id,'
 			'CASE WHEN flags=0 THEN \'\' WHEN flags=1 THEN \'no call\' WHEN flags=2 THEN \'no return\' WHEN flags=3 THEN \'no call/return\' WHEN flags=6 THEN \'jump\' ELSE flags END AS flags,'
-			'parent_call_path_id'
+			'parent_call_path_id,'
+			'parent_id'
 		' FROM calls INNER JOIN call_paths ON call_paths.id = call_path_id')
 
 do_query(query, 'CREATE VIEW samples_view AS '
@@ -373,7 +375,7 @@ if perf_db_export_calls or perf_db_export_callchains:
 	call_path_query.prepare("INSERT INTO call_paths VALUES (?, ?, ?, ?)")
 if perf_db_export_calls:
 	call_query = QSqlQuery(db)
-	call_query.prepare("INSERT INTO calls VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")
+	call_query.prepare("INSERT INTO calls VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")
 
 def trace_begin():
 	print datetime.datetime.today(), "Writing records..."
@@ -388,6 +390,7 @@ def trace_begin():
 	sample_table(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
 	if perf_db_export_calls or perf_db_export_callchains:
 		call_path_table(0, 0, 0, 0)
+		call_return_table(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
 
 unhandled_count = 0
 
@@ -397,6 +400,7 @@ def trace_end():
 	print datetime.datetime.today(), "Adding indexes"
 	if perf_db_export_calls:
 		do_query(query, 'CREATE INDEX pcpid_idx ON calls (parent_call_path_id)')
+		do_query(query, 'CREATE INDEX pid_idx ON calls (parent_id)')
 
 	if (unhandled_count):
 		print datetime.datetime.today(), "Warning: ", unhandled_count, " unhandled events"
@@ -452,4 +456,4 @@ def call_path_table(*x):
 	bind_exec(call_path_query, 4, x)
 
 def call_return_table(*x):
-	bind_exec(call_query, 11, x)
+	bind_exec(call_query, 12, x)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 50+ messages in thread

* [PATCH 10/35] perf scripts python: export-to-postgresql.py: Fix invalid input syntax for integer error
  2019-03-07 17:43 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (8 preceding siblings ...)
  2019-03-07 17:44 ` [PATCH 09/35] perf scripts python: export-to-sqlite.py: Export calls parent_id Arnaldo Carvalho de Melo
@ 2019-03-07 17:44 ` Arnaldo Carvalho de Melo
  2019-03-07 17:44 ` [PATCH 11/35] perf scripts python: export-to-postgresql.py: Export calls parent_id Arnaldo Carvalho de Melo
                   ` (25 subsequent siblings)
  35 siblings, 0 replies; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-03-07 17:44 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel,
	linux-perf-users, Adrian Hunter, Jiri Olsa,
	Arnaldo Carvalho de Melo

From: Adrian Hunter <adrian.hunter@intel.com>

Fix SQL query error "invalid input syntax for integer":

  Traceback (most recent call last):
    File "tools/perf/scripts/python/export-to-postgresql.py", line 465, in <module>
      do_query(query, 'CREATE VIEW calls_view AS '
    File "tools/perf/scripts/python/export-to-postgresql.py", line 274, in do_query
      raise Exception("Query failed: " + q.lastError().text())
  Exception: Query failed: ERROR:  invalid input syntax for integer: ""
  LINE 1: ...ch_count,call_id,return_id,CASE WHEN flags=0 THEN '' WHEN fl...
                                                               ^
  (22P02) QPSQL: Unable to create query
  Error running python script tools/perf/scripts/python/export-to-postgresql.py

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Fixes: f08046cb3082 ("perf thread-stack: Represent jmps to the start of a different symbol")
Link: https://lkml.kernel.org/n/tip-strfpdozrvg7bi1xzrivxzqt@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/scripts/python/export-to-postgresql.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/scripts/python/export-to-postgresql.py b/tools/perf/scripts/python/export-to-postgresql.py
index 30130213da7e..6358522a69f6 100644
--- a/tools/perf/scripts/python/export-to-postgresql.py
+++ b/tools/perf/scripts/python/export-to-postgresql.py
@@ -478,7 +478,7 @@ if perf_db_export_calls:
 			'branch_count,'
 			'call_id,'
 			'return_id,'
-			'CASE WHEN flags=0 THEN \'\' WHEN flags=1 THEN \'no call\' WHEN flags=2 THEN \'no return\' WHEN flags=3 THEN \'no call/return\' WHEN flags=6 THEN \'jump\' ELSE flags END AS flags,'
+			'CASE WHEN flags=0 THEN \'\' WHEN flags=1 THEN \'no call\' WHEN flags=2 THEN \'no return\' WHEN flags=3 THEN \'no call/return\' WHEN flags=6 THEN \'jump\' ELSE CAST ( flags AS VARCHAR(6) ) END AS flags,'
 			'parent_call_path_id'
 		' FROM calls INNER JOIN call_paths ON call_paths.id = call_path_id')
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 50+ messages in thread

* [PATCH 11/35] perf scripts python: export-to-postgresql.py: Export calls parent_id
  2019-03-07 17:43 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (9 preceding siblings ...)
  2019-03-07 17:44 ` [PATCH 10/35] perf scripts python: export-to-postgresql.py: Fix invalid input syntax for integer error Arnaldo Carvalho de Melo
@ 2019-03-07 17:44 ` Arnaldo Carvalho de Melo
  2019-03-07 17:44 ` [PATCH 12/35] perf scripts python: exported-sql-viewer.py: Factor out TreeWindowBase Arnaldo Carvalho de Melo
                   ` (24 subsequent siblings)
  35 siblings, 0 replies; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-03-07 17:44 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel,
	linux-perf-users, Adrian Hunter, Jiri Olsa,
	Arnaldo Carvalho de Melo

From: Adrian Hunter <adrian.hunter@intel.com>

Export to the 'calls' table the newly created 'parent_id' and create an
index for it.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: https://lkml.kernel.org/n/tip-eybd6fnk6j9r7g643lsideoo@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/scripts/python/export-to-postgresql.py | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/tools/perf/scripts/python/export-to-postgresql.py b/tools/perf/scripts/python/export-to-postgresql.py
index 6358522a69f6..390a351d15ea 100644
--- a/tools/perf/scripts/python/export-to-postgresql.py
+++ b/tools/perf/scripts/python/export-to-postgresql.py
@@ -394,7 +394,8 @@ if perf_db_export_calls:
 		'call_id	bigint,'
 		'return_id	bigint,'
 		'parent_call_path_id	bigint,'
-		'flags		integer)')
+		'flags		integer,'
+		'parent_id	bigint)')
 
 do_query(query, 'CREATE VIEW machines_view AS '
 	'SELECT '
@@ -479,7 +480,8 @@ if perf_db_export_calls:
 			'call_id,'
 			'return_id,'
 			'CASE WHEN flags=0 THEN \'\' WHEN flags=1 THEN \'no call\' WHEN flags=2 THEN \'no return\' WHEN flags=3 THEN \'no call/return\' WHEN flags=6 THEN \'jump\' ELSE CAST ( flags AS VARCHAR(6) ) END AS flags,'
-			'parent_call_path_id'
+			'parent_call_path_id,'
+			'calls.parent_id'
 		' FROM calls INNER JOIN call_paths ON call_paths.id = call_path_id')
 
 do_query(query, 'CREATE VIEW samples_view AS '
@@ -575,6 +577,7 @@ def trace_begin():
 	sample_table(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
 	if perf_db_export_calls or perf_db_export_callchains:
 		call_path_table(0, 0, 0, 0)
+		call_return_table(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
 
 unhandled_count = 0
 
@@ -657,6 +660,7 @@ def trace_end():
 					'ADD CONSTRAINT returnfk    FOREIGN KEY (return_id)    REFERENCES samples    (id),'
 					'ADD CONSTRAINT parent_call_pathfk FOREIGN KEY (parent_call_path_id) REFERENCES call_paths (id)')
 		do_query(query, 'CREATE INDEX pcpid_idx ON calls (parent_call_path_id)')
+		do_query(query, 'CREATE INDEX pid_idx ON calls (parent_id)')
 
 	if (unhandled_count):
 		print datetime.datetime.today(), "Warning: ", unhandled_count, " unhandled events"
@@ -728,7 +732,7 @@ def call_path_table(cp_id, parent_id, symbol_id, ip, *x):
 	value = struct.pack(fmt, 4, 8, cp_id, 8, parent_id, 8, symbol_id, 8, ip)
 	call_path_file.write(value)
 
-def call_return_table(cr_id, thread_id, comm_id, call_path_id, call_time, return_time, branch_count, call_id, return_id, parent_call_path_id, flags, *x):
-	fmt = "!hiqiqiqiqiqiqiqiqiqiqii"
-	value = struct.pack(fmt, 11, 8, cr_id, 8, thread_id, 8, comm_id, 8, call_path_id, 8, call_time, 8, return_time, 8, branch_count, 8, call_id, 8, return_id, 8, parent_call_path_id, 4, flags)
+def call_return_table(cr_id, thread_id, comm_id, call_path_id, call_time, return_time, branch_count, call_id, return_id, parent_call_path_id, flags, parent_id, *x):
+	fmt = "!hiqiqiqiqiqiqiqiqiqiqiiiq"
+	value = struct.pack(fmt, 12, 8, cr_id, 8, thread_id, 8, comm_id, 8, call_path_id, 8, call_time, 8, return_time, 8, branch_count, 8, call_id, 8, return_id, 8, parent_call_path_id, 4, flags, 8, parent_id)
 	call_file.write(value)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 50+ messages in thread

* [PATCH 12/35] perf scripts python: exported-sql-viewer.py: Factor out TreeWindowBase
  2019-03-07 17:43 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (10 preceding siblings ...)
  2019-03-07 17:44 ` [PATCH 11/35] perf scripts python: export-to-postgresql.py: Export calls parent_id Arnaldo Carvalho de Melo
@ 2019-03-07 17:44 ` Arnaldo Carvalho de Melo
  2019-03-07 17:44 ` [PATCH 13/35] perf scripts python: exported-sql-viewer.py: Improve TreeModel abstraction Arnaldo Carvalho de Melo
                   ` (23 subsequent siblings)
  35 siblings, 0 replies; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-03-07 17:44 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel,
	linux-perf-users, Adrian Hunter, Jiri Olsa,
	Arnaldo Carvalho de Melo

From: Adrian Hunter <adrian.hunter@intel.com>

Factor out a base class TreeWindowBase from CallGraphWindow, so that
TreeWindowBase can be reused.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: https://lkml.kernel.org/n/tip-ifirw0c0mhkwxg6l12lk6k4p@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 .../scripts/python/exported-sql-viewer.py     | 50 ++++++++++++-------
 1 file changed, 31 insertions(+), 19 deletions(-)

diff --git a/tools/perf/scripts/python/exported-sql-viewer.py b/tools/perf/scripts/python/exported-sql-viewer.py
index 09ce73b07d35..df854f0a69f0 100755
--- a/tools/perf/scripts/python/exported-sql-viewer.py
+++ b/tools/perf/scripts/python/exported-sql-viewer.py
@@ -693,28 +693,16 @@ class VBox():
 	def Widget(self):
 		return self.vbox
 
-# Context-sensitive call graph window
-
-class CallGraphWindow(QMdiSubWindow):
-
-	def __init__(self, glb, parent=None):
-		super(CallGraphWindow, self).__init__(parent)
+# Tree window base
 
-		self.model = LookupCreateModel("Context-Sensitive Call Graph", lambda x=glb: CallGraphModel(x))
+class TreeWindowBase(QMdiSubWindow):
 
-		self.view = QTreeView()
-		self.view.setModel(self.model)
-
-		for c, w in ((0, 250), (1, 100), (2, 60), (3, 70), (4, 70), (5, 100)):
-			self.view.setColumnWidth(c, w)
-
-		self.find_bar = FindBar(self, self)
-
-		self.vbox = VBox(self.view, self.find_bar.Widget())
-
-		self.setWidget(self.vbox.Widget())
+	def __init__(self, parent=None):
+		super(TreeWindowBase, self).__init__(parent)
 
-		AddSubWindow(glb.mainwindow.mdi_area, self, "Context-Sensitive Call Graph")
+		self.model = None
+		self.view = None
+		self.find_bar = None
 
 	def DisplayFound(self, ids):
 		if not len(ids):
@@ -747,6 +735,30 @@ class CallGraphWindow(QMdiSubWindow):
 		if not found:
 			self.find_bar.NotFound()
 
+
+# Context-sensitive call graph window
+
+class CallGraphWindow(TreeWindowBase):
+
+	def __init__(self, glb, parent=None):
+		super(CallGraphWindow, self).__init__(parent)
+
+		self.model = LookupCreateModel("Context-Sensitive Call Graph", lambda x=glb: CallGraphModel(x))
+
+		self.view = QTreeView()
+		self.view.setModel(self.model)
+
+		for c, w in ((0, 250), (1, 100), (2, 60), (3, 70), (4, 70), (5, 100)):
+			self.view.setColumnWidth(c, w)
+
+		self.find_bar = FindBar(self, self)
+
+		self.vbox = VBox(self.view, self.find_bar.Widget())
+
+		self.setWidget(self.vbox.Widget())
+
+		AddSubWindow(glb.mainwindow.mdi_area, self, "Context-Sensitive Call Graph")
+
 # Child data item  finder
 
 class ChildDataItemFinder():
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 50+ messages in thread

* [PATCH 13/35] perf scripts python: exported-sql-viewer.py: Improve TreeModel abstraction
  2019-03-07 17:43 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (11 preceding siblings ...)
  2019-03-07 17:44 ` [PATCH 12/35] perf scripts python: exported-sql-viewer.py: Factor out TreeWindowBase Arnaldo Carvalho de Melo
@ 2019-03-07 17:44 ` Arnaldo Carvalho de Melo
  2019-03-07 17:44 ` [PATCH 14/35] perf scripts python: exported-sql-viewer.py: Factor out CallGraphModelBase Arnaldo Carvalho de Melo
                   ` (22 subsequent siblings)
  35 siblings, 0 replies; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-03-07 17:44 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel,
	linux-perf-users, Adrian Hunter, Jiri Olsa,
	Arnaldo Carvalho de Melo

From: Adrian Hunter <adrian.hunter@intel.com>

Instead of passing the tree root, get it from a method that can be
implemented in any derived class.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: https://lkml.kernel.org/n/tip-ovcv28bg4mt9swk36ypdyz14@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 .../perf/scripts/python/exported-sql-viewer.py  | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/tools/perf/scripts/python/exported-sql-viewer.py b/tools/perf/scripts/python/exported-sql-viewer.py
index df854f0a69f0..b2a22525549d 100755
--- a/tools/perf/scripts/python/exported-sql-viewer.py
+++ b/tools/perf/scripts/python/exported-sql-viewer.py
@@ -167,9 +167,10 @@ class Thread(QThread):
 
 class TreeModel(QAbstractItemModel):
 
-	def __init__(self, root, parent=None):
+	def __init__(self, glb, parent=None):
 		super(TreeModel, self).__init__(parent)
-		self.root = root
+		self.glb = glb
+		self.root = self.GetRoot()
 		self.last_row_read = 0
 
 	def Item(self, parent):
@@ -562,8 +563,10 @@ class CallGraphRootItem(CallGraphLevelItemBase):
 class CallGraphModel(TreeModel):
 
 	def __init__(self, glb, parent=None):
-		super(CallGraphModel, self).__init__(CallGraphRootItem(glb), parent)
-		self.glb = glb
+		super(CallGraphModel, self).__init__(glb, parent)
+
+	def GetRoot(self):
+		return CallGraphRootItem(self.glb)
 
 	def columnCount(self, parent=None):
 		return 7
@@ -1339,8 +1342,7 @@ class BranchModel(TreeModel):
 	progress = Signal(object)
 
 	def __init__(self, glb, event_id, where_clause, parent=None):
-		super(BranchModel, self).__init__(BranchRootItem(), parent)
-		self.glb = glb
+		super(BranchModel, self).__init__(glb, parent)
 		self.event_id = event_id
 		self.more = True
 		self.populated = 0
@@ -1364,6 +1366,9 @@ class BranchModel(TreeModel):
 		self.fetcher.done.connect(self.Update)
 		self.fetcher.Fetch(glb_chunk_sz)
 
+	def GetRoot(self):
+		return BranchRootItem()
+
 	def columnCount(self, parent=None):
 		return 8
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 50+ messages in thread

* [PATCH 14/35] perf scripts python: exported-sql-viewer.py: Factor out CallGraphModelBase
  2019-03-07 17:43 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (12 preceding siblings ...)
  2019-03-07 17:44 ` [PATCH 13/35] perf scripts python: exported-sql-viewer.py: Improve TreeModel abstraction Arnaldo Carvalho de Melo
@ 2019-03-07 17:44 ` Arnaldo Carvalho de Melo
  2019-03-07 17:44 ` [PATCH 15/35] perf scripts python: exported-sql-viewer.py: Add call tree Arnaldo Carvalho de Melo
                   ` (21 subsequent siblings)
  35 siblings, 0 replies; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-03-07 17:44 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel,
	linux-perf-users, Adrian Hunter, Jiri Olsa,
	Arnaldo Carvalho de Melo

From: Adrian Hunter <adrian.hunter@intel.com>

Factor out a base class CallGraphModelBase from CallGraphModel, so that
CallGraphModelBase can be reused.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: https://lkml.kernel.org/n/tip-76eybebzjwvgnadkm2oufrqi@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 .../scripts/python/exported-sql-viewer.py     | 100 ++++++++++--------
 1 file changed, 55 insertions(+), 45 deletions(-)

diff --git a/tools/perf/scripts/python/exported-sql-viewer.py b/tools/perf/scripts/python/exported-sql-viewer.py
index b2a22525549d..c4a2134d85f5 100755
--- a/tools/perf/scripts/python/exported-sql-viewer.py
+++ b/tools/perf/scripts/python/exported-sql-viewer.py
@@ -558,26 +558,12 @@ class CallGraphRootItem(CallGraphLevelItemBase):
 			self.child_items.append(child_item)
 			self.child_count += 1
 
-# Context-sensitive call graph data model
+# Context-sensitive call graph data model base
 
-class CallGraphModel(TreeModel):
+class CallGraphModelBase(TreeModel):
 
 	def __init__(self, glb, parent=None):
-		super(CallGraphModel, self).__init__(glb, parent)
-
-	def GetRoot(self):
-		return CallGraphRootItem(self.glb)
-
-	def columnCount(self, parent=None):
-		return 7
-
-	def columnHeader(self, column):
-		headers = ["Call Path", "Object", "Count ", "Time (ns) ", "Time (%) ", "Branch Count ", "Branch Count (%) "]
-		return headers[column]
-
-	def columnAlignment(self, column):
-		alignment = [ Qt.AlignLeft, Qt.AlignLeft, Qt.AlignRight, Qt.AlignRight, Qt.AlignRight, Qt.AlignRight, Qt.AlignRight ]
-		return alignment[column]
+		super(CallGraphModelBase, self).__init__(glb, parent)
 
 	def FindSelect(self, value, pattern, query):
 		if pattern:
@@ -597,34 +583,7 @@ class CallGraphModel(TreeModel):
 				match = " GLOB '" + str(value) + "'"
 		else:
 			match = " = '" + str(value) + "'"
-		QueryExec(query, "SELECT call_path_id, comm_id, thread_id"
-						" FROM calls"
-						" INNER JOIN call_paths ON calls.call_path_id = call_paths.id"
-						" INNER JOIN symbols ON call_paths.symbol_id = symbols.id"
-						" WHERE symbols.name" + match +
-						" GROUP BY comm_id, thread_id, call_path_id"
-						" ORDER BY comm_id, thread_id, call_path_id")
-
-	def FindPath(self, query):
-		# Turn the query result into a list of ids that the tree view can walk
-		# to open the tree at the right place.
-		ids = []
-		parent_id = query.value(0)
-		while parent_id:
-			ids.insert(0, parent_id)
-			q2 = QSqlQuery(self.glb.db)
-			QueryExec(q2, "SELECT parent_id"
-					" FROM call_paths"
-					" WHERE id = " + str(parent_id))
-			if not q2.next():
-				break
-			parent_id = q2.value(0)
-		# The call path root is not used
-		if ids[0] == 1:
-			del ids[0]
-		ids.insert(0, query.value(2))
-		ids.insert(0, query.value(1))
-		return ids
+		self.DoFindSelect(query, match)
 
 	def Found(self, query, found):
 		if found:
@@ -678,6 +637,57 @@ class CallGraphModel(TreeModel):
 	def FindDone(self, thread, callback, ids):
 		callback(ids)
 
+# Context-sensitive call graph data model
+
+class CallGraphModel(CallGraphModelBase):
+
+	def __init__(self, glb, parent=None):
+		super(CallGraphModel, self).__init__(glb, parent)
+
+	def GetRoot(self):
+		return CallGraphRootItem(self.glb)
+
+	def columnCount(self, parent=None):
+		return 7
+
+	def columnHeader(self, column):
+		headers = ["Call Path", "Object", "Count ", "Time (ns) ", "Time (%) ", "Branch Count ", "Branch Count (%) "]
+		return headers[column]
+
+	def columnAlignment(self, column):
+		alignment = [ Qt.AlignLeft, Qt.AlignLeft, Qt.AlignRight, Qt.AlignRight, Qt.AlignRight, Qt.AlignRight, Qt.AlignRight ]
+		return alignment[column]
+
+	def DoFindSelect(self, query, match):
+		QueryExec(query, "SELECT call_path_id, comm_id, thread_id"
+						" FROM calls"
+						" INNER JOIN call_paths ON calls.call_path_id = call_paths.id"
+						" INNER JOIN symbols ON call_paths.symbol_id = symbols.id"
+						" WHERE symbols.name" + match +
+						" GROUP BY comm_id, thread_id, call_path_id"
+						" ORDER BY comm_id, thread_id, call_path_id")
+
+	def FindPath(self, query):
+		# Turn the query result into a list of ids that the tree view can walk
+		# to open the tree at the right place.
+		ids = []
+		parent_id = query.value(0)
+		while parent_id:
+			ids.insert(0, parent_id)
+			q2 = QSqlQuery(self.glb.db)
+			QueryExec(q2, "SELECT parent_id"
+					" FROM call_paths"
+					" WHERE id = " + str(parent_id))
+			if not q2.next():
+				break
+			parent_id = q2.value(0)
+		# The call path root is not used
+		if ids[0] == 1:
+			del ids[0]
+		ids.insert(0, query.value(2))
+		ids.insert(0, query.value(1))
+		return ids
+
 # Vertical widget layout
 
 class VBox():
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 50+ messages in thread

* [PATCH 15/35] perf scripts python: exported-sql-viewer.py: Add call tree
  2019-03-07 17:43 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (13 preceding siblings ...)
  2019-03-07 17:44 ` [PATCH 14/35] perf scripts python: exported-sql-viewer.py: Factor out CallGraphModelBase Arnaldo Carvalho de Melo
@ 2019-03-07 17:44 ` Arnaldo Carvalho de Melo
  2019-03-07 17:44 ` [PATCH 16/35] perf beauty msg_flags: Add missing %s lost when adding prefix suppression logic Arnaldo Carvalho de Melo
                   ` (20 subsequent siblings)
  35 siblings, 0 replies; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-03-07 17:44 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel,
	linux-perf-users, Adrian Hunter, Arnaldo Carvalho de Melo,
	Jiri Olsa

From: Adrian Hunter <adrian.hunter@intel.com>

Add a new report to display a call tree. The Call Tree report is very
similar to the Context-Sensitive Call Graph, but the data is not
aggregated. Also the 'Count' column, which would be always 1, is replaced
by the 'Call Time'.

Committer testing:

  $ cat simple-retpoline.c
  /*

    https://lkml.kernel.org/r/20190109091835.5570-6-adrian.hunter@intel.com

  $ gcc -ggdb3 -Wall -Wextra -O2 -o simple-retpoline simple-retpoline.c
  $ objdump -d simple-retpoline
  */

  __attribute__((noinline)) int bar(void)
  {
          return -1;
  }

  int foo(void)
  {
          return bar() + 1;
  }

  __attribute__((indirect_branch("thunk"))) int main()
  {
          int (*volatile fn)(void) = foo;

          fn();
          return fn();
  }
  $
  $ perf record -o simple-retpoline.perf.data -e intel_pt/cyc/u ./simple-retpoline
  $ perf script -i simple-retpoline.perf.data --itrace=be -s ~acme/libexec/perf-core/scripts/python/export-to-sqlite.py simple-retpoline.db branches calls
  $ python ~acme/libexec/perf-core/scripts/python/exported-sql-viewer.py simple-retpoline.db

And in the GUI select:

    "Reports"
      "Call Tree"

    Call Path                 | Object          | Call Time (ns) | Time (ns) | Time (%) | Branch Count | Brach Count (%) |
    > simple-retpolin
      > PID:TID
        > _start                ld-2.28.so       2193855505777      156267      100.0       10602          100.0
            unknown             unknown          2193855506010        2276        1.5           1            0.0
          > _dl_start           ld-2.28.so       2193855508286      137047       87.7       10088           95.2
          > _dl_init            ld-2.28.so       2193855645444        9142        5.9         326            3.1
          > _start              simple-retpoline 2193855654587        7457        4.8         182            1.7
            > __libc_start_main <SNIP>
              <SNIP>
              > main            simple-retpoline 2193855657493          32        0.5          12            6.7
                > foo           simple-retpoline 2193855657493          14       43.8           5           41.7
              <SNIP>

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: https://lkml.kernel.org/n/tip-enf0w96gqzfpv4fi16pw9ovc@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 .../scripts/python/exported-sql-viewer.py     | 195 +++++++++++++++++-
 1 file changed, 186 insertions(+), 9 deletions(-)

diff --git a/tools/perf/scripts/python/exported-sql-viewer.py b/tools/perf/scripts/python/exported-sql-viewer.py
index c4a2134d85f5..afec9479ca7f 100755
--- a/tools/perf/scripts/python/exported-sql-viewer.py
+++ b/tools/perf/scripts/python/exported-sql-viewer.py
@@ -688,6 +688,150 @@ class CallGraphModel(CallGraphModelBase):
 		ids.insert(0, query.value(1))
 		return ids
 
+# Call tree data model level 2+ item base
+
+class CallTreeLevelTwoPlusItemBase(CallGraphLevelItemBase):
+
+	def __init__(self, glb, row, comm_id, thread_id, calls_id, time, branch_count, parent_item):
+		super(CallTreeLevelTwoPlusItemBase, self).__init__(glb, row, parent_item)
+		self.comm_id = comm_id
+		self.thread_id = thread_id
+		self.calls_id = calls_id
+		self.branch_count = branch_count
+		self.time = time
+
+	def Select(self):
+		self.query_done = True;
+		if self.calls_id == 0:
+			comm_thread = " AND comm_id = " + str(self.comm_id) + " AND thread_id = " + str(self.thread_id)
+		else:
+			comm_thread = ""
+		query = QSqlQuery(self.glb.db)
+		QueryExec(query, "SELECT calls.id, name, short_name, call_time, return_time - call_time, branch_count"
+					" FROM calls"
+					" INNER JOIN call_paths ON calls.call_path_id = call_paths.id"
+					" INNER JOIN symbols ON call_paths.symbol_id = symbols.id"
+					" INNER JOIN dsos ON symbols.dso_id = dsos.id"
+					" WHERE calls.parent_id = " + str(self.calls_id) + comm_thread +
+					" ORDER BY call_time, calls.id")
+		while query.next():
+			child_item = CallTreeLevelThreeItem(self.glb, self.child_count, self.comm_id, self.thread_id, query.value(0), query.value(1), query.value(2), query.value(3), int(query.value(4)), int(query.value(5)), self)
+			self.child_items.append(child_item)
+			self.child_count += 1
+
+# Call tree data model level three item
+
+class CallTreeLevelThreeItem(CallTreeLevelTwoPlusItemBase):
+
+	def __init__(self, glb, row, comm_id, thread_id, calls_id, name, dso, count, time, branch_count, parent_item):
+		super(CallTreeLevelThreeItem, self).__init__(glb, row, comm_id, thread_id, calls_id, time, branch_count, parent_item)
+		dso = dsoname(dso)
+		self.data = [ name, dso, str(count), str(time), PercentToOneDP(time, parent_item.time), str(branch_count), PercentToOneDP(branch_count, parent_item.branch_count) ]
+		self.dbid = calls_id
+
+# Call tree data model level two item
+
+class CallTreeLevelTwoItem(CallTreeLevelTwoPlusItemBase):
+
+	def __init__(self, glb, row, comm_id, thread_id, pid, tid, parent_item):
+		super(CallTreeLevelTwoItem, self).__init__(glb, row, comm_id, thread_id, 0, 0, 0, parent_item)
+		self.data = [str(pid) + ":" + str(tid), "", "", "", "", "", ""]
+		self.dbid = thread_id
+
+	def Select(self):
+		super(CallTreeLevelTwoItem, self).Select()
+		for child_item in self.child_items:
+			self.time += child_item.time
+			self.branch_count += child_item.branch_count
+		for child_item in self.child_items:
+			child_item.data[4] = PercentToOneDP(child_item.time, self.time)
+			child_item.data[6] = PercentToOneDP(child_item.branch_count, self.branch_count)
+
+# Call tree data model level one item
+
+class CallTreeLevelOneItem(CallGraphLevelItemBase):
+
+	def __init__(self, glb, row, comm_id, comm, parent_item):
+		super(CallTreeLevelOneItem, self).__init__(glb, row, parent_item)
+		self.data = [comm, "", "", "", "", "", ""]
+		self.dbid = comm_id
+
+	def Select(self):
+		self.query_done = True;
+		query = QSqlQuery(self.glb.db)
+		QueryExec(query, "SELECT thread_id, pid, tid"
+					" FROM comm_threads"
+					" INNER JOIN threads ON thread_id = threads.id"
+					" WHERE comm_id = " + str(self.dbid))
+		while query.next():
+			child_item = CallTreeLevelTwoItem(self.glb, self.child_count, self.dbid, query.value(0), query.value(1), query.value(2), self)
+			self.child_items.append(child_item)
+			self.child_count += 1
+
+# Call tree data model root item
+
+class CallTreeRootItem(CallGraphLevelItemBase):
+
+	def __init__(self, glb):
+		super(CallTreeRootItem, self).__init__(glb, 0, None)
+		self.dbid = 0
+		self.query_done = True;
+		query = QSqlQuery(glb.db)
+		QueryExec(query, "SELECT id, comm FROM comms")
+		while query.next():
+			if not query.value(0):
+				continue
+			child_item = CallTreeLevelOneItem(glb, self.child_count, query.value(0), query.value(1), self)
+			self.child_items.append(child_item)
+			self.child_count += 1
+
+# Call Tree data model
+
+class CallTreeModel(CallGraphModelBase):
+
+	def __init__(self, glb, parent=None):
+		super(CallTreeModel, self).__init__(glb, parent)
+
+	def GetRoot(self):
+		return CallTreeRootItem(self.glb)
+
+	def columnCount(self, parent=None):
+		return 7
+
+	def columnHeader(self, column):
+		headers = ["Call Path", "Object", "Call Time", "Time (ns) ", "Time (%) ", "Branch Count ", "Branch Count (%) "]
+		return headers[column]
+
+	def columnAlignment(self, column):
+		alignment = [ Qt.AlignLeft, Qt.AlignLeft, Qt.AlignRight, Qt.AlignRight, Qt.AlignRight, Qt.AlignRight, Qt.AlignRight ]
+		return alignment[column]
+
+	def DoFindSelect(self, query, match):
+		QueryExec(query, "SELECT calls.id, comm_id, thread_id"
+						" FROM calls"
+						" INNER JOIN call_paths ON calls.call_path_id = call_paths.id"
+						" INNER JOIN symbols ON call_paths.symbol_id = symbols.id"
+						" WHERE symbols.name" + match +
+						" ORDER BY comm_id, thread_id, call_time, calls.id")
+
+	def FindPath(self, query):
+		# Turn the query result into a list of ids that the tree view can walk
+		# to open the tree at the right place.
+		ids = []
+		parent_id = query.value(0)
+		while parent_id:
+			ids.insert(0, parent_id)
+			q2 = QSqlQuery(self.glb.db)
+			QueryExec(q2, "SELECT parent_id"
+					" FROM calls"
+					" WHERE id = " + str(parent_id))
+			if not q2.next():
+				break
+			parent_id = q2.value(0)
+		ids.insert(0, query.value(2))
+		ids.insert(0, query.value(1))
+		return ids
+
 # Vertical widget layout
 
 class VBox():
@@ -772,6 +916,29 @@ class CallGraphWindow(TreeWindowBase):
 
 		AddSubWindow(glb.mainwindow.mdi_area, self, "Context-Sensitive Call Graph")
 
+# Call tree window
+
+class CallTreeWindow(TreeWindowBase):
+
+	def __init__(self, glb, parent=None):
+		super(CallTreeWindow, self).__init__(parent)
+
+		self.model = LookupCreateModel("Call Tree", lambda x=glb: CallTreeModel(x))
+
+		self.view = QTreeView()
+		self.view.setModel(self.model)
+
+		for c, w in ((0, 230), (1, 100), (2, 100), (3, 70), (4, 70), (5, 100)):
+			self.view.setColumnWidth(c, w)
+
+		self.find_bar = FindBar(self, self)
+
+		self.vbox = VBox(self.view, self.find_bar.Widget())
+
+		self.setWidget(self.vbox.Widget())
+
+		AddSubWindow(glb.mainwindow.mdi_area, self, "Call Tree")
+
 # Child data item  finder
 
 class ChildDataItemFinder():
@@ -1890,10 +2057,10 @@ def GetEventList(db):
 
 # Is a table selectable
 
-def IsSelectable(db, table):
+def IsSelectable(db, table, sql = ""):
 	query = QSqlQuery(db)
 	try:
-		QueryExec(query, "SELECT * FROM " + table + " LIMIT 1")
+		QueryExec(query, "SELECT * FROM " + table + " " + sql + " LIMIT 1")
 	except:
 		return False
 	return True
@@ -2302,9 +2469,10 @@ p.c2 {
 </style>
 <p class=c1><a href=#reports>1. Reports</a></p>
 <p class=c2><a href=#callgraph>1.1 Context-Sensitive Call Graph</a></p>
-<p class=c2><a href=#allbranches>1.2 All branches</a></p>
-<p class=c2><a href=#selectedbranches>1.3 Selected branches</a></p>
-<p class=c2><a href=#topcallsbyelapsedtime>1.4 Top calls by elapsed time</a></p>
+<p class=c2><a href=#calltree>1.2 Call Tree</a></p>
+<p class=c2><a href=#allbranches>1.3 All branches</a></p>
+<p class=c2><a href=#selectedbranches>1.4 Selected branches</a></p>
+<p class=c2><a href=#topcallsbyelapsedtime>1.5 Top calls by elapsed time</a></p>
 <p class=c1><a href=#tables>2. Tables</a></p>
 <h1 id=reports>1. Reports</h1>
 <h2 id=callgraph>1.1 Context-Sensitive Call Graph</h2>
@@ -2340,7 +2508,10 @@ v- ls
 <h3>Find</h3>
 Ctrl-F displays a Find bar which finds function names by either an exact match or a pattern match.
 The pattern matching symbols are ? for any character and * for zero or more characters.
-<h2 id=allbranches>1.2 All branches</h2>
+<h2 id=calltree>1.2 Call Tree</h2>
+The Call Tree report is very similar to the Context-Sensitive Call Graph, but the data is not aggregated.
+Also the 'Count' column, which would be always 1, is replaced by the 'Call Time'.
+<h2 id=allbranches>1.3 All branches</h2>
 The All branches report displays all branches in chronological order.
 Not all data is fetched immediately. More records can be fetched using the Fetch bar provided.
 <h3>Disassembly</h3>
@@ -2366,10 +2537,10 @@ sudo ldconfig
 Ctrl-F displays a Find bar which finds substrings by either an exact match or a regular expression match.
 Refer to Python documentation for the regular expression syntax.
 All columns are searched, but only currently fetched rows are searched.
-<h2 id=selectedbranches>1.3 Selected branches</h2>
+<h2 id=selectedbranches>1.4 Selected branches</h2>
 This is the same as the <a href=#allbranches>All branches</a> report but with the data reduced
 by various selection criteria. A dialog box displays available criteria which are AND'ed together.
-<h3>1.3.1 Time ranges</h3>
+<h3>1.4.1 Time ranges</h3>
 The time ranges hint text shows the total time range. Relative time ranges can also be entered in
 ms, us or ns. Also, negative values are relative to the end of trace.  Examples:
 <pre>
@@ -2380,7 +2551,7 @@ ms, us or ns. Also, negative values are relative to the end of trace.  Examples:
 	-10ms-			The last 10ms
 </pre>
 N.B. Due to the granularity of timestamps, there could be no branches in any given time range.
-<h2 id=topcallsbyelapsedtime>1.4 Top calls by elapsed time</h2>
+<h2 id=topcallsbyelapsedtime>1.5 Top calls by elapsed time</h2>
 The Top calls by elapsed time report displays calls in descending order of time elapsed between when the function was called and when it returned.
 The data is reduced by various selection criteria. A dialog box displays available criteria which are AND'ed together.
 If not all data is fetched, a Fetch bar is provided. Ctrl-F displays a Find bar.
@@ -2516,6 +2687,9 @@ class MainWindow(QMainWindow):
 		if IsSelectable(glb.db, "calls"):
 			reports_menu.addAction(CreateAction("Context-Sensitive Call &Graph", "Create a new window containing a context-sensitive call graph", self.NewCallGraph, self))
 
+		if IsSelectable(glb.db, "calls", "WHERE parent_id >= 0"):
+			reports_menu.addAction(CreateAction("Call &Tree", "Create a new window containing a call tree", self.NewCallTree, self))
+
 		self.EventMenu(GetEventList(glb.db), reports_menu)
 
 		if IsSelectable(glb.db, "calls"):
@@ -2576,6 +2750,9 @@ class MainWindow(QMainWindow):
 	def NewCallGraph(self):
 		CallGraphWindow(self.glb, self)
 
+	def NewCallTree(self):
+		CallTreeWindow(self.glb, self)
+
 	def NewTopCalls(self):
 		dialog = TopCallsDialog(self.glb, self)
 		ret = dialog.exec_()
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 50+ messages in thread

* [PATCH 16/35] perf beauty msg_flags: Add missing %s lost when adding prefix suppression logic
  2019-03-07 17:43 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (14 preceding siblings ...)
  2019-03-07 17:44 ` [PATCH 15/35] perf scripts python: exported-sql-viewer.py: Add call tree Arnaldo Carvalho de Melo
@ 2019-03-07 17:44 ` Arnaldo Carvalho de Melo
  2019-03-07 17:44 ` [PATCH 17/35] perf bpf: Automatically add BTF ELF markers Arnaldo Carvalho de Melo
                   ` (19 subsequent siblings)
  35 siblings, 0 replies; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-03-07 17:44 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel,
	linux-perf-users, Arnaldo Carvalho de Melo, Adrian Hunter,
	Luis Cláudio Gonçalves, Wang Nan

From: Arnaldo Carvalho de Melo <acme@redhat.com>

When the prefix suppresion/enabling logic was added, I forgot to add an
extra %, which ended up chopping off the strings:

Before:

  # perf trace -e *mmsg --map-dump syscalls
  [299] = 1,
  [307] = 1,
  DNS Res~ver #3/14587 sendmmsg(106<socket:[3462393]>, 0x7f252b0fcaf0, 2, MSG_) = 2
  chronyd/1053 recvmmsg(4, 0x558542ca5740, 4, MSG_, NULL) = 1
  DNS Res~ver #2/14445 sendmmsg(106<socket:[3461475]>, 0x7f252ab09af0, 2, MSG_) = 2
  DNS Res~ver #2/14444 sendmmsg(146<socket:[3457863]>, 0x7f2521a7aaf0, 2, MSG_) = 2
  DNS Res~ver #2/14445 sendmmsg(106<socket:[3461475]>, 0x7f252ab09af0, 2, MSG_) = 2
  DNS Res~ver #3/14587 sendmmsg(148<socket:[3460636]>, 0x7f252b0fcaf0, 2, MSG_) = 2
  DNS Res~ver #2/14444 sendmmsg(146<socket:[3457863]>, 0x7f2521a7aaf0, 2, MSG_) = 2
  ^C#

After:

  # perf trace -e *mmsg --map-dump syscalls
  [299] = 1,
  [307] = 1,
  NetworkManager/17467 sendmmsg(22<socket:[3466493]>, 0x7f28927f9bb0, 2, MSG_NOSIGNAL) = 2
  pool/17478 sendmmsg(10<socket:[3466523]>, 0x7f2769f95e90, 2, MSG_NOSIGNAL) = 2
  DNS Res~ver #3/14587 sendmmsg(121<socket:[3466132]>, 0x7f252b0fcaf0, 2, MSG_NOSIGNAL) = 2
  chronyd/1053 recvmmsg(4, 0x558542ca5740, 4, MSG_DONTWAIT, NULL) = 1
  Socket Thread/17433 sendmmsg(121<socket:[3460903]>, 0x7f252668baf0, 2, MSG_NOSIGNAL) = 2
  ^C#

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Fixes: c65c83ffe904 ("perf trace: Allow asking for not suppressing common string prefixes")
Link: https://lkml.kernel.org/n/tip-t2eu1rqx710k6jr4814mlzg7@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/trace/beauty/msg_flags.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/trace/beauty/msg_flags.c b/tools/perf/trace/beauty/msg_flags.c
index d66c66315987..ea68db08b8e7 100644
--- a/tools/perf/trace/beauty/msg_flags.c
+++ b/tools/perf/trace/beauty/msg_flags.c
@@ -29,7 +29,7 @@ static size_t syscall_arg__scnprintf_msg_flags(char *bf, size_t size,
 		return scnprintf(bf, size, "NONE");
 #define	P_MSG_FLAG(n) \
 	if (flags & MSG_##n) { \
-		printed += scnprintf(bf + printed, size - printed, "%s%s", printed ? "|" : "", show_prefix ? prefix : "", #n); \
+		printed += scnprintf(bf + printed, size - printed, "%s%s%s", printed ? "|" : "", show_prefix ? prefix : "", #n); \
 		flags &= ~MSG_##n; \
 	}
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 50+ messages in thread

* [PATCH 17/35] perf bpf: Automatically add BTF ELF markers
  2019-03-07 17:43 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (15 preceding siblings ...)
  2019-03-07 17:44 ` [PATCH 16/35] perf beauty msg_flags: Add missing %s lost when adding prefix suppression logic Arnaldo Carvalho de Melo
@ 2019-03-07 17:44 ` Arnaldo Carvalho de Melo
  2019-03-07 17:44 ` [PATCH 18/35] perf clang: Remove needless extra semicolon Arnaldo Carvalho de Melo
                   ` (18 subsequent siblings)
  35 siblings, 0 replies; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-03-07 17:44 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel,
	linux-perf-users, Arnaldo Carvalho de Melo, Adrian Hunter,
	Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann,
	Luis Cláudio Gonçalves, Martin KaFai Lau, Song Liu,
	Wang Nan, Yonghong Song

From: Arnaldo Carvalho de Melo <acme@redhat.com>

The libbpf loader expects that some __btf_map_<MAP_NAME> structs be in
place with the keys and values types of maps so that one can store the
struct definitions and have them sent to the kernel via sys_bpf(fd, cmd
= BTF_LOAD) and then later be retrievable via sys_bpf(fd, cmd =
BPF_OBJ_GET_INFO_BY_FD) for use by tools such as 'bpftool map dump id
MAP_ID'.

Since we already have this for defining maps in 'perf trace' BPF events:

   bpf_map(name, _type, type_key, type_val, _max_entries)

As used in the tools/perf/examples/bpf/augmented_raw_syscalls.c:

 --- 8< ---

struct syscall {
        bool    enabled;
};

bpf_map(syscalls, ARRAY, int, struct syscall, 512);

 --- 8< ---

All we need is to get all that already available info, piggyback on the
'bpf_map' define in tools/perf/include/bpf/bpf.h, that is included by
'perf trace' BPF programs and do that without requiring changes to the
BPF programs already defining maps using 'bpf_map()'.

So this is what we have before this patch:

1) With this in ~/.perfconfig to dump .c events as .o, aka save a copy
   so that we can use the .o later as a pre-compiled BPF bytecode:

  # grep '\[llvm\]' -A2 ~/.perfconfig
  [llvm]
	dump-obj = true
	clang-opt = -g

  #
  # clang --version
  clang version 9.0.0 (https://git.llvm.org/git/clang.git/ 7906282d3afec5dfdc2b27943fd6c0309086c507) (https://git.llvm.org/git/llvm.git/ a1b5de1ff8ae8bc79dc8e86e1f82565229bd0500)
  Target: x86_64-unknown-linux-gnu
  Thread model: posix
  InstalledDir: /opt/llvm/bin

2) Note the -g there so that we get clang to generate debuginfo, and
   since the target is 'bpf' it will generate the BTF info in this
   clang version (9.0).

3) Run a simple 'perf record' specifiying as an event the augmented_raw_syscalls.c
   source code:

  # perf record -e /home/acme/git/perf/tools/perf/examples/bpf/augmented_raw_syscalls.c sleep 1
  LLVM: dumping /home/acme/git/perf/tools/perf/examples/bpf/augmented_raw_syscalls.o
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.025 MB perf.data ]

  # file /home/acme/git/perf/tools/perf/examples/bpf/augmented_raw_syscalls.o
  /home/acme/git/perf/tools/perf/examples/bpf/augmented_raw_syscalls.o: ELF 64-bit LSB relocatable, eBPF, version 1 (SYSV), with debug_info, not stripped

4) Look at the BTF structs encoded in it:

  # pahole -F btf --sizes /home/acme/git/perf/tools/perf/examples/bpf/augmented_raw_syscalls.o
  syscall_enter_args	64	0
  augmented_filename	264	0
  syscall	1	0
  syscall_exit_args	24	0
  bpf_map	28	0
  #
  # pahole -F btf -C syscalls /home/acme/git/perf/tools/perf/examples/bpf/augmented_raw_syscalls.o
  # pahole -F btf -C syscall /home/acme/git/perf/tools/perf/examples/bpf/augmented_raw_syscalls.o
  struct syscall {
	  bool                       enabled;              /*     0     1 */

	  /* size: 1, cachelines: 1, members: 1 */
	  /* last cacheline: 1 bytes */
  };
  #

5) Ok, with just this we don't have the markers expected by the libbpf
   loader and when we run with this BPF bytecode, because we have:

  # grep '\[trace\]' -A1 ~/.perfconfig
  [trace]
	add_events = /home/acme/git/perf/tools/perf/examples/bpf/augmented_raw_syscalls.o
  #

6) Lets do a 'perf trace' system wide session using this BPF program:

   # perf trace -e *mmsg,open*
  Cache2 I/O/6885 openat(AT_FDCWD, "/home/acme/.cache/mozilla/firefox/ina67tev.default/cache2/entries/BA220AB2914006A7AE96D27BE6EA13DD77519FCA", O_RDWR|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR) = 106
  Cache2 I/O/6885 openat(AT_FDCWD, "/proc/self/mountinfo", O_RDONLY) = 121
  Cache2 I/O/6885 openat(AT_FDCWD, "/proc/self/mountinfo", O_RDONLY) = 121
  Cache2 I/O/6885 openat(AT_FDCWD, "/proc/self/mountinfo", O_RDONLY) = 121
  Cache2 I/O/6885 openat(AT_FDCWD, "/proc/self/mountinfo", O_RDONLY) = 121
  DNS Res~ver #3/23340 openat(AT_FDCWD, "/etc/hosts", O_RDONLY|O_CLOEXEC) = 106
  DNS Res~ver #3/23340 sendmmsg(106<socket:[3482690]>, 0x7f252f1fcaf0, 2, MSG_NOSIGNAL) = 2
  Cache2 I/O/6885 openat(AT_FDCWD, "/home/acme/.cache/mozilla/firefox/ina67tev.default/cache2/entries/BA220AB2914006A7AE96D27BE6EA13DD77519FCA", O_RDWR) = 106
  lighttpd/18915 openat(AT_FDCWD, "/proc/loadavg", O_RDONLY) = 12

7) While it runs lets see the maps that 'perf trace' + libbpf's BPF
  loader loaded into the kernel via sys_bpf(fd, BPF_BTF_LOAD, ...):

  # bpftool map list | tail -6
  149: perf_event_array  name __augmented_sys  flags 0x0
	  key 4B  value 4B  max_entries 8  memlock 4096B
  150: array  name syscalls  flags 0x0
	  key 4B  value 1B  max_entries 512  memlock 8192B
  151: hash  name pids_filtered  flags 0x0
	  key 4B  value 1B  max_entries 64  memlock 8192B
  #

8) Dump the "pids_filtered", map, that will have one entry per PID that
   'perf trace' wants filtered, which includes its own, to avoid a
   tracing feedback loop (perf trace shows the syscalls it does which
   generates more syscalls that it has to show that...), it also
   auto-filters the 'gnome-terminal' and 'sshd' parent PIDs, for the
   same reason:

  # bpftool map dump id 151
  key: a5 0c 00 00  value: 01
  key: 14 63 00 00  value: 01
  Found 2 elements
  #

9) Since there is no BTF info available, it does a generic hex dump :-\

10) Now, with this patch applied, we'll do steps 3 to 6 again and look
    with pahole if there are extra structs encoded in BTF:

  # pahole -F btf --sizes /home/acme/git/perf/tools/perf/examples/bpf/augmented_raw_syscalls.o
  syscall_enter_args	64	0
  augmented_filename	264	0
  syscall	1	0
  syscall_exit_args	24	0
  bpf_map	28	0
  ____btf_map___augmented_syscalls__	8	0
  ____btf_map_syscalls	8	0
  ____btf_map_pids_filtered	8	0
  #

11) Yes, those __btf_map_ + the map names, lets see how they look like:

  # pahole -F btf -C ____btf_map_syscalls /home/acme/git/perf/tools/perf/examples/bpf/augmented_raw_syscalls.o
  struct ____btf_map_syscalls {
	  int                        key;                  /*     0     4 */
	  struct syscall             value;                /*     4     1 */

	  /* size: 8, cachelines: 1, members: 2 */
	  /* padding: 3 */
	  /* last cacheline: 8 bytes */
  };
  #

12) Lets repeat step 7 to get the new map ids:

  # bpftool map list | tail -6
  155: perf_event_array  name __augmented_sys  flags 0x0
	  key 4B  value 4B  max_entries 8  memlock 4096B
  156: array  name syscalls  flags 0x0
	  key 4B  value 1B  max_entries 512  memlock 8192B
  157: hash  name pids_filtered  flags 0x0
	  key 4B  value 1B  max_entries 64  memlock 8192B
  #

13) And finally lets dump the 'pids_filtered':

  # bpftool map dump id 157
  [{
        "key": 3237,
        "value": true
    },{
        "key": 26435,
        "value": true
    }
  ]
  #

Looks much better! BTF info was used to interpret the key as an integer
and the value as a struct with just one boolean member, so to make it
more compact, show just the 'true' value where we saw '01'.

Now to make 'perf trace --dump-map' to use BTF!

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
Cc: Martin KaFai Lau <kafai@fb.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Song Liu <songliubraving@fb.com>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: Yonghong Song <yhs@fb.com>
Link: https://lkml.kernel.org/n/tip-ybuf9wpkm30xk28iq7jbwb40@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/include/bpf/bpf.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tools/perf/include/bpf/bpf.h b/tools/perf/include/bpf/bpf.h
index 5df7ed9d9020..2eac6d804b2d 100644
--- a/tools/perf/include/bpf/bpf.h
+++ b/tools/perf/include/bpf/bpf.h
@@ -24,7 +24,13 @@ struct bpf_map SEC("maps") name = {				\
 	.key_size    = sizeof(type_key),			\
 	.value_size  = sizeof(type_val),			\
 	.max_entries = _max_entries,				\
-}
+};								\
+struct ____btf_map_##name {					\
+	type_key key;						\
+	type_val value;                                 	\
+};								\
+struct ____btf_map_##name __attribute__((section(".maps." #name), used)) \
+	____btf_map_##name = { }
 
 /*
  * FIXME: this should receive .max_entries as a parameter, as careful
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 50+ messages in thread

* [PATCH 18/35] perf clang: Remove needless extra semicolon
  2019-03-07 17:43 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (16 preceding siblings ...)
  2019-03-07 17:44 ` [PATCH 17/35] perf bpf: Automatically add BTF ELF markers Arnaldo Carvalho de Melo
@ 2019-03-07 17:44 ` Arnaldo Carvalho de Melo
  2019-03-07 17:44 ` [PATCH 19/35] perf annotate: Calculate the max instruction name, align column to that Arnaldo Carvalho de Melo
                   ` (17 subsequent siblings)
  35 siblings, 0 replies; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-03-07 17:44 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel,
	linux-perf-users, Yang Wei, Alexander Shishkin, Jiri Olsa,
	Peter Zijlstra, Yang Wei, Arnaldo Carvalho de Melo

From: Yang Wei <yang.wei9@zte.com.cn>

Delete a superfluous semicolon in getBPFObjectFromModule().

Signed-off-by: Yang Wei <yang.wei9@zte.com.cn>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Yang Wei <albin_yang@163.com>
Link: http://lkml.kernel.org/r/1551710174-3349-1-git-send-email-albin_yang@163.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/c++/clang.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/c++/clang.cpp b/tools/perf/util/c++/clang.cpp
index 39c0004f2886..fc361c3f8570 100644
--- a/tools/perf/util/c++/clang.cpp
+++ b/tools/perf/util/c++/clang.cpp
@@ -156,7 +156,7 @@ getBPFObjectFromModule(llvm::Module *Module)
 #endif
 	if (NotAdded) {
 		llvm::errs() << "TargetMachine can't emit a file of this type\n";
-		return std::unique_ptr<llvm::SmallVectorImpl<char>>(nullptr);;
+		return std::unique_ptr<llvm::SmallVectorImpl<char>>(nullptr);
 	}
 	PM.run(*Module);
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 50+ messages in thread

* [PATCH 19/35] perf annotate: Calculate the max instruction name, align column to that
  2019-03-07 17:43 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (17 preceding siblings ...)
  2019-03-07 17:44 ` [PATCH 18/35] perf clang: Remove needless extra semicolon Arnaldo Carvalho de Melo
@ 2019-03-07 17:44 ` Arnaldo Carvalho de Melo
  2019-03-07 17:44 ` [PATCH 20/35] perf thread: Generalize function to copy from thread addr space from intel-bts code Arnaldo Carvalho de Melo
                   ` (16 subsequent siblings)
  35 siblings, 0 replies; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-03-07 17:44 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel,
	linux-perf-users, Arnaldo Carvalho de Melo, Travis Downs,
	Adrian Hunter

From: Arnaldo Carvalho de Melo <acme@redhat.com>

We were hardcoding '6' as the max instruction name, and we have lots
that are longer than that, see the diff from two 'P' printed TUI
annotations for a libc function that uses instructions with long names,
such as 'vpmovmskb' with its 9 chars:

  --- __strcmp_avx2.annotation.before	2019-03-06 16:31:39.368020425 -0300
  +++ __strcmp_avx2.annotation	2019-03-06 16:32:12.079450508 -0300
  @@ -2,284 +2,284 @@
   Event: cycles:ppp

   Percent        endbr64
  -  0.10         mov    %edi,%eax
  +  0.10         mov        %edi,%eax
  -               xor    %edx,%edx
  +               xor        %edx,%edx
  -  3.54         vpxor  %ymm7,%ymm7,%ymm7
  +  3.54         vpxor      %ymm7,%ymm7,%ymm7
  -               or     %esi,%eax
  +               or         %esi,%eax
  -               and    $0xfff,%eax
  +               and        $0xfff,%eax
  -               cmp    $0xf80,%eax
  +               cmp        $0xf80,%eax
  -             ↓ jg     370
  +             ↓ jg         370
  - 27.07         vmovdqu (%rdi),%ymm1
  + 27.07         vmovdqu    (%rdi),%ymm1
  -  7.97         vpcmpeqb (%rsi),%ymm1,%ymm0
  +  7.97         vpcmpeqb   (%rsi),%ymm1,%ymm0
  -  2.15         vpminub %ymm1,%ymm0,%ymm0
  +  2.15         vpminub    %ymm1,%ymm0,%ymm0
  -  4.09         vpcmpeqb %ymm7,%ymm0,%ymm0
  +  4.09         vpcmpeqb   %ymm7,%ymm0,%ymm0
  -  0.43         vpmovmskb %ymm0,%ecx
  +  0.43         vpmovmskb  %ymm0,%ecx
  -  1.53         test   %ecx,%ecx
  +  1.53         test       %ecx,%ecx
  -             ↓ je     b0
  +             ↓ je         b0
  -  5.26         tzcnt  %ecx,%edx
  +  5.26         tzcnt      %ecx,%edx
  - 18.40         movzbl (%rdi,%rdx,1),%eax
  + 18.40         movzbl     (%rdi,%rdx,1),%eax
  -  7.09         movzbl (%rsi,%rdx,1),%edx
  +  7.09         movzbl     (%rsi,%rdx,1),%edx
  -  3.34         sub    %edx,%eax
  +  3.34         sub        %edx,%eax
     2.37         vzeroupper
                ← retq
                  nop
  -         50:   tzcnt  %ecx,%edx
  +         50:   tzcnt      %ecx,%edx
  -               movzbl 0x20(%rdi,%rdx,1),%eax
  +               movzbl     0x20(%rdi,%rdx,1),%eax
  -               movzbl 0x20(%rsi,%rdx,1),%edx
  +               movzbl     0x20(%rsi,%rdx,1),%edx
  -               sub    %edx,%eax
  +               sub        %edx,%eax
                  vzeroupper
                ← retq
  -               data16 nopw %cs:0x0(%rax,%rax,1)
  +               data16     nopw %cs:0x0(%rax,%rax,1)

Reported-by: Travis Downs <travis.downs@gmail.com>
LPU-Reference: CAOBGo4z1KfmWeOm6Et0cnX5Z6DWsG2PQbAvRn1MhVPJmXHrc5g@mail.gmail.com
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lkml.kernel.org/n/tip-89wsdd9h9g6bvq52sgp6d0u4@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/arch/arm64/annotate/instructions.c |  2 +-
 tools/perf/arch/s390/annotate/instructions.c  |  2 +-
 tools/perf/util/annotate.c                    | 74 ++++++++++++-------
 tools/perf/util/annotate.h                    |  7 +-
 4 files changed, 52 insertions(+), 33 deletions(-)

diff --git a/tools/perf/arch/arm64/annotate/instructions.c b/tools/perf/arch/arm64/annotate/instructions.c
index 76c6345a57d5..8f70a1b282df 100644
--- a/tools/perf/arch/arm64/annotate/instructions.c
+++ b/tools/perf/arch/arm64/annotate/instructions.c
@@ -58,7 +58,7 @@ static int arm64_mov__parse(struct arch *arch __maybe_unused,
 }
 
 static int mov__scnprintf(struct ins *ins, char *bf, size_t size,
-			  struct ins_operands *ops);
+			  struct ins_operands *ops, int max_ins_name);
 
 static struct ins_ops arm64_mov_ops = {
 	.parse	   = arm64_mov__parse,
diff --git a/tools/perf/arch/s390/annotate/instructions.c b/tools/perf/arch/s390/annotate/instructions.c
index de0dd66dbb48..89bb8f2c54ce 100644
--- a/tools/perf/arch/s390/annotate/instructions.c
+++ b/tools/perf/arch/s390/annotate/instructions.c
@@ -46,7 +46,7 @@ static int s390_call__parse(struct arch *arch, struct ins_operands *ops,
 }
 
 static int call__scnprintf(struct ins *ins, char *bf, size_t size,
-			   struct ins_operands *ops);
+			   struct ins_operands *ops, int max_ins_name);
 
 static struct ins_ops s390_call_ops = {
 	.parse	   = s390_call__parse,
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 11a8a447a3af..5f6dbbf5d749 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -198,18 +198,18 @@ static void ins__delete(struct ins_operands *ops)
 }
 
 static int ins__raw_scnprintf(struct ins *ins, char *bf, size_t size,
-			      struct ins_operands *ops)
+			      struct ins_operands *ops, int max_ins_name)
 {
-	return scnprintf(bf, size, "%-6s %s", ins->name, ops->raw);
+	return scnprintf(bf, size, "%-*s %s", max_ins_name, ins->name, ops->raw);
 }
 
 int ins__scnprintf(struct ins *ins, char *bf, size_t size,
-		  struct ins_operands *ops)
+		   struct ins_operands *ops, int max_ins_name)
 {
 	if (ins->ops->scnprintf)
-		return ins->ops->scnprintf(ins, bf, size, ops);
+		return ins->ops->scnprintf(ins, bf, size, ops, max_ins_name);
 
-	return ins__raw_scnprintf(ins, bf, size, ops);
+	return ins__raw_scnprintf(ins, bf, size, ops, max_ins_name);
 }
 
 bool ins__is_fused(struct arch *arch, const char *ins1, const char *ins2)
@@ -273,18 +273,18 @@ static int call__parse(struct arch *arch, struct ins_operands *ops, struct map_s
 }
 
 static int call__scnprintf(struct ins *ins, char *bf, size_t size,
-			   struct ins_operands *ops)
+			   struct ins_operands *ops, int max_ins_name)
 {
 	if (ops->target.sym)
-		return scnprintf(bf, size, "%-6s %s", ins->name, ops->target.sym->name);
+		return scnprintf(bf, size, "%-*s %s", max_ins_name, ins->name, ops->target.sym->name);
 
 	if (ops->target.addr == 0)
-		return ins__raw_scnprintf(ins, bf, size, ops);
+		return ins__raw_scnprintf(ins, bf, size, ops, max_ins_name);
 
 	if (ops->target.name)
-		return scnprintf(bf, size, "%-6s %s", ins->name, ops->target.name);
+		return scnprintf(bf, size, "%-*s %s", max_ins_name, ins->name, ops->target.name);
 
-	return scnprintf(bf, size, "%-6s *%" PRIx64, ins->name, ops->target.addr);
+	return scnprintf(bf, size, "%-*s *%" PRIx64, max_ins_name, ins->name, ops->target.addr);
 }
 
 static struct ins_ops call_ops = {
@@ -388,15 +388,15 @@ static int jump__parse(struct arch *arch, struct ins_operands *ops, struct map_s
 }
 
 static int jump__scnprintf(struct ins *ins, char *bf, size_t size,
-			   struct ins_operands *ops)
+			   struct ins_operands *ops, int max_ins_name)
 {
 	const char *c;
 
 	if (!ops->target.addr || ops->target.offset < 0)
-		return ins__raw_scnprintf(ins, bf, size, ops);
+		return ins__raw_scnprintf(ins, bf, size, ops, max_ins_name);
 
 	if (ops->target.outside && ops->target.sym != NULL)
-		return scnprintf(bf, size, "%-6s %s", ins->name, ops->target.sym->name);
+		return scnprintf(bf, size, "%-*s %s", max_ins_name, ins->name, ops->target.sym->name);
 
 	c = strchr(ops->raw, ',');
 	c = validate_comma(c, ops);
@@ -415,7 +415,7 @@ static int jump__scnprintf(struct ins *ins, char *bf, size_t size,
 			c++;
 	}
 
-	return scnprintf(bf, size, "%-6s %.*s%" PRIx64,
+	return scnprintf(bf, size, "%-*s %.*s%" PRIx64, max_ins_name,
 			 ins->name, c ? c - ops->raw : 0, ops->raw,
 			 ops->target.offset);
 }
@@ -483,16 +483,16 @@ static int lock__parse(struct arch *arch, struct ins_operands *ops, struct map_s
 }
 
 static int lock__scnprintf(struct ins *ins, char *bf, size_t size,
-			   struct ins_operands *ops)
+			   struct ins_operands *ops, int max_ins_name)
 {
 	int printed;
 
 	if (ops->locked.ins.ops == NULL)
-		return ins__raw_scnprintf(ins, bf, size, ops);
+		return ins__raw_scnprintf(ins, bf, size, ops, max_ins_name);
 
-	printed = scnprintf(bf, size, "%-6s ", ins->name);
+	printed = scnprintf(bf, size, "%-*s ", max_ins_name, ins->name);
 	return printed + ins__scnprintf(&ops->locked.ins, bf + printed,
-					size - printed, ops->locked.ops);
+					size - printed, ops->locked.ops, max_ins_name);
 }
 
 static void lock__delete(struct ins_operands *ops)
@@ -564,9 +564,9 @@ static int mov__parse(struct arch *arch, struct ins_operands *ops, struct map_sy
 }
 
 static int mov__scnprintf(struct ins *ins, char *bf, size_t size,
-			   struct ins_operands *ops)
+			   struct ins_operands *ops, int max_ins_name)
 {
-	return scnprintf(bf, size, "%-6s %s,%s", ins->name,
+	return scnprintf(bf, size, "%-*s %s,%s", max_ins_name, ins->name,
 			 ops->source.name ?: ops->source.raw,
 			 ops->target.name ?: ops->target.raw);
 }
@@ -604,9 +604,9 @@ static int dec__parse(struct arch *arch __maybe_unused, struct ins_operands *ops
 }
 
 static int dec__scnprintf(struct ins *ins, char *bf, size_t size,
-			   struct ins_operands *ops)
+			   struct ins_operands *ops, int max_ins_name)
 {
-	return scnprintf(bf, size, "%-6s %s", ins->name,
+	return scnprintf(bf, size, "%-*s %s", max_ins_name, ins->name,
 			 ops->target.name ?: ops->target.raw);
 }
 
@@ -616,9 +616,9 @@ static struct ins_ops dec_ops = {
 };
 
 static int nop__scnprintf(struct ins *ins __maybe_unused, char *bf, size_t size,
-			  struct ins_operands *ops __maybe_unused)
+			  struct ins_operands *ops __maybe_unused, int max_ins_name)
 {
-	return scnprintf(bf, size, "%-6s", "nop");
+	return scnprintf(bf, size, "%-*s", max_ins_name, "nop");
 }
 
 static struct ins_ops nop_ops = {
@@ -1232,12 +1232,12 @@ void disasm_line__free(struct disasm_line *dl)
 	annotation_line__delete(&dl->al);
 }
 
-int disasm_line__scnprintf(struct disasm_line *dl, char *bf, size_t size, bool raw)
+int disasm_line__scnprintf(struct disasm_line *dl, char *bf, size_t size, bool raw, int max_ins_name)
 {
 	if (raw || !dl->ins.ops)
-		return scnprintf(bf, size, "%-6s %s", dl->ins.name, dl->ops.raw);
+		return scnprintf(bf, size, "%-*s %s", max_ins_name, dl->ins.name, dl->ops.raw);
 
-	return ins__scnprintf(&dl->ins, bf, size, &dl->ops);
+	return ins__scnprintf(&dl->ins, bf, size, &dl->ops, max_ins_name);
 }
 
 static void annotation_line__add(struct annotation_line *al, struct list_head *head)
@@ -2414,12 +2414,30 @@ static inline int width_jumps(int n)
 	return 1;
 }
 
+static int annotation__max_ins_name(struct annotation *notes)
+{
+	int max_name = 0, len;
+	struct annotation_line *al;
+
+        list_for_each_entry(al, &notes->src->source, node) {
+		if (al->offset == -1)
+			continue;
+
+		len = strlen(disasm_line(al)->ins.name);
+		if (max_name < len)
+			max_name = len;
+	}
+
+	return max_name;
+}
+
 void annotation__init_column_widths(struct annotation *notes, struct symbol *sym)
 {
 	notes->widths.addr = notes->widths.target =
 		notes->widths.min_addr = hex_width(symbol__size(sym));
 	notes->widths.max_addr = hex_width(sym->end);
 	notes->widths.jumps = width_jumps(notes->max_jump_sources);
+	notes->widths.max_ins_name = annotation__max_ins_name(notes);
 }
 
 void annotation__update_column_widths(struct annotation *notes)
@@ -2583,7 +2601,7 @@ static void disasm_line__write(struct disasm_line *dl, struct annotation *notes,
 		obj__printf(obj, "  ");
 	}
 
-	disasm_line__scnprintf(dl, bf, size, !notes->options->use_offset);
+	disasm_line__scnprintf(dl, bf, size, !notes->options->use_offset, notes->widths.max_ins_name);
 }
 
 static void ipc_coverage_string(char *bf, int size, struct annotation *notes)
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h
index 95053cab41fe..df34fe483164 100644
--- a/tools/perf/util/annotate.h
+++ b/tools/perf/util/annotate.h
@@ -59,14 +59,14 @@ struct ins_ops {
 	void (*free)(struct ins_operands *ops);
 	int (*parse)(struct arch *arch, struct ins_operands *ops, struct map_symbol *ms);
 	int (*scnprintf)(struct ins *ins, char *bf, size_t size,
-			 struct ins_operands *ops);
+			 struct ins_operands *ops, int max_ins_name);
 };
 
 bool ins__is_jump(const struct ins *ins);
 bool ins__is_call(const struct ins *ins);
 bool ins__is_ret(const struct ins *ins);
 bool ins__is_lock(const struct ins *ins);
-int ins__scnprintf(struct ins *ins, char *bf, size_t size, struct ins_operands *ops);
+int ins__scnprintf(struct ins *ins, char *bf, size_t size, struct ins_operands *ops, int max_ins_name);
 bool ins__is_fused(struct arch *arch, const char *ins1, const char *ins2);
 
 #define ANNOTATION__IPC_WIDTH 6
@@ -219,7 +219,7 @@ int __annotation__scnprintf_samples_period(struct annotation *notes,
 					   struct perf_evsel *evsel,
 					   bool show_freq);
 
-int disasm_line__scnprintf(struct disasm_line *dl, char *bf, size_t size, bool raw);
+int disasm_line__scnprintf(struct disasm_line *dl, char *bf, size_t size, bool raw, int max_ins_name);
 size_t disasm__fprintf(struct list_head *head, FILE *fp);
 void symbol__calc_percent(struct symbol *sym, struct perf_evsel *evsel);
 
@@ -289,6 +289,7 @@ struct annotation {
 		u8		target;
 		u8		min_addr;
 		u8		max_addr;
+		u8		max_ins_name;
 	} widths;
 	bool			have_cycles;
 	struct annotated_source *src;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 50+ messages in thread

* [PATCH 20/35] perf thread: Generalize function to copy from thread addr space from intel-bts code
  2019-03-07 17:43 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (18 preceding siblings ...)
  2019-03-07 17:44 ` [PATCH 19/35] perf annotate: Calculate the max instruction name, align column to that Arnaldo Carvalho de Melo
@ 2019-03-07 17:44 ` Arnaldo Carvalho de Melo
  2019-03-07 17:44 ` [PATCH 21/35] perf diff: Support --time filter option Arnaldo Carvalho de Melo
                   ` (15 subsequent siblings)
  35 siblings, 0 replies; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-03-07 17:44 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel,
	linux-perf-users, Andi Kleen, Arnaldo Carvalho de Melo

From: Andi Kleen <ak@linux.intel.com>

Add a utility function to fetch executable code. Convert one
user over to it. There are more places doing that, but they
do significantly different actions, so they are not
easy to fit into a single library function.

Committer changes:

. No need to cast around, make 'buf' be a void pointer.

. Rename it to thread__memcpy() to reflect the fact it is about copying
  a chunk of memory from a thread, i.e. from its address space.

. No need to have it in a separate object file, move it to thread.[ch]

. Check the return of map__load(), the original code didn't do it, but
  since we're moving this around, check that as well.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lkml.kernel.org/r/20190305144758.12397-2-andi@firstfloor.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/intel-bts.c | 20 ++------------------
 tools/perf/util/thread.c    | 23 +++++++++++++++++++++++
 tools/perf/util/thread.h    |  3 +++
 3 files changed, 28 insertions(+), 18 deletions(-)

diff --git a/tools/perf/util/intel-bts.c b/tools/perf/util/intel-bts.c
index 0c0180c67574..47025bc727e1 100644
--- a/tools/perf/util/intel-bts.c
+++ b/tools/perf/util/intel-bts.c
@@ -328,35 +328,19 @@ static int intel_bts_get_next_insn(struct intel_bts_queue *btsq, u64 ip)
 {
 	struct machine *machine = btsq->bts->machine;
 	struct thread *thread;
-	struct addr_location al;
 	unsigned char buf[INTEL_PT_INSN_BUF_SZ];
 	ssize_t len;
-	int x86_64;
-	uint8_t cpumode;
+	bool x86_64;
 	int err = -1;
 
-	if (machine__kernel_ip(machine, ip))
-		cpumode = PERF_RECORD_MISC_KERNEL;
-	else
-		cpumode = PERF_RECORD_MISC_USER;
-
 	thread = machine__find_thread(machine, -1, btsq->tid);
 	if (!thread)
 		return -1;
 
-	if (!thread__find_map(thread, cpumode, ip, &al) || !al.map->dso)
-		goto out_put;
-
-	len = dso__data_read_addr(al.map->dso, al.map, machine, ip, buf,
-				  INTEL_PT_INSN_BUF_SZ);
+	len = thread__memcpy(thread, machine, buf, ip, INTEL_PT_INSN_BUF_SZ, &x86_64);
 	if (len <= 0)
 		goto out_put;
 
-	/* Load maps to ensure dso->is_64_bit has been updated */
-	map__load(al.map);
-
-	x86_64 = al.map->dso->is_64_bit;
-
 	if (intel_pt_get_insn(buf, len, x86_64, &btsq->intel_pt_insn))
 		goto out_put;
 
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
index 4c179fef442d..50678d318185 100644
--- a/tools/perf/util/thread.c
+++ b/tools/perf/util/thread.c
@@ -12,6 +12,7 @@
 #include "debug.h"
 #include "namespaces.h"
 #include "comm.h"
+#include "map.h"
 #include "symbol.h"
 #include "unwind.h"
 
@@ -393,3 +394,25 @@ struct thread *thread__main_thread(struct machine *machine, struct thread *threa
 
 	return machine__find_thread(machine, thread->pid_, thread->pid_);
 }
+
+int thread__memcpy(struct thread *thread, struct machine *machine,
+		   void *buf, u64 ip, int len, bool *is64bit)
+{
+       u8 cpumode = PERF_RECORD_MISC_USER;
+       struct addr_location al;
+       long offset;
+
+       if (machine__kernel_ip(machine, ip))
+               cpumode = PERF_RECORD_MISC_KERNEL;
+
+       if (!thread__find_map(thread, cpumode, ip, &al) || !al.map->dso ||
+	   al.map->dso->data.status == DSO_DATA_STATUS_ERROR ||
+	   map__load(al.map) < 0)
+               return -1;
+
+       offset = al.map->map_ip(al.map, ip);
+       if (is64bit)
+               *is64bit = al.map->dso->is_64_bit;
+
+       return dso__data_read_offset(al.map->dso, machine, offset, buf, len);
+}
diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h
index 8276ffeec556..cf8375c017a0 100644
--- a/tools/perf/util/thread.h
+++ b/tools/perf/util/thread.h
@@ -113,6 +113,9 @@ struct symbol *thread__find_symbol_fb(struct thread *thread, u8 cpumode,
 void thread__find_cpumode_addr_location(struct thread *thread, u64 addr,
 					struct addr_location *al);
 
+int thread__memcpy(struct thread *thread, struct machine *machine,
+		   void *buf, u64 ip, int len, bool *is64bit);
+
 static inline void *thread__priv(struct thread *thread)
 {
 	return thread->priv;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 50+ messages in thread

* [PATCH 21/35] perf diff: Support --time filter option
  2019-03-07 17:43 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (19 preceding siblings ...)
  2019-03-07 17:44 ` [PATCH 20/35] perf thread: Generalize function to copy from thread addr space from intel-bts code Arnaldo Carvalho de Melo
@ 2019-03-07 17:44 ` Arnaldo Carvalho de Melo
  2019-03-07 17:44 ` [PATCH 22/35] perf diff: Support --cpu " Arnaldo Carvalho de Melo
                   ` (14 subsequent siblings)
  35 siblings, 0 replies; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-03-07 17:44 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel,
	linux-perf-users, Jin Yao, Alexander Shishkin, Andi Kleen,
	Jin Yao, Kan Liang, Peter Zijlstra, Arnaldo Carvalho de Melo

From: Jin Yao <yao.jin@linux.intel.com>

To improve 'perf diff', implement a --time filter option to diff the
samples within given time window.

It supports time percent with multiple time ranges. The time string
format is 'a%/n,b%/m,...' or 'a%-b%,c%-%d,...'.

For example:

Select the second 10% time slice to diff:

  perf diff --time 10%/2

Select from 0% to 10% time slice to diff:

  perf diff --time 0%-10%

Select the first and the second 10% time slices to diff:

  perf diff --time 10%/1,10%/2

Select from 0% to 10% and 30% to 40% slices to diff:

  perf diff --time 0%-10%,30%-40%

It also supports analysing samples within a given time window
<start>,<stop>.

Times have the format seconds.microseconds.

If 'start' is not given (i.e., time string is ',x.y') then analysis starts at
the beginning of the file.

If the stop time is not given (i.e, time string is 'x.y,') then analysis
goes to end of file.

Time string is 'a1.b1,c1.d1:a2.b2,c2.d2'. Use ':' to separate timestamps for
different perf.data files.

For example, we get the timestamp information from perf script.

  perf script -i perf.data.old

    mgen 13940 [000]  3946.361400: ...

  perf script -i perf.data

    mgen 13940 [000]  3971.150589 ...

  perf diff --time 3946.361400,:3971.150589,

It analyzes the perf.data.old from the timestamp 3946.361400 to the end of
perf.data.old and analyzes the perf.data from the timestamp 3971.150589 to the
end of perf.data.

 v4:
 ---
 Update abstime_str_dup(), let it return error if strdup
 is failed, and update __cmd_diff() accordingly.

Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jin Yao <yao.jin@intel.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1551791143-10334-2-git-send-email-yao.jin@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-diff.txt |  45 ++++++++
 tools/perf/builtin-diff.c              | 148 ++++++++++++++++++++++---
 2 files changed, 179 insertions(+), 14 deletions(-)

diff --git a/tools/perf/Documentation/perf-diff.txt b/tools/perf/Documentation/perf-diff.txt
index a79c84ae61aa..036d65bded51 100644
--- a/tools/perf/Documentation/perf-diff.txt
+++ b/tools/perf/Documentation/perf-diff.txt
@@ -118,6 +118,51 @@ OPTIONS
 	sum of shown entries will be always 100%.  "absolute" means it retains
 	the original value before and after the filter is applied.
 
+--time::
+	Analyze samples within given time window. It supports time
+	percent with multiple time ranges. Time string is 'a%/n,b%/m,...'
+	or 'a%-b%,c%-%d,...'.
+
+	For example:
+
+	Select the second 10% time slice to diff:
+
+	  perf diff --time 10%/2
+
+	Select from 0% to 10% time slice to diff:
+
+	  perf diff --time 0%-10%
+
+	Select the first and the second 10% time slices to diff:
+
+	  perf diff --time 10%/1,10%/2
+
+	Select from 0% to 10% and 30% to 40% slices to diff:
+
+	  perf diff --time 0%-10%,30%-40%
+
+	It also supports analyzing samples within a given time window
+	<start>,<stop>. Times have the format seconds.microseconds. If 'start'
+	is not given (i.e., time string is ',x.y') then analysis starts at
+	the beginning of the file. If stop time is not given (i.e, time
+	string is 'x.y,') then analysis goes to the end of the file. Time string is
+	'a1.b1,c1.d1:a2.b2,c2.d2'. Use ':' to separate timestamps for different
+	perf.data files.
+
+	For example, we get the timestamp information from 'perf script'.
+
+	  perf script -i perf.data.old
+	    mgen 13940 [000]  3946.361400: ...
+
+	  perf script -i perf.data
+	    mgen 13940 [000]  3971.150589 ...
+
+	  perf diff --time 3946.361400,:3971.150589,
+
+	It analyzes the perf.data.old from the timestamp 3946.361400 to
+	the end of perf.data.old and analyzes the perf.data from the
+	timestamp 3971.150589 to the end of perf.data.
+
 COMPARISON
 ----------
 The comparison is governed by the baseline file. The baseline perf.data
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 58fe0e88215c..17cd898074c8 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -19,12 +19,21 @@
 #include "util/util.h"
 #include "util/data.h"
 #include "util/config.h"
+#include "util/time-utils.h"
 
 #include <errno.h>
 #include <inttypes.h>
 #include <stdlib.h>
 #include <math.h>
 
+struct perf_diff {
+	struct perf_tool		 tool;
+	const char			*time_str;
+	struct perf_time_interval	*ptime_range;
+	int				 range_size;
+	int				 range_num;
+};
+
 /* Diff command specific HPP columns. */
 enum {
 	PERF_HPP_DIFF__BASELINE,
@@ -323,16 +332,22 @@ static int formula_fprintf(struct hist_entry *he, struct hist_entry *pair,
 	return -1;
 }
 
-static int diff__process_sample_event(struct perf_tool *tool __maybe_unused,
+static int diff__process_sample_event(struct perf_tool *tool,
 				      union perf_event *event,
 				      struct perf_sample *sample,
 				      struct perf_evsel *evsel,
 				      struct machine *machine)
 {
+	struct perf_diff *pdiff = container_of(tool, struct perf_diff, tool);
 	struct addr_location al;
 	struct hists *hists = evsel__hists(evsel);
 	int ret = -1;
 
+	if (perf_time__ranges_skip_sample(pdiff->ptime_range, pdiff->range_num,
+					  sample->time)) {
+		return 0;
+	}
+
 	if (machine__resolve(machine, &al, sample) < 0) {
 		pr_warning("problem processing %d event, skipping it.\n",
 			   event->header.type);
@@ -359,17 +374,19 @@ static int diff__process_sample_event(struct perf_tool *tool __maybe_unused,
 	return ret;
 }
 
-static struct perf_tool tool = {
-	.sample	= diff__process_sample_event,
-	.mmap	= perf_event__process_mmap,
-	.mmap2	= perf_event__process_mmap2,
-	.comm	= perf_event__process_comm,
-	.exit	= perf_event__process_exit,
-	.fork	= perf_event__process_fork,
-	.lost	= perf_event__process_lost,
-	.namespaces = perf_event__process_namespaces,
-	.ordered_events = true,
-	.ordering_requires_timestamps = true,
+static struct perf_diff pdiff = {
+	.tool = {
+		.sample	= diff__process_sample_event,
+		.mmap	= perf_event__process_mmap,
+		.mmap2	= perf_event__process_mmap2,
+		.comm	= perf_event__process_comm,
+		.exit	= perf_event__process_exit,
+		.fork	= perf_event__process_fork,
+		.lost	= perf_event__process_lost,
+		.namespaces = perf_event__process_namespaces,
+		.ordered_events = true,
+		.ordering_requires_timestamps = true,
+	},
 };
 
 static struct perf_evsel *evsel_match(struct perf_evsel *evsel,
@@ -771,19 +788,110 @@ static void data__free(struct data__file *d)
 	}
 }
 
+static int abstime_str_dup(char **pstr)
+{
+	char *str = NULL;
+
+	if (pdiff.time_str && strchr(pdiff.time_str, ':')) {
+		str = strdup(pdiff.time_str);
+		if (!str)
+			return -ENOMEM;
+	}
+
+	*pstr = str;
+	return 0;
+}
+
+static int parse_absolute_time(struct data__file *d, char **pstr)
+{
+	char *p = *pstr;
+	int ret;
+
+	/*
+	 * Absolute timestamp for one file has the format: a.b,c.d
+	 * For multiple files, the format is: a.b,c.d:a.b,c.d
+	 */
+	p = strchr(*pstr, ':');
+	if (p) {
+		if (p == *pstr) {
+			pr_err("Invalid time string\n");
+			return -EINVAL;
+		}
+
+		*p = 0;
+		p++;
+		if (*p == 0) {
+			pr_err("Invalid time string\n");
+			return -EINVAL;
+		}
+	}
+
+	ret = perf_time__parse_for_ranges(*pstr, d->session,
+					  &pdiff.ptime_range,
+					  &pdiff.range_size,
+					  &pdiff.range_num);
+	if (ret < 0)
+		return ret;
+
+	if (!p || *p == 0)
+		*pstr = NULL;
+	else
+		*pstr = p;
+
+	return ret;
+}
+
+static int parse_percent_time(struct data__file *d)
+{
+	int ret;
+
+	ret = perf_time__parse_for_ranges(pdiff.time_str, d->session,
+					  &pdiff.ptime_range,
+					  &pdiff.range_size,
+					  &pdiff.range_num);
+	return ret;
+}
+
+static int parse_time_str(struct data__file *d, char *abstime_ostr,
+			   char **pabstime_tmp)
+{
+	int ret = 0;
+
+	if (abstime_ostr)
+		ret = parse_absolute_time(d, pabstime_tmp);
+	else if (pdiff.time_str)
+		ret = parse_percent_time(d);
+
+	return ret;
+}
+
 static int __cmd_diff(void)
 {
 	struct data__file *d;
-	int ret = -EINVAL, i;
+	int ret, i;
+	char *abstime_ostr, *abstime_tmp;
+
+	ret = abstime_str_dup(&abstime_ostr);
+	if (ret)
+		return ret;
+
+	abstime_tmp = abstime_ostr;
+	ret = -EINVAL;
 
 	data__for_each_file(i, d) {
-		d->session = perf_session__new(&d->data, false, &tool);
+		d->session = perf_session__new(&d->data, false, &pdiff.tool);
 		if (!d->session) {
 			pr_err("Failed to open %s\n", d->data.path);
 			ret = -1;
 			goto out_delete;
 		}
 
+		if (pdiff.time_str) {
+			ret = parse_time_str(d, abstime_ostr, &abstime_tmp);
+			if (ret < 0)
+				goto out_delete;
+		}
+
 		ret = perf_session__process_events(d->session);
 		if (ret) {
 			pr_err("Failed to process %s\n", d->data.path);
@@ -791,6 +899,9 @@ static int __cmd_diff(void)
 		}
 
 		perf_evlist__collapse_resort(d->session->evlist);
+
+		if (pdiff.ptime_range)
+			zfree(&pdiff.ptime_range);
 	}
 
 	data_process();
@@ -802,6 +913,13 @@ static int __cmd_diff(void)
 	}
 
 	free(data__files);
+
+	if (pdiff.ptime_range)
+		zfree(&pdiff.ptime_range);
+
+	if (abstime_ostr)
+		free(abstime_ostr);
+
 	return ret;
 }
 
@@ -849,6 +967,8 @@ static const struct option options[] = {
 	OPT_UINTEGER('o', "order", &sort_compute, "Specify compute sorting."),
 	OPT_CALLBACK(0, "percentage", NULL, "relative|absolute",
 		     "How to display percentage of filtered entries", parse_filter_percentage),
+	OPT_STRING(0, "time", &pdiff.time_str, "str",
+		   "Time span (time percent or absolute timestamp)"),
 	OPT_END()
 };
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 50+ messages in thread

* [PATCH 22/35] perf diff: Support --cpu filter option
  2019-03-07 17:43 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (20 preceding siblings ...)
  2019-03-07 17:44 ` [PATCH 21/35] perf diff: Support --time filter option Arnaldo Carvalho de Melo
@ 2019-03-07 17:44 ` Arnaldo Carvalho de Melo
  2019-03-07 17:44 ` [PATCH 23/35] perf diff: Support --pid/--tid filter options Arnaldo Carvalho de Melo
                   ` (13 subsequent siblings)
  35 siblings, 0 replies; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-03-07 17:44 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel,
	linux-perf-users, Jin Yao, Alexander Shishkin, Andi Kleen,
	Jin Yao, Kan Liang, Peter Zijlstra, Arnaldo Carvalho de Melo

From: Jin Yao <yao.jin@linux.intel.com>

To improve 'perf diff', implement a --cpu filter option.

Multiple CPUs can be provided as a comma-separated list with no space:
0,1.  Ranges of CPUs are specified with -: 0-2. Default is to report
samples on all CPUs.

For example,

  perf diff --cpu 0,1

It only diff the samples for CPU0 and CPU1.

Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jin Yao <yao.jin@intel.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1551791143-10334-3-git-send-email-yao.jin@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-diff.txt |  5 +++++
 tools/perf/builtin-diff.c              | 16 ++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/tools/perf/Documentation/perf-diff.txt b/tools/perf/Documentation/perf-diff.txt
index 036d65bded51..8c2c229faf50 100644
--- a/tools/perf/Documentation/perf-diff.txt
+++ b/tools/perf/Documentation/perf-diff.txt
@@ -163,6 +163,11 @@ OPTIONS
 	the end of perf.data.old and analyzes the perf.data from the
 	timestamp 3971.150589 to the end of perf.data.
 
+--cpu:: Only diff samples for the list of CPUs provided. Multiple CPUs can
+	be provided as a comma-separated list with no space: 0,1. Ranges of
+	CPUs are specified with -: 0-2. Default is to report samples on all
+	CPUs.
+
 COMPARISON
 ----------
 The comparison is governed by the baseline file. The baseline perf.data
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 17cd898074c8..dfe6c7606f5a 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -83,6 +83,9 @@ static unsigned int sort_compute = 1;
 static s64 compute_wdiff_w1;
 static s64 compute_wdiff_w2;
 
+static const char		*cpu_list;
+static DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS);
+
 enum {
 	COMPUTE_DELTA,
 	COMPUTE_RATIO,
@@ -354,6 +357,11 @@ static int diff__process_sample_event(struct perf_tool *tool,
 		return -1;
 	}
 
+	if (cpu_list && !test_bit(sample->cpu, cpu_bitmap)) {
+		ret = 0;
+		goto out_put;
+	}
+
 	if (!hists__add_entry(hists, &al, NULL, NULL, NULL, sample, true)) {
 		pr_warning("problem incrementing symbol period, skipping event\n");
 		goto out_put;
@@ -892,6 +900,13 @@ static int __cmd_diff(void)
 				goto out_delete;
 		}
 
+		if (cpu_list) {
+			ret = perf_session__cpu_bitmap(d->session, cpu_list,
+						       cpu_bitmap);
+			if (ret < 0)
+				goto out_delete;
+		}
+
 		ret = perf_session__process_events(d->session);
 		if (ret) {
 			pr_err("Failed to process %s\n", d->data.path);
@@ -969,6 +984,7 @@ static const struct option options[] = {
 		     "How to display percentage of filtered entries", parse_filter_percentage),
 	OPT_STRING(0, "time", &pdiff.time_str, "str",
 		   "Time span (time percent or absolute timestamp)"),
+	OPT_STRING(0, "cpu", &cpu_list, "cpu", "list of cpus to profile"),
 	OPT_END()
 };
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 50+ messages in thread

* [PATCH 23/35] perf diff: Support --pid/--tid filter options
  2019-03-07 17:43 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (21 preceding siblings ...)
  2019-03-07 17:44 ` [PATCH 22/35] perf diff: Support --cpu " Arnaldo Carvalho de Melo
@ 2019-03-07 17:44 ` Arnaldo Carvalho de Melo
  2019-03-07 17:44 ` [PATCH 24/35] perf script python: Remove mixed indentation Arnaldo Carvalho de Melo
                   ` (12 subsequent siblings)
  35 siblings, 0 replies; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-03-07 17:44 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel,
	linux-perf-users, Jin Yao, Alexander Shishkin, Andi Kleen,
	Jin Yao, Kan Liang, Peter Zijlstra, Arnaldo Carvalho de Melo

From: Jin Yao <yao.jin@linux.intel.com>

Using the existing symbol_conf.pid_list_str and symbol_conf.tid_list_str
logic.

For example:

  perf diff --tid 13965

It'll only diff the samples for thread 13965.

Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jin Yao <yao.jin@intel.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1551791143-10334-4-git-send-email-yao.jin@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-diff.txt | 6 ++++++
 tools/perf/builtin-diff.c              | 4 ++++
 2 files changed, 10 insertions(+)

diff --git a/tools/perf/Documentation/perf-diff.txt b/tools/perf/Documentation/perf-diff.txt
index 8c2c229faf50..da7809b15cc9 100644
--- a/tools/perf/Documentation/perf-diff.txt
+++ b/tools/perf/Documentation/perf-diff.txt
@@ -168,6 +168,12 @@ OPTIONS
 	CPUs are specified with -: 0-2. Default is to report samples on all
 	CPUs.
 
+--pid=::
+	Only diff samples for given process ID (comma separated list).
+
+--tid=::
+	Only diff samples for given thread ID (comma separated list).
+
 COMPARISON
 ----------
 The comparison is governed by the baseline file. The baseline perf.data
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index dfe6c7606f5a..6e7920793729 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -985,6 +985,10 @@ static const struct option options[] = {
 	OPT_STRING(0, "time", &pdiff.time_str, "str",
 		   "Time span (time percent or absolute timestamp)"),
 	OPT_STRING(0, "cpu", &cpu_list, "cpu", "list of cpus to profile"),
+	OPT_STRING(0, "pid", &symbol_conf.pid_list_str, "pid[,pid...]",
+		   "only consider symbols in these pids"),
+	OPT_STRING(0, "tid", &symbol_conf.tid_list_str, "tid[,tid...]",
+		   "only consider symbols in these tids"),
 	OPT_END()
 };
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 50+ messages in thread

* [PATCH 24/35] perf script python: Remove mixed indentation
  2019-03-07 17:43 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (22 preceding siblings ...)
  2019-03-07 17:44 ` [PATCH 23/35] perf diff: Support --pid/--tid filter options Arnaldo Carvalho de Melo
@ 2019-03-07 17:44 ` Arnaldo Carvalho de Melo
  2019-03-07 17:44 ` [PATCH 25/35] perf script python: Add Python3 support to futex-contention.py Arnaldo Carvalho de Melo
                   ` (11 subsequent siblings)
  35 siblings, 0 replies; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-03-07 17:44 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel,
	linux-perf-users, Tony Jones, Arnaldo Carvalho de Melo

From: Tony Jones <tonyj@suse.de>

Remove mixed indentation in Python scripts.  Revert to either all tabs
(most common form) or all spaces (4 or 8) depending on what was the
intent of the original commit.  This is necessary to complete Python3
support as it will flag an error if it encounters mixed indentation.

Signed-off-by: Tony Jones <tonyj@suse.de>
Link: http://lkml.kernel.org/r/20190302011903.2416-2-tonyj@suse.de
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/scripts/python/check-perf-trace.py | 65 +++++++++----------
 tools/perf/scripts/python/compaction-times.py |  8 +--
 .../scripts/python/event_analyzing_sample.py  |  6 +-
 .../scripts/python/failed-syscalls-by-pid.py  | 38 +++++------
 tools/perf/scripts/python/futex-contention.py |  2 +-
 tools/perf/scripts/python/intel-pt-events.py  | 32 ++++-----
 tools/perf/scripts/python/mem-phys-addr.py    |  7 +-
 tools/perf/scripts/python/net_dropmonitor.py  |  2 +-
 tools/perf/scripts/python/netdev-times.py     | 12 ++--
 tools/perf/scripts/python/sched-migration.py  |  6 +-
 tools/perf/scripts/python/sctop.py            | 13 ++--
 tools/perf/scripts/python/stackcollapse.py    |  2 +-
 .../scripts/python/syscall-counts-by-pid.py   | 47 +++++++-------
 tools/perf/scripts/python/syscall-counts.py   | 31 +++++----
 14 files changed, 136 insertions(+), 135 deletions(-)

diff --git a/tools/perf/scripts/python/check-perf-trace.py b/tools/perf/scripts/python/check-perf-trace.py
index 334599c6032c..f4838db3e518 100644
--- a/tools/perf/scripts/python/check-perf-trace.py
+++ b/tools/perf/scripts/python/check-perf-trace.py
@@ -23,60 +23,59 @@ def trace_begin():
 	pass
 
 def trace_end():
-        print_unhandled()
+	print_unhandled()
 
 def irq__softirq_entry(event_name, context, common_cpu,
-	common_secs, common_nsecs, common_pid, common_comm,
-	common_callchain, vec):
-		print_header(event_name, common_cpu, common_secs, common_nsecs,
-			common_pid, common_comm)
+		       common_secs, common_nsecs, common_pid, common_comm,
+		       common_callchain, vec):
+	print_header(event_name, common_cpu, common_secs, common_nsecs,
+		common_pid, common_comm)
 
-                print_uncommon(context)
+	print_uncommon(context)
 
-		print "vec=%s\n" % \
-		(symbol_str("irq__softirq_entry", "vec", vec)),
+	print "vec=%s\n" % (symbol_str("irq__softirq_entry", "vec", vec)),
 
 def kmem__kmalloc(event_name, context, common_cpu,
-	common_secs, common_nsecs, common_pid, common_comm,
-	common_callchain, call_site, ptr, bytes_req, bytes_alloc,
-	gfp_flags):
-		print_header(event_name, common_cpu, common_secs, common_nsecs,
-			common_pid, common_comm)
+		  common_secs, common_nsecs, common_pid, common_comm,
+		  common_callchain, call_site, ptr, bytes_req, bytes_alloc,
+		  gfp_flags):
+	print_header(event_name, common_cpu, common_secs, common_nsecs,
+		common_pid, common_comm)
 
-                print_uncommon(context)
+	print_uncommon(context)
 
-		print "call_site=%u, ptr=%u, bytes_req=%u, " \
+	print "call_site=%u, ptr=%u, bytes_req=%u, " \
 		"bytes_alloc=%u, gfp_flags=%s\n" % \
 		(call_site, ptr, bytes_req, bytes_alloc,
-
 		flag_str("kmem__kmalloc", "gfp_flags", gfp_flags)),
 
 def trace_unhandled(event_name, context, event_fields_dict):
-    try:
-        unhandled[event_name] += 1
-    except TypeError:
-        unhandled[event_name] = 1
+	try:
+		unhandled[event_name] += 1
+	except TypeError:
+		unhandled[event_name] = 1
 
 def print_header(event_name, cpu, secs, nsecs, pid, comm):
 	print "%-20s %5u %05u.%09u %8u %-20s " % \
-	(event_name, cpu, secs, nsecs, pid, comm),
+		(event_name, cpu, secs, nsecs, pid, comm),
 
 # print trace fields not included in handler args
 def print_uncommon(context):
-    print "common_preempt_count=%d, common_flags=%s, common_lock_depth=%d, " \
-        % (common_pc(context), trace_flag_str(common_flags(context)), \
-               common_lock_depth(context))
+	print "common_preempt_count=%d, common_flags=%s, " \
+		"common_lock_depth=%d, " % \
+		(common_pc(context), trace_flag_str(common_flags(context)),
+		common_lock_depth(context))
 
 def print_unhandled():
-    keys = unhandled.keys()
-    if not keys:
-        return
+	keys = unhandled.keys()
+	if not keys:
+		return
 
-    print "\nunhandled events:\n\n",
+	print "\nunhandled events:\n\n",
 
-    print "%-40s  %10s\n" % ("event", "count"),
-    print "%-40s  %10s\n" % ("----------------------------------------", \
-                                 "-----------"),
+	print "%-40s  %10s\n" % ("event", "count"),
+	print "%-40s  %10s\n" % ("----------------------------------------", \
+				"-----------"),
 
-    for event_name in keys:
-	print "%-40s  %10d\n" % (event_name, unhandled[event_name])
+	for event_name in keys:
+		print "%-40s  %10d\n" % (event_name, unhandled[event_name])
diff --git a/tools/perf/scripts/python/compaction-times.py b/tools/perf/scripts/python/compaction-times.py
index 239cb0568ec3..2560a042dc6f 100644
--- a/tools/perf/scripts/python/compaction-times.py
+++ b/tools/perf/scripts/python/compaction-times.py
@@ -216,15 +216,15 @@ def compaction__mm_compaction_migratepages(event_name, context, common_cpu,
 		pair(nr_migrated, nr_failed), None, None)
 
 def compaction__mm_compaction_isolate_freepages(event_name, context, common_cpu,
-        common_secs, common_nsecs, common_pid, common_comm,
-        common_callchain, start_pfn, end_pfn, nr_scanned, nr_taken):
+	common_secs, common_nsecs, common_pid, common_comm,
+	common_callchain, start_pfn, end_pfn, nr_scanned, nr_taken):
 
 	chead.increment_pending(common_pid,
 		None, pair(nr_scanned, nr_taken), None)
 
 def compaction__mm_compaction_isolate_migratepages(event_name, context, common_cpu,
-        common_secs, common_nsecs, common_pid, common_comm,
-        common_callchain, start_pfn, end_pfn, nr_scanned, nr_taken):
+	common_secs, common_nsecs, common_pid, common_comm,
+	common_callchain, start_pfn, end_pfn, nr_scanned, nr_taken):
 
 	chead.increment_pending(common_pid,
 		None, None, pair(nr_scanned, nr_taken))
diff --git a/tools/perf/scripts/python/event_analyzing_sample.py b/tools/perf/scripts/python/event_analyzing_sample.py
index 4e843b9864ec..2ec8915b74c5 100644
--- a/tools/perf/scripts/python/event_analyzing_sample.py
+++ b/tools/perf/scripts/python/event_analyzing_sample.py
@@ -37,7 +37,7 @@ con = sqlite3.connect("/dev/shm/perf.db")
 con.isolation_level = None
 
 def trace_begin():
-	print "In trace_begin:\n"
+        print "In trace_begin:\n"
 
         #
         # Will create several tables at the start, pebs_ll is for PEBS data with
@@ -102,7 +102,7 @@ def insert_db(event):
                                 event.ip, event.status, event.dse, event.dla, event.lat))
 
 def trace_end():
-	print "In trace_end:\n"
+        print "In trace_end:\n"
         # We show the basic info for the 2 type of event classes
         show_general_events()
         show_pebs_ll()
@@ -187,4 +187,4 @@ def show_pebs_ll():
              print "%32s %8d     %s" % (row[0], row[1], num2sym(row[1]))
 
 def trace_unhandled(event_name, context, event_fields_dict):
-		print ' '.join(['%s=%s'%(k,str(v))for k,v in sorted(event_fields_dict.items())])
+        print ' '.join(['%s=%s'%(k,str(v))for k,v in sorted(event_fields_dict.items())])
diff --git a/tools/perf/scripts/python/failed-syscalls-by-pid.py b/tools/perf/scripts/python/failed-syscalls-by-pid.py
index 3648e8b986ec..310efe5e7e23 100644
--- a/tools/perf/scripts/python/failed-syscalls-by-pid.py
+++ b/tools/perf/scripts/python/failed-syscalls-by-pid.py
@@ -58,22 +58,22 @@ def syscalls__sys_exit(event_name, context, common_cpu,
 	raw_syscalls__sys_exit(**locals())
 
 def print_error_totals():
-    if for_comm is not None:
-	    print("\nsyscall errors for %s:\n" % (for_comm))
-    else:
-	    print("\nsyscall errors:\n")
-
-    print("%-30s  %10s" % ("comm [pid]", "count"))
-    print("%-30s  %10s" % ("------------------------------", "----------"))
-
-    comm_keys = syscalls.keys()
-    for comm in comm_keys:
-	    pid_keys = syscalls[comm].keys()
-	    for pid in pid_keys:
-		    print("\n%s [%d]" % (comm, pid))
-		    id_keys = syscalls[comm][pid].keys()
-		    for id in id_keys:
-			    print("  syscall: %-16s" % syscall_name(id))
-			    ret_keys = syscalls[comm][pid][id].keys()
-			    for ret, val in sorted(syscalls[comm][pid][id].items(), key = lambda kv: (kv[1], kv[0]),  reverse = True):
-				    print("    err = %-20s  %10d" % (strerror(ret), val))
+	if for_comm is not None:
+		print("\nsyscall errors for %s:\n" % (for_comm))
+	else:
+		print("\nsyscall errors:\n")
+
+	print("%-30s  %10s" % ("comm [pid]", "count"))
+	print("%-30s  %10s" % ("------------------------------", "----------"))
+
+	comm_keys = syscalls.keys()
+	for comm in comm_keys:
+		pid_keys = syscalls[comm].keys()
+		for pid in pid_keys:
+			print("\n%s [%d]" % (comm, pid))
+			id_keys = syscalls[comm][pid].keys()
+			for id in id_keys:
+				print("  syscall: %-16s" % syscall_name(id))
+				ret_keys = syscalls[comm][pid][id].keys()
+				for ret, val in sorted(syscalls[comm][pid][id].items(), key = lambda kv: (kv[1], kv[0]), reverse = True):
+					print("    err = %-20s  %10d" % (strerror(ret), val))
diff --git a/tools/perf/scripts/python/futex-contention.py b/tools/perf/scripts/python/futex-contention.py
index 0f5cf437b602..f221c62e0a10 100644
--- a/tools/perf/scripts/python/futex-contention.py
+++ b/tools/perf/scripts/python/futex-contention.py
@@ -46,5 +46,5 @@ def trace_end():
 	for (tid, lock) in lock_waits:
 		min, max, avg, count = lock_waits[tid, lock]
 		print "%s[%d] lock %x contended %d times, %d avg ns" % \
-		      (process_names[tid], tid, lock, count, avg)
+			(process_names[tid], tid, lock, count, avg)
 
diff --git a/tools/perf/scripts/python/intel-pt-events.py b/tools/perf/scripts/python/intel-pt-events.py
index b19172d673af..2177722f509e 100644
--- a/tools/perf/scripts/python/intel-pt-events.py
+++ b/tools/perf/scripts/python/intel-pt-events.py
@@ -85,22 +85,22 @@ def print_common_ip(sample, symbol, dso):
 	print "%16x %s (%s)" % (ip, symbol, dso)
 
 def process_event(param_dict):
-        event_attr = param_dict["attr"]
-        sample     = param_dict["sample"]
-        raw_buf    = param_dict["raw_buf"]
-        comm       = param_dict["comm"]
-        name       = param_dict["ev_name"]
-
-        # Symbol and dso info are not always resolved
-        if (param_dict.has_key("dso")):
-                dso = param_dict["dso"]
-        else:
-                dso = "[unknown]"
-
-        if (param_dict.has_key("symbol")):
-                symbol = param_dict["symbol"]
-        else:
-                symbol = "[unknown]"
+	event_attr = param_dict["attr"]
+	sample	 = param_dict["sample"]
+	raw_buf	= param_dict["raw_buf"]
+	comm	   = param_dict["comm"]
+	name	   = param_dict["ev_name"]
+
+	# Symbol and dso info are not always resolved
+	if (param_dict.has_key("dso")):
+		dso = param_dict["dso"]
+	else:
+		dso = "[unknown]"
+
+	if (param_dict.has_key("symbol")):
+		symbol = param_dict["symbol"]
+	else:
+		symbol = "[unknown]"
 
 	if name == "ptwrite":
 		print_common_start(comm, sample, name)
diff --git a/tools/perf/scripts/python/mem-phys-addr.py b/tools/perf/scripts/python/mem-phys-addr.py
index fb0bbcbfa0f0..1f332e72b9b0 100644
--- a/tools/perf/scripts/python/mem-phys-addr.py
+++ b/tools/perf/scripts/python/mem-phys-addr.py
@@ -44,12 +44,13 @@ def print_memory_type():
 	print("%-40s  %10s  %10s\n" % ("Memory type", "count", "percentage"), end='')
 	print("%-40s  %10s  %10s\n" % ("----------------------------------------",
 					"-----------", "-----------"),
-                                        end='');
+					end='');
 	total = sum(load_mem_type_cnt.values())
 	for mem_type, count in sorted(load_mem_type_cnt.most_common(), \
 					key = lambda kv: (kv[1], kv[0]), reverse = True):
-		print("%-40s  %10d  %10.1f%%\n" % (mem_type, count, 100 * count / total),
-                        end='')
+		print("%-40s  %10d  %10.1f%%\n" %
+			(mem_type, count, 100 * count / total),
+			end='')
 
 def trace_begin():
 	parse_iomem()
diff --git a/tools/perf/scripts/python/net_dropmonitor.py b/tools/perf/scripts/python/net_dropmonitor.py
index 212557a02c50..101059971738 100755
--- a/tools/perf/scripts/python/net_dropmonitor.py
+++ b/tools/perf/scripts/python/net_dropmonitor.py
@@ -7,7 +7,7 @@ import os
 import sys
 
 sys.path.append(os.environ['PERF_EXEC_PATH'] + \
-		'/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
+	'/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
 
 from perf_trace_context import *
 from Core import *
diff --git a/tools/perf/scripts/python/netdev-times.py b/tools/perf/scripts/python/netdev-times.py
index 267bda49325d..ea0c8b90a783 100644
--- a/tools/perf/scripts/python/netdev-times.py
+++ b/tools/perf/scripts/python/netdev-times.py
@@ -124,14 +124,16 @@ def print_receive(hunk):
 		event = event_list[i]
 		if event['event_name'] == 'napi_poll':
 			print(PF_NAPI_POLL %
-			    (diff_msec(base_t, event['event_t']), event['dev']))
+				(diff_msec(base_t, event['event_t']),
+				event['dev']))
 			if i == len(event_list) - 1:
 				print("")
 			else:
 				print(PF_JOINT)
 		else:
 			print(PF_NET_RECV %
-			    (diff_msec(base_t, event['event_t']), event['skbaddr'],
+				(diff_msec(base_t, event['event_t']),
+				event['skbaddr'],
 				event['len']))
 			if 'comm' in event.keys():
 				print(PF_WJOINT)
@@ -256,7 +258,7 @@ def irq__irq_handler_exit(name, context, cpu, sec, nsec, pid, comm, callchain, i
 	all_event_list.append(event_info)
 
 def napi__napi_poll(name, context, cpu, sec, nsec, pid, comm, callchain, napi,
-                    dev_name, work=None, budget=None):
+		dev_name, work=None, budget=None):
 	event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm,
 			napi, dev_name, work, budget)
 	all_event_list.append(event_info)
@@ -353,7 +355,7 @@ def handle_irq_softirq_exit(event_info):
 	if irq_list == [] or event_list == 0:
 		return
 	rec_data = {'sirq_ent_t':sirq_ent_t, 'sirq_ext_t':time,
-		    'irq_list':irq_list, 'event_list':event_list}
+			'irq_list':irq_list, 'event_list':event_list}
 	# merge information realted to a NET_RX softirq
 	receive_hunk_list.append(rec_data)
 
@@ -390,7 +392,7 @@ def handle_netif_receive_skb(event_info):
 		skbaddr, skblen, dev_name) = event_info
 	if cpu in net_rx_dic.keys():
 		rec_data = {'event_name':'netif_receive_skb',
-			    'event_t':time, 'skbaddr':skbaddr, 'len':skblen}
+				'event_t':time, 'skbaddr':skbaddr, 'len':skblen}
 		event_list = net_rx_dic[cpu]['event_list']
 		event_list.append(rec_data)
 		rx_skb_list.insert(0, rec_data)
diff --git a/tools/perf/scripts/python/sched-migration.py b/tools/perf/scripts/python/sched-migration.py
index 3984bf51f3c5..8196e3087c9e 100644
--- a/tools/perf/scripts/python/sched-migration.py
+++ b/tools/perf/scripts/python/sched-migration.py
@@ -14,10 +14,10 @@ import sys
 
 from collections import defaultdict
 try:
-    from UserList import UserList
+	from UserList import UserList
 except ImportError:
-    # Python 3: UserList moved to the collections package
-    from collections import UserList
+	# Python 3: UserList moved to the collections package
+	from collections import UserList
 
 sys.path.append(os.environ['PERF_EXEC_PATH'] + \
 	'/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
diff --git a/tools/perf/scripts/python/sctop.py b/tools/perf/scripts/python/sctop.py
index 987ffae7c8ca..6e0278dcb092 100644
--- a/tools/perf/scripts/python/sctop.py
+++ b/tools/perf/scripts/python/sctop.py
@@ -13,9 +13,9 @@ from __future__ import print_function
 import os, sys, time
 
 try:
-        import thread
+	import thread
 except ImportError:
-        import _thread as thread
+	import _thread as thread
 
 sys.path.append(os.environ['PERF_EXEC_PATH'] + \
 	'/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
@@ -75,11 +75,12 @@ def print_syscall_totals(interval):
 
 		print("%-40s  %10s" % ("event", "count"))
 		print("%-40s  %10s" %
-                        ("----------------------------------------",
-                        "----------"))
+			("----------------------------------------",
+			"----------"))
 
-		for id, val in sorted(syscalls.items(), key = lambda kv: (kv[1], kv[0]), \
-					      reverse = True):
+		for id, val in sorted(syscalls.items(),
+				key = lambda kv: (kv[1], kv[0]),
+				reverse = True):
 			try:
 				print("%-40s  %10d" % (syscall_name(id), val))
 			except TypeError:
diff --git a/tools/perf/scripts/python/stackcollapse.py b/tools/perf/scripts/python/stackcollapse.py
index 5e703efaddcc..b1c4def1410a 100755
--- a/tools/perf/scripts/python/stackcollapse.py
+++ b/tools/perf/scripts/python/stackcollapse.py
@@ -27,7 +27,7 @@ from collections import defaultdict
 from optparse import OptionParser, make_option
 
 sys.path.append(os.environ['PERF_EXEC_PATH'] + \
-                '/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
+    '/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
 
 from perf_trace_context import *
 from Core import *
diff --git a/tools/perf/scripts/python/syscall-counts-by-pid.py b/tools/perf/scripts/python/syscall-counts-by-pid.py
index 42782487b0e9..f254e40c6f0f 100644
--- a/tools/perf/scripts/python/syscall-counts-by-pid.py
+++ b/tools/perf/scripts/python/syscall-counts-by-pid.py
@@ -39,11 +39,10 @@ def trace_end():
 	print_syscall_totals()
 
 def raw_syscalls__sys_enter(event_name, context, common_cpu,
-	common_secs, common_nsecs, common_pid, common_comm,
-	common_callchain, id, args):
-
+		common_secs, common_nsecs, common_pid, common_comm,
+		common_callchain, id, args):
 	if (for_comm and common_comm != for_comm) or \
-	   (for_pid  and common_pid  != for_pid ):
+		(for_pid and common_pid != for_pid ):
 		return
 	try:
 		syscalls[common_comm][common_pid][id] += 1
@@ -51,26 +50,26 @@ def raw_syscalls__sys_enter(event_name, context, common_cpu,
 		syscalls[common_comm][common_pid][id] = 1
 
 def syscalls__sys_enter(event_name, context, common_cpu,
-	common_secs, common_nsecs, common_pid, common_comm,
-	id, args):
+		common_secs, common_nsecs, common_pid, common_comm,
+		id, args):
 	raw_syscalls__sys_enter(**locals())
 
 def print_syscall_totals():
-    if for_comm is not None:
-	    print("\nsyscall events for %s:\n" % (for_comm))
-    else:
-	    print("\nsyscall events by comm/pid:\n")
-
-    print("%-40s  %10s" % ("comm [pid]/syscalls", "count"))
-    print("%-40s  %10s" % ("----------------------------------------",
-                            "----------"))
-
-    comm_keys = syscalls.keys()
-    for comm in comm_keys:
-	    pid_keys = syscalls[comm].keys()
-	    for pid in pid_keys:
-		    print("\n%s [%d]" % (comm, pid))
-		    id_keys = syscalls[comm][pid].keys()
-		    for id, val in sorted(syscalls[comm][pid].items(), \
-				  key = lambda kv: (kv[1], kv[0]),  reverse = True):
-			    print("  %-38s  %10d" % (syscall_name(id), val))
+	if for_comm is not None:
+		print("\nsyscall events for %s:\n" % (for_comm))
+	else:
+		print("\nsyscall events by comm/pid:\n")
+
+	print("%-40s  %10s" % ("comm [pid]/syscalls", "count"))
+	print("%-40s  %10s" % ("----------------------------------------",
+				"----------"))
+
+	comm_keys = syscalls.keys()
+	for comm in comm_keys:
+		pid_keys = syscalls[comm].keys()
+		for pid in pid_keys:
+			print("\n%s [%d]" % (comm, pid))
+			id_keys = syscalls[comm][pid].keys()
+			for id, val in sorted(syscalls[comm][pid].items(),
+				key = lambda kv: (kv[1], kv[0]), reverse = True):
+				print("  %-38s  %10d" % (syscall_name(id), val))
diff --git a/tools/perf/scripts/python/syscall-counts.py b/tools/perf/scripts/python/syscall-counts.py
index 0ebd89cfd42c..8adb95ff1664 100644
--- a/tools/perf/scripts/python/syscall-counts.py
+++ b/tools/perf/scripts/python/syscall-counts.py
@@ -36,8 +36,8 @@ def trace_end():
 	print_syscall_totals()
 
 def raw_syscalls__sys_enter(event_name, context, common_cpu,
-	common_secs, common_nsecs, common_pid, common_comm,
-	common_callchain, id, args):
+		common_secs, common_nsecs, common_pid, common_comm,
+		common_callchain, id, args):
 	if for_comm is not None:
 		if common_comm != for_comm:
 			return
@@ -47,20 +47,19 @@ def raw_syscalls__sys_enter(event_name, context, common_cpu,
 		syscalls[id] = 1
 
 def syscalls__sys_enter(event_name, context, common_cpu,
-	common_secs, common_nsecs, common_pid, common_comm,
-	id, args):
+		common_secs, common_nsecs, common_pid, common_comm, id, args):
 	raw_syscalls__sys_enter(**locals())
 
 def print_syscall_totals():
-    if for_comm is not None:
-	    print("\nsyscall events for %s:\n" % (for_comm))
-    else:
-	    print("\nsyscall events:\n")
-
-    print("%-40s  %10s" % ("event", "count"))
-    print("%-40s  %10s" % ("----------------------------------------",
-                              "-----------"))
-
-    for id, val in sorted(syscalls.items(), key = lambda kv: (kv[1], kv[0]), \
-				  reverse = True):
-	    print("%-40s  %10d" % (syscall_name(id), val))
+	if for_comm is not None:
+		print("\nsyscall events for %s:\n" % (for_comm))
+	else:
+		print("\nsyscall events:\n")
+
+	print("%-40s  %10s" % ("event", "count"))
+	print("%-40s  %10s" % ("----------------------------------------",
+				"-----------"))
+
+	for id, val in sorted(syscalls.items(),
+			key = lambda kv: (kv[1], kv[0]), reverse = True):
+		print("%-40s  %10d" % (syscall_name(id), val))
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 50+ messages in thread

* [PATCH 25/35] perf script python: Add Python3 support to futex-contention.py
  2019-03-07 17:43 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (23 preceding siblings ...)
  2019-03-07 17:44 ` [PATCH 24/35] perf script python: Remove mixed indentation Arnaldo Carvalho de Melo
@ 2019-03-07 17:44 ` Arnaldo Carvalho de Melo
  2019-03-07 17:44 ` [PATCH 26/35] perf script python: add Python3 support to check-perf-trace.py Arnaldo Carvalho de Melo
                   ` (10 subsequent siblings)
  35 siblings, 0 replies; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-03-07 17:44 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel,
	linux-perf-users, Tony Jones, Seeteena Thoufeek,
	Arnaldo Carvalho de Melo

From: Tony Jones <tonyj@suse.de>

Support both Python2 and Python3 in the futex-contention.py script

There may be differences in the ordering of output lines due to
differences in dictionary ordering etc.  However the format within lines
should be unchanged.

The use of 'from __future__' implies the minimum supported Python2 version
is now v2.6

Signed-off-by: Tony Jones <tonyj@suse.de>
Link: http://lkml.kernel.org/r/20190302011903.2416-3-tonyj@suse.de
Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/scripts/python/futex-contention.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/tools/perf/scripts/python/futex-contention.py b/tools/perf/scripts/python/futex-contention.py
index f221c62e0a10..0c4841acf75d 100644
--- a/tools/perf/scripts/python/futex-contention.py
+++ b/tools/perf/scripts/python/futex-contention.py
@@ -10,6 +10,8 @@
 #
 # Measures futex contention
 
+from __future__ import print_function
+
 import os, sys
 sys.path.append(os.environ['PERF_EXEC_PATH'] + '/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
 from Util import *
@@ -33,18 +35,18 @@ def syscalls__sys_enter_futex(event, ctxt, cpu, s, ns, tid, comm, callchain,
 
 def syscalls__sys_exit_futex(event, ctxt, cpu, s, ns, tid, comm, callchain,
 			     nr, ret):
-	if thread_blocktime.has_key(tid):
+	if tid in thread_blocktime:
 		elapsed = nsecs(s, ns) - thread_blocktime[tid]
 		add_stats(lock_waits, (tid, thread_thislock[tid]), elapsed)
 		del thread_blocktime[tid]
 		del thread_thislock[tid]
 
 def trace_begin():
-	print "Press control+C to stop and show the summary"
+	print("Press control+C to stop and show the summary")
 
 def trace_end():
 	for (tid, lock) in lock_waits:
 		min, max, avg, count = lock_waits[tid, lock]
-		print "%s[%d] lock %x contended %d times, %d avg ns" % \
-			(process_names[tid], tid, lock, count, avg)
+		print("%s[%d] lock %x contended %d times, %d avg ns" %
+			(process_names[tid], tid, lock, count, avg))
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 50+ messages in thread

* [PATCH 26/35] perf script python: add Python3 support to check-perf-trace.py
  2019-03-07 17:43 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (24 preceding siblings ...)
  2019-03-07 17:44 ` [PATCH 25/35] perf script python: Add Python3 support to futex-contention.py Arnaldo Carvalho de Melo
@ 2019-03-07 17:44 ` Arnaldo Carvalho de Melo
  2019-03-07 17:44 ` [PATCH 27/35] perf script python: Add Python3 support to event_analyzing_sample.py Arnaldo Carvalho de Melo
                   ` (9 subsequent siblings)
  35 siblings, 0 replies; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-03-07 17:44 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel,
	linux-perf-users, Tony Jones, Tom Zanussi, Seeteena Thoufeek,
	Arnaldo Carvalho de Melo

From: Tony Jones <tonyj@suse.de>

Support both Python 2 and Python 3 in the check-perf-trace.py script.

There may be differences in the ordering of output lines due to
differences in dictionary ordering etc.  However the format within lines
should be unchanged.

The use of from __future__ implies the minimum supported version of
Python2 is now v2.6

Signed-off-by: Tony Jones <tonyj@suse.de>
Cc: Tom Zanussi <tzanussi@gmail.com>
Link: http://lkml.kernel.org/r/20190302011903.2416-4-tonyj@suse.de
Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/scripts/python/check-perf-trace.py | 31 ++++++++++---------
 1 file changed, 17 insertions(+), 14 deletions(-)

diff --git a/tools/perf/scripts/python/check-perf-trace.py b/tools/perf/scripts/python/check-perf-trace.py
index f4838db3e518..d2c22954800d 100644
--- a/tools/perf/scripts/python/check-perf-trace.py
+++ b/tools/perf/scripts/python/check-perf-trace.py
@@ -7,6 +7,8 @@
 # events, etc.  Basically, if this script runs successfully and
 # displays expected results, Python scripting support should be ok.
 
+from __future__ import print_function
+
 import os
 import sys
 
@@ -19,7 +21,7 @@ from perf_trace_context import *
 unhandled = autodict()
 
 def trace_begin():
-	print "trace_begin"
+	print("trace_begin")
 	pass
 
 def trace_end():
@@ -33,7 +35,7 @@ def irq__softirq_entry(event_name, context, common_cpu,
 
 	print_uncommon(context)
 
-	print "vec=%s\n" % (symbol_str("irq__softirq_entry", "vec", vec)),
+	print("vec=%s" % (symbol_str("irq__softirq_entry", "vec", vec)))
 
 def kmem__kmalloc(event_name, context, common_cpu,
 		  common_secs, common_nsecs, common_pid, common_comm,
@@ -44,10 +46,10 @@ def kmem__kmalloc(event_name, context, common_cpu,
 
 	print_uncommon(context)
 
-	print "call_site=%u, ptr=%u, bytes_req=%u, " \
-		"bytes_alloc=%u, gfp_flags=%s\n" % \
+	print("call_site=%u, ptr=%u, bytes_req=%u, "
+		"bytes_alloc=%u, gfp_flags=%s" %
 		(call_site, ptr, bytes_req, bytes_alloc,
-		flag_str("kmem__kmalloc", "gfp_flags", gfp_flags)),
+		flag_str("kmem__kmalloc", "gfp_flags", gfp_flags)))
 
 def trace_unhandled(event_name, context, event_fields_dict):
 	try:
@@ -56,26 +58,27 @@ def trace_unhandled(event_name, context, event_fields_dict):
 		unhandled[event_name] = 1
 
 def print_header(event_name, cpu, secs, nsecs, pid, comm):
-	print "%-20s %5u %05u.%09u %8u %-20s " % \
+	print("%-20s %5u %05u.%09u %8u %-20s " %
 		(event_name, cpu, secs, nsecs, pid, comm),
+		end=' ')
 
 # print trace fields not included in handler args
 def print_uncommon(context):
-	print "common_preempt_count=%d, common_flags=%s, " \
-		"common_lock_depth=%d, " % \
+	print("common_preempt_count=%d, common_flags=%s, "
+		"common_lock_depth=%d, " %
 		(common_pc(context), trace_flag_str(common_flags(context)),
-		common_lock_depth(context))
+		common_lock_depth(context)))
 
 def print_unhandled():
 	keys = unhandled.keys()
 	if not keys:
 		return
 
-	print "\nunhandled events:\n\n",
+	print("\nunhandled events:\n")
 
-	print "%-40s  %10s\n" % ("event", "count"),
-	print "%-40s  %10s\n" % ("----------------------------------------", \
-				"-----------"),
+	print("%-40s  %10s" % ("event", "count"))
+	print("%-40s  %10s" % ("----------------------------------------",
+				"-----------"))
 
 	for event_name in keys:
-		print "%-40s  %10d\n" % (event_name, unhandled[event_name])
+		print("%-40s  %10d\n" % (event_name, unhandled[event_name]))
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 50+ messages in thread

* [PATCH 27/35] perf script python: Add Python3 support to event_analyzing_sample.py
  2019-03-07 17:43 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (25 preceding siblings ...)
  2019-03-07 17:44 ` [PATCH 26/35] perf script python: add Python3 support to check-perf-trace.py Arnaldo Carvalho de Melo
@ 2019-03-07 17:44 ` Arnaldo Carvalho de Melo
  2019-03-07 17:44 ` [PATCH 28/35] perf script python: Add Python3 support to intel-pt-events.py Arnaldo Carvalho de Melo
                   ` (8 subsequent siblings)
  35 siblings, 0 replies; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-03-07 17:44 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel,
	linux-perf-users, Tony Jones, Feng Tang, Seeteena Thoufeek,
	Arnaldo Carvalho de Melo

From: Tony Jones <tonyj@suse.de>

Support both Python2 and Python3 in the event_analyzing_sample.py script

There may be differences in the ordering of output lines due to
differences in dictionary ordering etc.  However the format within lines
should be unchanged.

The use of 'from __future__' implies the minimum supported Python2 version
is now v2.6

Signed-off-by: Tony Jones <tonyj@suse.de>
Cc: Feng Tang <feng.tang@intel.com>
Link: http://lkml.kernel.org/r/20190302011903.2416-5-tonyj@suse.de
Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 .../scripts/python/event_analyzing_sample.py  | 48 ++++++++++---------
 1 file changed, 25 insertions(+), 23 deletions(-)

diff --git a/tools/perf/scripts/python/event_analyzing_sample.py b/tools/perf/scripts/python/event_analyzing_sample.py
index 2ec8915b74c5..aa1e2cfa26a6 100644
--- a/tools/perf/scripts/python/event_analyzing_sample.py
+++ b/tools/perf/scripts/python/event_analyzing_sample.py
@@ -15,6 +15,8 @@
 # for a x86 HW PMU event: PEBS with load latency data.
 #
 
+from __future__ import print_function
+
 import os
 import sys
 import math
@@ -37,7 +39,7 @@ con = sqlite3.connect("/dev/shm/perf.db")
 con.isolation_level = None
 
 def trace_begin():
-        print "In trace_begin:\n"
+        print("In trace_begin:\n")
 
         #
         # Will create several tables at the start, pebs_ll is for PEBS data with
@@ -76,12 +78,12 @@ def process_event(param_dict):
         name       = param_dict["ev_name"]
 
         # Symbol and dso info are not always resolved
-        if (param_dict.has_key("dso")):
+        if ("dso" in param_dict):
                 dso = param_dict["dso"]
         else:
                 dso = "Unknown_dso"
 
-        if (param_dict.has_key("symbol")):
+        if ("symbol" in param_dict):
                 symbol = param_dict["symbol"]
         else:
                 symbol = "Unknown_symbol"
@@ -102,7 +104,7 @@ def insert_db(event):
                                 event.ip, event.status, event.dse, event.dla, event.lat))
 
 def trace_end():
-        print "In trace_end:\n"
+        print("In trace_end:\n")
         # We show the basic info for the 2 type of event classes
         show_general_events()
         show_pebs_ll()
@@ -123,29 +125,29 @@ def show_general_events():
         # Check the total record number in the table
         count = con.execute("select count(*) from gen_events")
         for t in count:
-                print "There is %d records in gen_events table" % t[0]
+                print("There is %d records in gen_events table" % t[0])
                 if t[0] == 0:
                         return
 
-        print "Statistics about the general events grouped by thread/symbol/dso: \n"
+        print("Statistics about the general events grouped by thread/symbol/dso: \n")
 
          # Group by thread
         commq = con.execute("select comm, count(comm) from gen_events group by comm order by -count(comm)")
-        print "\n%16s %8s %16s\n%s" % ("comm", "number", "histogram", "="*42)
+        print("\n%16s %8s %16s\n%s" % ("comm", "number", "histogram", "="*42))
         for row in commq:
-             print "%16s %8d     %s" % (row[0], row[1], num2sym(row[1]))
+             print("%16s %8d     %s" % (row[0], row[1], num2sym(row[1])))
 
         # Group by symbol
-        print "\n%32s %8s %16s\n%s" % ("symbol", "number", "histogram", "="*58)
+        print("\n%32s %8s %16s\n%s" % ("symbol", "number", "histogram", "="*58))
         symbolq = con.execute("select symbol, count(symbol) from gen_events group by symbol order by -count(symbol)")
         for row in symbolq:
-             print "%32s %8d     %s" % (row[0], row[1], num2sym(row[1]))
+             print("%32s %8d     %s" % (row[0], row[1], num2sym(row[1])))
 
         # Group by dso
-        print "\n%40s %8s %16s\n%s" % ("dso", "number", "histogram", "="*74)
+        print("\n%40s %8s %16s\n%s" % ("dso", "number", "histogram", "="*74))
         dsoq = con.execute("select dso, count(dso) from gen_events group by dso order by -count(dso)")
         for row in dsoq:
-             print "%40s %8d     %s" % (row[0], row[1], num2sym(row[1]))
+             print("%40s %8d     %s" % (row[0], row[1], num2sym(row[1])))
 
 #
 # This function just shows the basic info, and we could do more with the
@@ -156,35 +158,35 @@ def show_pebs_ll():
 
         count = con.execute("select count(*) from pebs_ll")
         for t in count:
-                print "There is %d records in pebs_ll table" % t[0]
+                print("There is %d records in pebs_ll table" % t[0])
                 if t[0] == 0:
                         return
 
-        print "Statistics about the PEBS Load Latency events grouped by thread/symbol/dse/latency: \n"
+        print("Statistics about the PEBS Load Latency events grouped by thread/symbol/dse/latency: \n")
 
         # Group by thread
         commq = con.execute("select comm, count(comm) from pebs_ll group by comm order by -count(comm)")
-        print "\n%16s %8s %16s\n%s" % ("comm", "number", "histogram", "="*42)
+        print("\n%16s %8s %16s\n%s" % ("comm", "number", "histogram", "="*42))
         for row in commq:
-             print "%16s %8d     %s" % (row[0], row[1], num2sym(row[1]))
+             print("%16s %8d     %s" % (row[0], row[1], num2sym(row[1])))
 
         # Group by symbol
-        print "\n%32s %8s %16s\n%s" % ("symbol", "number", "histogram", "="*58)
+        print("\n%32s %8s %16s\n%s" % ("symbol", "number", "histogram", "="*58))
         symbolq = con.execute("select symbol, count(symbol) from pebs_ll group by symbol order by -count(symbol)")
         for row in symbolq:
-             print "%32s %8d     %s" % (row[0], row[1], num2sym(row[1]))
+             print("%32s %8d     %s" % (row[0], row[1], num2sym(row[1])))
 
         # Group by dse
         dseq = con.execute("select dse, count(dse) from pebs_ll group by dse order by -count(dse)")
-        print "\n%32s %8s %16s\n%s" % ("dse", "number", "histogram", "="*58)
+        print("\n%32s %8s %16s\n%s" % ("dse", "number", "histogram", "="*58))
         for row in dseq:
-             print "%32s %8d     %s" % (row[0], row[1], num2sym(row[1]))
+             print("%32s %8d     %s" % (row[0], row[1], num2sym(row[1])))
 
         # Group by latency
         latq = con.execute("select lat, count(lat) from pebs_ll group by lat order by lat")
-        print "\n%32s %8s %16s\n%s" % ("latency", "number", "histogram", "="*58)
+        print("\n%32s %8s %16s\n%s" % ("latency", "number", "histogram", "="*58))
         for row in latq:
-             print "%32s %8d     %s" % (row[0], row[1], num2sym(row[1]))
+             print("%32s %8d     %s" % (row[0], row[1], num2sym(row[1])))
 
 def trace_unhandled(event_name, context, event_fields_dict):
-        print ' '.join(['%s=%s'%(k,str(v))for k,v in sorted(event_fields_dict.items())])
+        print (' '.join(['%s=%s'%(k,str(v))for k,v in sorted(event_fields_dict.items())]))
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 50+ messages in thread

* [PATCH 28/35] perf script python: Add Python3 support to intel-pt-events.py
  2019-03-07 17:43 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (26 preceding siblings ...)
  2019-03-07 17:44 ` [PATCH 27/35] perf script python: Add Python3 support to event_analyzing_sample.py Arnaldo Carvalho de Melo
@ 2019-03-07 17:44 ` Arnaldo Carvalho de Melo
  2019-03-07 17:44 ` [PATCH 29/35] perf c2c: Fix c2c report for empty numa node Arnaldo Carvalho de Melo
                   ` (7 subsequent siblings)
  35 siblings, 0 replies; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-03-07 17:44 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel,
	linux-perf-users, Tony Jones, Adrian Hunter, Seeteena Thoufeek,
	Arnaldo Carvalho de Melo

From: Tony Jones <tonyj@suse.de>

Support both Python2 and Python3 in the intel-pt-events.py script

There may be differences in the ordering of output lines due to
differences in dictionary ordering etc.  However the format within lines
should be unchanged.

The use of 'from __future__' implies the minimum supported Python2 version
is now v2.6

Signed-off-by: Tony Jones <tonyj@suse.de>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Link: http://lkml.kernel.org/r/fd26acf9-0c0f-717f-9664-a3c33043ce19@suse.de
Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/scripts/python/intel-pt-events.py | 32 ++++++++++++--------
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/tools/perf/scripts/python/intel-pt-events.py b/tools/perf/scripts/python/intel-pt-events.py
index 2177722f509e..a73847c8f548 100644
--- a/tools/perf/scripts/python/intel-pt-events.py
+++ b/tools/perf/scripts/python/intel-pt-events.py
@@ -10,6 +10,8 @@
 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 # more details.
 
+from __future__ import print_function
+
 import os
 import sys
 import struct
@@ -22,34 +24,34 @@ sys.path.append(os.environ['PERF_EXEC_PATH'] + \
 #from Core import *
 
 def trace_begin():
-	print "Intel PT Power Events and PTWRITE"
+	print("Intel PT Power Events and PTWRITE")
 
 def trace_end():
-	print "End"
+	print("End")
 
 def trace_unhandled(event_name, context, event_fields_dict):
-		print ' '.join(['%s=%s'%(k,str(v))for k,v in sorted(event_fields_dict.items())])
+		print(' '.join(['%s=%s'%(k,str(v))for k,v in sorted(event_fields_dict.items())]))
 
 def print_ptwrite(raw_buf):
 	data = struct.unpack_from("<IQ", raw_buf)
 	flags = data[0]
 	payload = data[1]
 	exact_ip = flags & 1
-	print "IP: %u payload: %#x" % (exact_ip, payload),
+	print("IP: %u payload: %#x" % (exact_ip, payload), end=' ')
 
 def print_cbr(raw_buf):
 	data = struct.unpack_from("<BBBBII", raw_buf)
 	cbr = data[0]
 	f = (data[4] + 500) / 1000
 	p = ((cbr * 1000 / data[2]) + 5) / 10
-	print "%3u  freq: %4u MHz  (%3u%%)" % (cbr, f, p),
+	print("%3u  freq: %4u MHz  (%3u%%)" % (cbr, f, p), end=' ')
 
 def print_mwait(raw_buf):
 	data = struct.unpack_from("<IQ", raw_buf)
 	payload = data[1]
 	hints = payload & 0xff
 	extensions = (payload >> 32) & 0x3
-	print "hints: %#x extensions: %#x" % (hints, extensions),
+	print("hints: %#x extensions: %#x" % (hints, extensions), end=' ')
 
 def print_pwre(raw_buf):
 	data = struct.unpack_from("<IQ", raw_buf)
@@ -57,13 +59,14 @@ def print_pwre(raw_buf):
 	hw = (payload >> 7) & 1
 	cstate = (payload >> 12) & 0xf
 	subcstate = (payload >> 8) & 0xf
-	print "hw: %u cstate: %u sub-cstate: %u" % (hw, cstate, subcstate),
+	print("hw: %u cstate: %u sub-cstate: %u" % (hw, cstate, subcstate),
+		end=' ')
 
 def print_exstop(raw_buf):
 	data = struct.unpack_from("<I", raw_buf)
 	flags = data[0]
 	exact_ip = flags & 1
-	print "IP: %u" % (exact_ip),
+	print("IP: %u" % (exact_ip), end=' ')
 
 def print_pwrx(raw_buf):
 	data = struct.unpack_from("<IQ", raw_buf)
@@ -71,18 +74,21 @@ def print_pwrx(raw_buf):
 	deepest_cstate = payload & 0xf
 	last_cstate = (payload >> 4) & 0xf
 	wake_reason = (payload >> 8) & 0xf
-	print "deepest cstate: %u last cstate: %u wake reason: %#x" % (deepest_cstate, last_cstate, wake_reason),
+	print("deepest cstate: %u last cstate: %u wake reason: %#x" %
+		(deepest_cstate, last_cstate, wake_reason), end=' ')
 
 def print_common_start(comm, sample, name):
 	ts = sample["time"]
 	cpu = sample["cpu"]
 	pid = sample["pid"]
 	tid = sample["tid"]
-	print "%16s %5u/%-5u [%03u] %9u.%09u %7s:" % (comm, pid, tid, cpu, ts / 1000000000, ts %1000000000, name),
+	print("%16s %5u/%-5u [%03u] %9u.%09u %7s:" %
+		(comm, pid, tid, cpu, ts / 1000000000, ts %1000000000, name),
+		end=' ')
 
 def print_common_ip(sample, symbol, dso):
 	ip = sample["ip"]
-	print "%16x %s (%s)" % (ip, symbol, dso)
+	print("%16x %s (%s)" % (ip, symbol, dso))
 
 def process_event(param_dict):
 	event_attr = param_dict["attr"]
@@ -92,12 +98,12 @@ def process_event(param_dict):
 	name	   = param_dict["ev_name"]
 
 	# Symbol and dso info are not always resolved
-	if (param_dict.has_key("dso")):
+	if "dso" in param_dict:
 		dso = param_dict["dso"]
 	else:
 		dso = "[unknown]"
 
-	if (param_dict.has_key("symbol")):
+	if "symbol" in param_dict:
 		symbol = param_dict["symbol"]
 	else:
 		symbol = "[unknown]"
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 50+ messages in thread

* [PATCH 29/35] perf c2c: Fix c2c report for empty numa node
  2019-03-07 17:43 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (27 preceding siblings ...)
  2019-03-07 17:44 ` [PATCH 28/35] perf script python: Add Python3 support to intel-pt-events.py Arnaldo Carvalho de Melo
@ 2019-03-07 17:44 ` Arnaldo Carvalho de Melo
  2019-03-07 17:44 ` [PATCH 30/35] perf hist: Add error path into hist_entry__init Arnaldo Carvalho de Melo
                   ` (6 subsequent siblings)
  35 siblings, 0 replies; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-03-07 17:44 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel,
	linux-perf-users, Jiri Olsa, Nageswara R Sastry, Ravi Bangoria,
	Alexander Shishkin, Andi Kleen, Jonas Rabenstein, Peter Zijlstra,
	Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@redhat.com>

Ravi Bangoria reported that we fail with an empty NUMA node with the
following message:

  $ lscpu
  NUMA node0 CPU(s):
  NUMA node1 CPU(s):   0-4

  $ sudo ./perf c2c report
  node/cpu topology bugFailed setup nodes

Fix this by detecting the empty node and keeping its CPU set empty.

Reported-by: Nageswara R Sastry <nasastry@in.ibm.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jonas Rabenstein <jonas.rabenstein@studium.uni-erlangen.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20190305152536.21035-2-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-c2c.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
index 4272763a5e96..9e6cc868bdb4 100644
--- a/tools/perf/builtin-c2c.c
+++ b/tools/perf/builtin-c2c.c
@@ -2056,6 +2056,12 @@ static int setup_nodes(struct perf_session *session)
 		if (!set)
 			return -ENOMEM;
 
+		nodes[node] = set;
+
+		/* empty node, skip */
+		if (cpu_map__empty(map))
+			continue;
+
 		for (cpu = 0; cpu < map->nr; cpu++) {
 			set_bit(map->map[cpu], set);
 
@@ -2064,8 +2070,6 @@ static int setup_nodes(struct perf_session *session)
 
 			cpu2node[map->map[cpu]] = node;
 		}
-
-		nodes[node] = set;
 	}
 
 	setup_nodes_header();
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 50+ messages in thread

* [PATCH 30/35] perf hist: Add error path into hist_entry__init
  2019-03-07 17:43 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (28 preceding siblings ...)
  2019-03-07 17:44 ` [PATCH 29/35] perf c2c: Fix c2c report for empty numa node Arnaldo Carvalho de Melo
@ 2019-03-07 17:44 ` Arnaldo Carvalho de Melo
  2019-03-07 17:44 ` [PATCH 31/35] perf hist: Fix memory leak of srcline Arnaldo Carvalho de Melo
                   ` (5 subsequent siblings)
  35 siblings, 0 replies; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-03-07 17:44 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel,
	linux-perf-users, Alexander Shishkin, Andi Kleen,
	Jonas Rabenstein, Peter Zijlstra, Ravi Bangoria,
	nageswara r sastry, Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@kernel.org>

Adding error path into hist_entry__init to unify error handling, so
every new member does not need to free everything else.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jonas Rabenstein <jonas.rabenstein@studium.uni-erlangen.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Cc: nageswara r sastry <nasastry@in.ibm.com>
Link: http://lkml.kernel.org/r/20190305152536.21035-3-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/hist.c | 39 +++++++++++++++++++--------------------
 1 file changed, 19 insertions(+), 20 deletions(-)

diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 669f961316f0..74e307d17c49 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -396,11 +396,8 @@ static int hist_entry__init(struct hist_entry *he,
 		 * adding new entries.  So we need to save a copy.
 		 */
 		he->branch_info = malloc(sizeof(*he->branch_info));
-		if (he->branch_info == NULL) {
-			map__zput(he->ms.map);
-			free(he->stat_acc);
-			return -ENOMEM;
-		}
+		if (he->branch_info == NULL)
+			goto err;
 
 		memcpy(he->branch_info, template->branch_info,
 		       sizeof(*he->branch_info));
@@ -419,21 +416,8 @@ static int hist_entry__init(struct hist_entry *he,
 
 	if (he->raw_data) {
 		he->raw_data = memdup(he->raw_data, he->raw_size);
-
-		if (he->raw_data == NULL) {
-			map__put(he->ms.map);
-			if (he->branch_info) {
-				map__put(he->branch_info->from.map);
-				map__put(he->branch_info->to.map);
-				free(he->branch_info);
-			}
-			if (he->mem_info) {
-				map__put(he->mem_info->iaddr.map);
-				map__put(he->mem_info->daddr.map);
-			}
-			free(he->stat_acc);
-			return -ENOMEM;
-		}
+		if (he->raw_data == NULL)
+			goto err_infos;
 	}
 	INIT_LIST_HEAD(&he->pairs.node);
 	thread__get(he->thread);
@@ -444,6 +428,21 @@ static int hist_entry__init(struct hist_entry *he,
 		he->leaf = true;
 
 	return 0;
+
+err_infos:
+	if (he->branch_info) {
+		map__put(he->branch_info->from.map);
+		map__put(he->branch_info->to.map);
+		free(he->branch_info);
+	}
+	if (he->mem_info) {
+		map__put(he->mem_info->iaddr.map);
+		map__put(he->mem_info->daddr.map);
+	}
+err:
+	map__zput(he->ms.map);
+	free(he->stat_acc);
+	return -ENOMEM;
 }
 
 static void *hist_entry__zalloc(size_t size)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 50+ messages in thread

* [PATCH 31/35] perf hist: Fix memory leak of srcline
  2019-03-07 17:43 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (29 preceding siblings ...)
  2019-03-07 17:44 ` [PATCH 30/35] perf hist: Add error path into hist_entry__init Arnaldo Carvalho de Melo
@ 2019-03-07 17:44 ` Arnaldo Carvalho de Melo
  2019-03-07 17:44 ` [PATCH 32/35] perf tools: Read and store caps/max_precise in perf_pmu Arnaldo Carvalho de Melo
                   ` (4 subsequent siblings)
  35 siblings, 0 replies; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-03-07 17:44 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel,
	linux-perf-users, Jiri Olsa, Jonas Rabenstein,
	Alexander Shishkin, Andi Kleen, Nageswara R Sastry,
	Peter Zijlstra, Ravi Bangoria, Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@redhat.com>

We can't allocate he->srcline unconditionaly, only when new hist_entry
is created. Moving he->srcline allocation into hist_entry__init
function.

Original-patch-by: Jonas Rabenstein <jonas.rabenstein@studium.uni-erlangen.de>
Suggested-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Nageswara R Sastry <nasastry@in.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Link: http://lkml.kernel.org/r/20190305152536.21035-4-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/hist.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 74e307d17c49..f9eb95bf3938 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -419,6 +419,13 @@ static int hist_entry__init(struct hist_entry *he,
 		if (he->raw_data == NULL)
 			goto err_infos;
 	}
+
+	if (he->srcline) {
+		he->srcline = strdup(he->srcline);
+		if (he->srcline == NULL)
+			goto err_rawdata;
+	}
+
 	INIT_LIST_HEAD(&he->pairs.node);
 	thread__get(he->thread);
 	he->hroot_in  = RB_ROOT_CACHED;
@@ -429,6 +436,9 @@ static int hist_entry__init(struct hist_entry *he,
 
 	return 0;
 
+err_rawdata:
+	free(he->raw_data);
+
 err_infos:
 	if (he->branch_info) {
 		map__put(he->branch_info->from.map);
@@ -605,7 +615,7 @@ __hists__add_entry(struct hists *hists,
 			.map	= al->map,
 			.sym	= al->sym,
 		},
-		.srcline = al->srcline ? strdup(al->srcline) : NULL,
+		.srcline = (char *) al->srcline,
 		.socket	 = al->socket,
 		.cpu	 = al->cpu,
 		.cpumode = al->cpumode,
@@ -962,7 +972,7 @@ iter_add_next_cumulative_entry(struct hist_entry_iter *iter,
 			.map = al->map,
 			.sym = al->sym,
 		},
-		.srcline = al->srcline ? strdup(al->srcline) : NULL,
+		.srcline = (char *) al->srcline,
 		.parent = iter->parent,
 		.raw_data = sample->raw_data,
 		.raw_size = sample->raw_size,
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 50+ messages in thread

* [PATCH 32/35] perf tools: Read and store caps/max_precise in perf_pmu
  2019-03-07 17:43 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (30 preceding siblings ...)
  2019-03-07 17:44 ` [PATCH 31/35] perf hist: Fix memory leak of srcline Arnaldo Carvalho de Melo
@ 2019-03-07 17:44 ` Arnaldo Carvalho de Melo
  2019-03-07 17:44 ` [PATCH 33/35] perf evsel: Probe for precise_ip with simple attr Arnaldo Carvalho de Melo
                   ` (3 subsequent siblings)
  35 siblings, 0 replies; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-03-07 17:44 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel,
	linux-perf-users, Alexander Shishkin, Andi Kleen,
	Jonas Rabenstein, Nageswara R Sastry, Peter Zijlstra,
	Ravi Bangoria, Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@kernel.org>

Read the caps/max_precise value and store it in struct perf_pmu to be
used when setting the maximum precise_ip field in following patch.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jonas Rabenstein <jonas.rabenstein@studium.uni-erlangen.de>
Cc: Nageswara R Sastry <nasastry@in.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Link: http://lkml.kernel.org/r/20190305152536.21035-5-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/pmu.c | 14 ++++++++++++++
 tools/perf/util/pmu.h |  1 +
 2 files changed, 15 insertions(+)

diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 51d437f55d18..6199a3174ab9 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -752,6 +752,19 @@ perf_pmu__get_default_config(struct perf_pmu *pmu __maybe_unused)
 	return NULL;
 }
 
+static int pmu_max_precise(const char *name)
+{
+	char path[PATH_MAX];
+	int max_precise = -1;
+
+	scnprintf(path, PATH_MAX,
+		 "bus/event_source/devices/%s/caps/max_precise",
+		 name);
+
+	sysfs__read_int(path, &max_precise);
+	return max_precise;
+}
+
 static struct perf_pmu *pmu_lookup(const char *name)
 {
 	struct perf_pmu *pmu;
@@ -784,6 +797,7 @@ static struct perf_pmu *pmu_lookup(const char *name)
 	pmu->name = strdup(name);
 	pmu->type = type;
 	pmu->is_uncore = pmu_is_uncore(name);
+	pmu->max_precise = pmu_max_precise(name);
 	pmu_add_cpu_aliases(&aliases, pmu);
 
 	INIT_LIST_HEAD(&pmu->format);
diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
index 47253c3daf55..bd9ec2704a57 100644
--- a/tools/perf/util/pmu.h
+++ b/tools/perf/util/pmu.h
@@ -26,6 +26,7 @@ struct perf_pmu {
 	__u32 type;
 	bool selectable;
 	bool is_uncore;
+	int max_precise;
 	struct perf_event_attr *default_config;
 	struct cpu_map *cpus;
 	struct list_head format;  /* HEAD struct perf_pmu_format -> list */
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 50+ messages in thread

* [PATCH 33/35] perf evsel: Probe for precise_ip with simple attr
  2019-03-07 17:43 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (31 preceding siblings ...)
  2019-03-07 17:44 ` [PATCH 32/35] perf tools: Read and store caps/max_precise in perf_pmu Arnaldo Carvalho de Melo
@ 2019-03-07 17:44 ` Arnaldo Carvalho de Melo
  2019-03-07 17:44 ` [PATCH 34/35] perf session: Fix double free in perf_data__close Arnaldo Carvalho de Melo
                   ` (2 subsequent siblings)
  35 siblings, 0 replies; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-03-07 17:44 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel,
	linux-perf-users, Alexander Shishkin, Andi Kleen,
	Jonas Rabenstein, Nageswara R Sastry, Peter Zijlstra,
	Ravi Bangoria, Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@kernel.org>

Currently we probe for precise_ip with user specified perf_event_attr,
which might fail because of unsupported kernel features, which would get
disabled during the open time anyway.

Switching the probe to take place on simple hw cycles, so the following
record sets proper precise_ip:

  # perf record -e cycles:P ls
  # perf evlist -v
  cycles:P: size: 112, ... precise_ip: 3, ...

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jonas Rabenstein <jonas.rabenstein@studium.uni-erlangen.de>
Cc: Nageswara R Sastry <nasastry@in.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Link: http://lkml.kernel.org/r/20190305152536.21035-7-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/evlist.c | 25 ++++++++++++++++++++-----
 tools/perf/util/evsel.c  |  8 --------
 2 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 08cedb643ea6..ed20f4379956 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -230,18 +230,33 @@ void perf_evlist__set_leader(struct perf_evlist *evlist)
 	}
 }
 
-void perf_event_attr__set_max_precise_ip(struct perf_event_attr *attr)
+void perf_event_attr__set_max_precise_ip(struct perf_event_attr *pattr)
 {
-	attr->precise_ip = 3;
+	struct perf_event_attr attr = {
+		.type		= PERF_TYPE_HARDWARE,
+		.config		= PERF_COUNT_HW_CPU_CYCLES,
+		.exclude_kernel	= 1,
+		.precise_ip	= 3,
+	};
 
-	while (attr->precise_ip != 0) {
-		int fd = sys_perf_event_open(attr, 0, -1, -1, 0);
+	event_attr_init(&attr);
+
+	/*
+	 * Unnamed union member, not supported as struct member named
+	 * initializer in older compilers such as gcc 4.4.7
+	 */
+	attr.sample_period = 1;
+
+	while (attr.precise_ip != 0) {
+		int fd = sys_perf_event_open(&attr, 0, -1, -1, 0);
 		if (fd != -1) {
 			close(fd);
 			break;
 		}
-		--attr->precise_ip;
+		--attr.precise_ip;
 	}
+
+	pattr->precise_ip = attr.precise_ip;
 }
 
 int __perf_evlist__add_default(struct perf_evlist *evlist, bool precise)
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index dfe2958e6287..3bbf73e979c0 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -294,20 +294,12 @@ struct perf_evsel *perf_evsel__new_cycles(bool precise)
 
 	if (!precise)
 		goto new_event;
-	/*
-	 * Unnamed union member, not supported as struct member named
-	 * initializer in older compilers such as gcc 4.4.7
-	 *
-	 * Just for probing the precise_ip:
-	 */
-	attr.sample_period = 1;
 
 	perf_event_attr__set_max_precise_ip(&attr);
 	/*
 	 * Now let the usual logic to set up the perf_event_attr defaults
 	 * to kick in when we return and before perf_evsel__open() is called.
 	 */
-	attr.sample_period = 0;
 new_event:
 	evsel = perf_evsel__new(&attr);
 	if (evsel == NULL)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 50+ messages in thread

* [PATCH 34/35] perf session: Fix double free in perf_data__close
  2019-03-07 17:43 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (32 preceding siblings ...)
  2019-03-07 17:44 ` [PATCH 33/35] perf evsel: Probe for precise_ip with simple attr Arnaldo Carvalho de Melo
@ 2019-03-07 17:44 ` Arnaldo Carvalho de Melo
  2019-03-07 17:44 ` [PATCH 35/35] perf data: Force perf_data__open|close zero data->file.path Arnaldo Carvalho de Melo
  2019-03-09 16:02 ` [GIT PULL 00/35] perf/core improvements and fixes Ingo Molnar
  35 siblings, 0 replies; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-03-07 17:44 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel,
	linux-perf-users, Alexander Shishkin, Andi Kleen,
	Jonas Rabenstein, Nageswara R Sastry, Peter Zijlstra,
	Ravi Bangoria, Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@kernel.org>

We can't call perf_data__close and subsequently perf_session__delete,
because it will call perf_data__close again and cause double free for
data->file.path.

  $ perf report -i .
  incompatible file format (rerun with -v to learn more)
  free(): double free detected in tcache 2
  Aborted (core dumped)

In fact we don't need to call perf_data__close at all, because at the
time the got out_close is reached, session->data is already initialized,
so the perf_data__close call will be triggered from
perf_session__delete.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jonas Rabenstein <jonas.rabenstein@studium.uni-erlangen.de>
Cc: Nageswara R Sastry <nasastry@in.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Fixes: 2d4f27999b88 ("perf data: Add global path holder")
Link: http://lkml.kernel.org/r/20190305152536.21035-8-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/session.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index c764bbc91009..db643f3c2b95 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -140,7 +140,7 @@ struct perf_session *perf_session__new(struct perf_data *data,
 
 		if (perf_data__is_read(data)) {
 			if (perf_session__open(session) < 0)
-				goto out_close;
+				goto out_delete;
 
 			/*
 			 * set session attributes that are present in perf.data
@@ -181,8 +181,6 @@ struct perf_session *perf_session__new(struct perf_data *data,
 
 	return session;
 
- out_close:
-	perf_data__close(data);
  out_delete:
 	perf_session__delete(session);
  out:
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 50+ messages in thread

* [PATCH 35/35] perf data: Force perf_data__open|close zero data->file.path
  2019-03-07 17:43 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (33 preceding siblings ...)
  2019-03-07 17:44 ` [PATCH 34/35] perf session: Fix double free in perf_data__close Arnaldo Carvalho de Melo
@ 2019-03-07 17:44 ` Arnaldo Carvalho de Melo
  2019-03-09 16:02 ` [GIT PULL 00/35] perf/core improvements and fixes Ingo Molnar
  35 siblings, 0 replies; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-03-07 17:44 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel,
	linux-perf-users, Alexander Shishkin, Andi Kleen,
	Jonas Rabenstein, Nageswara R Sastry, Peter Zijlstra,
	Ravi Bangoria, Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@kernel.org>

Making sure the data->file.path is zeroed on perf_data__open error path
and in perf_data__close, so we don't double free it in case someone call
it twice.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jonas Rabenstein <jonas.rabenstein@studium.uni-erlangen.de>
Cc: Nageswara R Sastry <nasastry@in.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Link: http://lkml.kernel.org/r/20190305152536.21035-9-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/data.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c
index 7bd5ddeb7a41..e098e189f93e 100644
--- a/tools/perf/util/data.c
+++ b/tools/perf/util/data.c
@@ -237,7 +237,7 @@ static int open_file(struct perf_data *data)
 	     open_file_read(data) : open_file_write(data);
 
 	if (fd < 0) {
-		free(data->file.path);
+		zfree(&data->file.path);
 		return -1;
 	}
 
@@ -270,7 +270,7 @@ int perf_data__open(struct perf_data *data)
 
 void perf_data__close(struct perf_data *data)
 {
-	free(data->file.path);
+	zfree(&data->file.path);
 	close(data->file.fd);
 }
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 50+ messages in thread

* Re: [PATCH 02/35] perf probe: Clarify error message about not finding kernel modules debuginfo
  2019-03-07 17:44 ` [PATCH 02/35] perf probe: Clarify error message about not finding kernel modules debuginfo Arnaldo Carvalho de Melo
@ 2019-03-07 23:30   ` Masami Hiramatsu
  2019-03-07 23:58     ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 50+ messages in thread
From: Masami Hiramatsu @ 2019-03-07 23:30 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Jiri Olsa, Namhyung Kim, Clark Williams,
	linux-kernel, linux-perf-users, Arnaldo Carvalho de Melo,
	Adrian Hunter, Marcelo Ricardo Leitner, Masami Hiramatsu

On Thu,  7 Mar 2019 14:44:00 -0300
Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> From: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> 'perf probe' supports using just the kernel module name, but that will
> work only when the module is loaded, or using the full pathname to the
> file with the DWARF debug info, but the warning was cryptic:

Agreed, this looks good to me.

Acked-by: Masami Hiramatsu <mhiramat@kernel.org>

Thank you!

> 
> Before:
> 
>   # perf probe -m cls_flower -L fl_change
>   Failed to find the path for cls_flower: No such file or directory
>     Error: Failed to show lines.
>   #
> 
> After:
> 
>   # perf probe -m cls_flower -L fl_change
>   Module cls_flower is not loaded, please specify its full path name.
>     Error: Failed to show lines.
>   # perf probe -m /lib/modules/5.0.0-rc7+/kernel/net/sched/cls_flower.ko -L fl_change | head -7
>   <fl_change@/home/acme/git/linux/net/sched/cls_flower.c:0>
>         0  static int fl_change(struct net *net, struct sk_buff *in_skb,
>          		       struct tcf_proto *tp, unsigned long base,
>          		       u32 handle, struct nlattr **tca,
>          		       void **arg, bool ovr, struct netlink_ext_ack *extack)
>         4  {
>         5  	struct cls_fl_head *head = rtnl_dereference(tp->root);
>   #
> 
> The behaviour doesn't change when the module is loaded:
> 
>   # modprobe cls_flower
>   # perf probe -m cls_flower -L fl_change | head -7
>   <fl_change@/home/acme/git/linux/net/sched/cls_flower.c:0>
>         0  static int fl_change(struct net *net, struct sk_buff *in_skb,
>                                struct tcf_proto *tp, unsigned long base,
>                                u32 handle, struct nlattr **tca,
>                                void **arg, bool ovr, struct netlink_ext_ack *extack)
>         4  {
>         5         struct cls_fl_head *head = rtnl_dereference(tp->root);
>   #
> 
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Marcelo Ricardo Leitner <mleitner@redhat.com>
> Cc: Masami Hiramatsu <mhiramat@kernel.org>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Link: https://lkml.kernel.org/n/tip-q4njvk9mshra00jacqjbzfn5@git.kernel.org
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> ---
>  tools/perf/util/probe-event.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
> index 0030f9b9bf7e..a1b8d9649ca7 100644
> --- a/tools/perf/util/probe-event.c
> +++ b/tools/perf/util/probe-event.c
> @@ -472,9 +472,12 @@ static struct debuginfo *open_debuginfo(const char *module, struct nsinfo *nsi,
>  					strcpy(reason, "(unknown)");
>  			} else
>  				dso__strerror_load(dso, reason, STRERR_BUFSIZE);
> -			if (!silent)
> -				pr_err("Failed to find the path for %s: %s\n",
> -					module ?: "kernel", reason);
> +			if (!silent) {
> +				if (module)
> +					pr_err("Module %s is not loaded, please specify its full path name.\n", module);
> +				else
> +					pr_err("Failed to find the path for the kernel: %s\n", reason);
> +			}
>  			return NULL;
>  		}
>  		path = dso->long_name;
> -- 
> 2.20.1
> 


-- 
Masami Hiramatsu <mhiramat@kernel.org>

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [PATCH 02/35] perf probe: Clarify error message about not finding kernel modules debuginfo
  2019-03-07 23:30   ` Masami Hiramatsu
@ 2019-03-07 23:58     ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-03-07 23:58 UTC (permalink / raw)
  To: Masami Hiramatsu
  Cc: Ingo Molnar, Jiri Olsa, Namhyung Kim, Clark Williams,
	linux-kernel, linux-perf-users, Arnaldo Carvalho de Melo,
	Adrian Hunter, Marcelo Ricardo Leitner

Em Fri, Mar 08, 2019 at 08:30:33AM +0900, Masami Hiramatsu escreveu:
> On Thu,  7 Mar 2019 14:44:00 -0300
> Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> 
> > From: Arnaldo Carvalho de Melo <acme@redhat.com>
> > 
> > 'perf probe' supports using just the kernel module name, but that will
> > work only when the module is loaded, or using the full pathname to the
> > file with the DWARF debug info, but the warning was cryptic:
> 
> Agreed, this looks good to me.
> 
> Acked-by: Masami Hiramatsu <mhiramat@kernel.org>

Thanks for checking!

- Arnaldo
 
> Thank you!
> 
> > 
> > Before:
> > 
> >   # perf probe -m cls_flower -L fl_change
> >   Failed to find the path for cls_flower: No such file or directory
> >     Error: Failed to show lines.
> >   #
> > 
> > After:
> > 
> >   # perf probe -m cls_flower -L fl_change
> >   Module cls_flower is not loaded, please specify its full path name.
> >     Error: Failed to show lines.
> >   # perf probe -m /lib/modules/5.0.0-rc7+/kernel/net/sched/cls_flower.ko -L fl_change | head -7
> >   <fl_change@/home/acme/git/linux/net/sched/cls_flower.c:0>
> >         0  static int fl_change(struct net *net, struct sk_buff *in_skb,
> >          		       struct tcf_proto *tp, unsigned long base,
> >          		       u32 handle, struct nlattr **tca,
> >          		       void **arg, bool ovr, struct netlink_ext_ack *extack)
> >         4  {
> >         5  	struct cls_fl_head *head = rtnl_dereference(tp->root);
> >   #
> > 
> > The behaviour doesn't change when the module is loaded:
> > 
> >   # modprobe cls_flower
> >   # perf probe -m cls_flower -L fl_change | head -7
> >   <fl_change@/home/acme/git/linux/net/sched/cls_flower.c:0>
> >         0  static int fl_change(struct net *net, struct sk_buff *in_skb,
> >                                struct tcf_proto *tp, unsigned long base,
> >                                u32 handle, struct nlattr **tca,
> >                                void **arg, bool ovr, struct netlink_ext_ack *extack)
> >         4  {
> >         5         struct cls_fl_head *head = rtnl_dereference(tp->root);
> >   #
> > 
> > Cc: Adrian Hunter <adrian.hunter@intel.com>
> > Cc: Jiri Olsa <jolsa@kernel.org>
> > Cc: Marcelo Ricardo Leitner <mleitner@redhat.com>
> > Cc: Masami Hiramatsu <mhiramat@kernel.org>
> > Cc: Namhyung Kim <namhyung@kernel.org>
> > Link: https://lkml.kernel.org/n/tip-q4njvk9mshra00jacqjbzfn5@git.kernel.org
> > Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> > ---
> >  tools/perf/util/probe-event.c | 9 ++++++---
> >  1 file changed, 6 insertions(+), 3 deletions(-)
> > 
> > diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
> > index 0030f9b9bf7e..a1b8d9649ca7 100644
> > --- a/tools/perf/util/probe-event.c
> > +++ b/tools/perf/util/probe-event.c
> > @@ -472,9 +472,12 @@ static struct debuginfo *open_debuginfo(const char *module, struct nsinfo *nsi,
> >  					strcpy(reason, "(unknown)");
> >  			} else
> >  				dso__strerror_load(dso, reason, STRERR_BUFSIZE);
> > -			if (!silent)
> > -				pr_err("Failed to find the path for %s: %s\n",
> > -					module ?: "kernel", reason);
> > +			if (!silent) {
> > +				if (module)
> > +					pr_err("Module %s is not loaded, please specify its full path name.\n", module);
> > +				else
> > +					pr_err("Failed to find the path for the kernel: %s\n", reason);
> > +			}
> >  			return NULL;
> >  		}
> >  		path = dso->long_name;
> > -- 
> > 2.20.1
> > 
> 
> 
> -- 
> Masami Hiramatsu <mhiramat@kernel.org>

-- 

- Arnaldo

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [GIT PULL 00/35] perf/core improvements and fixes
  2019-03-07 17:43 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (34 preceding siblings ...)
  2019-03-07 17:44 ` [PATCH 35/35] perf data: Force perf_data__open|close zero data->file.path Arnaldo Carvalho de Melo
@ 2019-03-09 16:02 ` Ingo Molnar
  35 siblings, 0 replies; 50+ messages in thread
From: Ingo Molnar @ 2019-03-09 16:02 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel,
	linux-perf-users, Adrian Hunter, Alexander Shishkin, Andi Kleen,
	Gustavo A . R . Silva, Jin Yao, Mathias Krause, Michael Sartain,
	Nageswara R Sastry, Ravi Bangoria, Seeteena Thoufeek, Song Liu,
	Tony Jones, Travis Downs, Yang Wei, Arnaldo Carvalho de Melo


* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> Hi Ingo,
> 
> 	Please consider pulling,
> 
> - Arnaldo
> 
> Test results at the end of this message, as usual.
> 
> The following changes since commit c978b9460fe1d4a1e1effa0abd6bd69b18a098a8:
> 
>   Merge tag 'perf-core-for-mingo-5.1-20190225' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2019-02-28 08:29:50 +0100)
> 
> are available in the Git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-5.1-20190307
> 
> for you to fetch changes up to b8f7d86b5849ea7bb84bddc0345a3799049764d4:
> 
>   perf data: Force perf_data__open|close zero data->file.path (2019-03-06 18:21:00 -0300)
> 
> ----------------------------------------------------------------
> perf bpf:
> 
>   Arnaldo Carvalho de Melo:
> 
>   - Automatically add BTF ELF markers to 'perf trace' BPF programs, so that
>     tools such as 'bpftool map dump' can pretty print map keys and values.
> 
> perf c2c:
> 
>   Jiri Olsa:
> 
>   - Fix report for empty NUMA node.
> 
> perf diff:
> 
>   Jin Yao:
> 
>   - Support --time, --cpu, --pid and --tid filter options.
> 
> perf probe:
> 
>   Arnaldo Carvalho de Melo:
> 
>   - Clarify error message about not finding kernel modules debuginfo.
> 
> perf record:
> 
>   Jiri Olsa:
> 
>   - Fixup probing for max attr.precise_ip.
> 
> perf trace:
> 
>   Arnaldo Carvalho de Melo:
> 
>   - Add missing %s lost in the 'msg_flags' recvmmsg arg when adding prefix suppression logic.
> 
> perf annotate:
> 
>   Arnaldo Carvalho de Melo:
> 
>   - Calculate the max instruction name, align column to that, removing the
>     hardcoded max 6 chars and cope with instructions with names longer than that,
>     such as vpmovmskb, vpcmpeqb, etc.
> 
> kernel:
> 
>   Song Liu:
> 
>   - Consider events with attr.bpf_event set as side-band.
> 
>   Gustavo A. R. Silva:
> 
>   - Mark expected switch fall-through in perf_event_parse_addr_filter().
> 
> Libraries:
> 
>   Jiri Olsa:
> 
>   - Fix leaks and double frees on error paths.
> 
> libtraceevent:
> 
>   Tony Jones:
> 
>   - Fix buffer overflow in arg_eval().
> 
> python scripting:
> 
>   Tony Jones:
> 
>   - More python3 fixes.
> 
> Trivial:
> 
>   Yang Wei:
> 
>   - Remove needless extra semicolon in clang C++ glue code.
> 
> Intel PT/BTS:
> 
>   Adrian Hunter:
> 
>   - Improve auxtrace address filter error message when there is no DSO.
> 
>   - Fix divide by zero when TSC is not available.
> 
>   - Further improvements to the export to sqlite/posgresql python scripts
>     and to the GUI sqlviewer, exporting 'parent_id' so that we have enable
>     the creation of call trees.
> 
>   Andi Kleen:
> 
>   - Generalize function to copy from thread addr space from intel-bts code.
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Adrian Hunter (10):
>       perf auxtrace: Improve address filter error message when there is no DSO
>       perf intel-pt: Fix divide by zero when TSC is not available
>       perf db-export: Add calls parent_id to enable creation of call trees
>       perf scripts python: export-to-sqlite.py: Export calls parent_id
>       perf scripts python: export-to-postgresql.py: Fix invalid input syntax for integer error
>       perf scripts python: export-to-postgresql.py: Export calls parent_id
>       perf scripts python: exported-sql-viewer.py: Factor out TreeWindowBase
>       perf scripts python: exported-sql-viewer.py: Improve TreeModel abstraction
>       perf scripts python: exported-sql-viewer.py: Factor out CallGraphModelBase
>       perf scripts python: exported-sql-viewer.py: Add call tree
> 
> Andi Kleen (1):
>       perf thread: Generalize function to copy from thread addr space from intel-bts code
> 
> Arnaldo Carvalho de Melo (4):
>       perf probe: Clarify error message about not finding kernel modules debuginfo
>       perf beauty msg_flags: Add missing %s lost when adding prefix suppression logic
>       perf bpf: Automatically add BTF ELF markers
>       perf annotate: Calculate the max instruction name, align column to that
> 
> Gustavo A. R. Silva (1):
>       perf: Mark expected switch fall-through
> 
> Jin Yao (4):
>       perf time-utils: Refactor time range parsing code
>       perf diff: Support --time filter option
>       perf diff: Support --cpu filter option
>       perf diff: Support --pid/--tid filter options
> 
> Jiri Olsa (7):
>       perf c2c: Fix c2c report for empty numa node
>       perf hist: Add error path into hist_entry__init
>       perf hist: Fix memory leak of srcline
>       perf tools: Read and store caps/max_precise in perf_pmu
>       perf evsel: Probe for precise_ip with simple attr
>       perf session: Fix double free in perf_data__close
>       perf data: Force perf_data__open|close zero data->file.path
> 
> Song Liu (1):
>       perf, bpf: Consider events with attr.bpf_event as side-band events
> 
> Tony Jones (6):
>       tools lib traceevent: Fix buffer overflow in arg_eval
>       perf script python: Remove mixed indentation
>       perf script python: Add Python3 support to futex-contention.py
>       perf script python: add Python3 support to check-perf-trace.py
>       perf script python: Add Python3 support to event_analyzing_sample.py
>       perf script python: Add Python3 support to intel-pt-events.py
> 
> Yang Wei (1):
>       perf clang: Remove needless extra semicolon
> 
>  kernel/events/core.c                               |   4 +-
>  tools/lib/traceevent/event-parse.c                 |   2 +-
>  tools/perf/Documentation/perf-diff.txt             |  56 ++++
>  tools/perf/arch/arm64/annotate/instructions.c      |   2 +-
>  tools/perf/arch/s390/annotate/instructions.c       |   2 +-
>  tools/perf/builtin-c2c.c                           |   8 +-
>  tools/perf/builtin-diff.c                          | 168 +++++++++-
>  tools/perf/builtin-report.c                        |  38 +--
>  tools/perf/builtin-script.c                        |  39 +--
>  tools/perf/include/bpf/bpf.h                       |   8 +-
>  tools/perf/scripts/python/check-perf-trace.py      |  76 ++---
>  tools/perf/scripts/python/compaction-times.py      |   8 +-
>  .../perf/scripts/python/event_analyzing_sample.py  |  48 +--
>  tools/perf/scripts/python/export-to-postgresql.py  |  16 +-
>  tools/perf/scripts/python/export-to-sqlite.py      |  12 +-
>  tools/perf/scripts/python/exported-sql-viewer.py   | 354 ++++++++++++++++-----
>  .../perf/scripts/python/failed-syscalls-by-pid.py  |  38 +--
>  tools/perf/scripts/python/futex-contention.py      |  10 +-
>  tools/perf/scripts/python/intel-pt-events.py       |  60 ++--
>  tools/perf/scripts/python/mem-phys-addr.py         |   7 +-
>  tools/perf/scripts/python/net_dropmonitor.py       |   2 +-
>  tools/perf/scripts/python/netdev-times.py          |  12 +-
>  tools/perf/scripts/python/sched-migration.py       |   6 +-
>  tools/perf/scripts/python/sctop.py                 |  13 +-
>  tools/perf/scripts/python/stackcollapse.py         |   2 +-
>  tools/perf/scripts/python/syscall-counts-by-pid.py |  47 ++-
>  tools/perf/scripts/python/syscall-counts.py        |  31 +-
>  tools/perf/trace/beauty/msg_flags.c                |   2 +-
>  tools/perf/util/annotate.c                         |  74 +++--
>  tools/perf/util/annotate.h                         |   7 +-
>  tools/perf/util/auxtrace.c                         |   3 +-
>  tools/perf/util/c++/clang.cpp                      |   2 +-
>  tools/perf/util/data.c                             |   4 +-
>  tools/perf/util/db-export.c                        |  15 +-
>  tools/perf/util/db-export.h                        |   3 +-
>  tools/perf/util/evlist.c                           |  25 +-
>  tools/perf/util/evsel.c                            |   8 -
>  tools/perf/util/hist.c                             |  51 +--
>  tools/perf/util/intel-bts.c                        |  20 +-
>  tools/perf/util/intel-pt.c                         |   2 +
>  tools/perf/util/pmu.c                              |  14 +
>  tools/perf/util/pmu.h                              |   1 +
>  tools/perf/util/probe-event.c                      |   9 +-
>  .../util/scripting-engines/trace-event-python.c    |   8 +-
>  tools/perf/util/session.c                          |   4 +-
>  tools/perf/util/thread-stack.c                     |  16 +-
>  tools/perf/util/thread-stack.h                     |   6 +-
>  tools/perf/util/thread.c                           |  23 ++
>  tools/perf/util/thread.h                           |   3 +
>  tools/perf/util/time-utils.c                       |  51 ++-
>  tools/perf/util/time-utils.h                       |   6 +
>  51 files changed, 978 insertions(+), 448 deletions(-)

Pulled, thanks a lot Arnaldo!

	Ingo

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [GIT PULL 00/35] perf/core improvements and fixes
  2018-08-15 15:05 Arnaldo Carvalho de Melo
  2018-08-15 15:21 ` Andy Lutomirski
@ 2018-08-18 11:17 ` Ingo Molnar
  1 sibling, 0 replies; 50+ messages in thread
From: Ingo Molnar @ 2018-08-18 11:17 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Clark Williams, linux-kernel, linux-perf-users,
	Arnaldo Carvalho de Melo, Adrian Hunter, Alexander Kapshuk,
	Alexander Shishkin, Andi Kleen, Andrew Morton, Andy Lutomirski,
	Aneesh Kumar, Benno Evers, Dave Hansen, David Ahern,
	Dongjiu Geng, H . Peter Anvin, Jiri Olsa, Joerg Roedel,
	Kim Phillips, Krister Johansen, linux-trace-devel,
	Michael Ellerman, Namhyung Kim, Naveen N . Rao, Peter Zijlstra,
	Ravi Bangoria, Sandipan Das, stable, Steven Rostedt,
	Thomas Gleixner, Tzvetomir Stoyanov, Wang Nan, x86,
	Yordan Karadzhov


* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> From: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> Hi Ingo,
> 
> 	Please consider pulling, this is on top of
> perf-core-for-mingo-4.19-20180809, that is not yet in tip.
> 
> Thanks,
> 
> - Arnaldo
> 
> Test results at the end of this message, as usual.
> 
> The following changes since commit 6a9405b56c274024564f9014bba97b92c91b34d6:
> 
>   perf map: Optimize maps__fixup_overlappings() (2018-08-08 15:56:00 -0300)
> 
> 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.19-20180815
> 
> for you to fetch changes up to 6855dc41b24619c3d1de3dbd27dd0546b0e45272:
> 
>   x86: Add entry trampolines to kcore (2018-08-14 19:13:26 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements ad fixes:
> 
> kernel:
> 
> . kallsyms, x86: Export addresses of PTI entry trampolines (Alexander Shishkin)
> 
> . kallsyms: Simplify update_iter_mod() (Adrian Hunter)
> 
> . x86: Add entry trampolines to kcore (Adrian Hunter)
> 
> Hardware tracing:
> 
> . Fix auxtrace queue resize (Adrian Hunter)
> 
> Arch specific:
> 
> . Fix uninitialized ARM SPE record error variable (Kim Phillips)
> 
> . Fix trace event post-processing in powerpc (Sandipan Das)
> 
> Build:
> 
> . Fix check-headers.sh AND list path of execution (Alexander Kapshuk)
> 
> . Remove -mcet and -fcf-protection when building the python binding
>   with older clang versions (Arnaldo Carvalho de Melo)
> 
> . Make check-headers.sh check based on kernel dir (Jiri Olsa)
> 
> . Move syscall_64.tbl check into check-headers.sh (Jiri Olsa)
> 
> Infrastructure:
> 
> . Check for null when copying nsinfo.  (Benno Evers)
> 
> Libraries:
> 
> . Rename libtraceevent prefixes, prep work for making it a shared
>   library generaly available (Tzvetomir Stoyanov (VMware))
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Adrian Hunter (3):
>       perf auxtrace: Fix queue resize
>       kallsyms: Simplify update_iter_mod()
>       x86: Add entry trampolines to kcore
> 
> Alexander Kapshuk (1):
>       perf tools: Fix check-headers.sh AND list path of execution
> 
> Alexander Shishkin (1):
>       kallsyms, x86: Export addresses of PTI entry trampolines
> 
> Arnaldo Carvalho de Melo (1):
>       perf python: Remove -mcet and -fcf-protection when building with clang
> 
> Benno Evers (1):
>       perf tools: Check for null when copying nsinfo.
> 
> Jiri Olsa (2):
>       perf tools: Make check-headers.sh check based on kernel dir
>       perf tools: Move syscall_64.tbl check into check-headers.sh
> 
> Kim Phillips (1):
>       perf arm spe: Fix uninitialized record error variable
> 
> Sandipan Das (1):
>       perf probe powerpc: Fix trace event post-processing
> 
> Tzvetomir Stoyanov (VMware) (24):
>       tools lib traceevent, perf tools: Rename struct pevent to struct tep_handle
>       tools lib traceevent, perf tools: Rename 'struct pevent_record' to 'struct tep_record'
>       tools lib traceevent, perf tools: Rename pevent plugin related APIs
>       tools lib traceevent, perf tools: Rename pevent alloc / free APIs
>       tools lib traceevent, perf tools: Rename pevent find APIs
>       tools lib traceevent, perf tools: Rename pevent parse APIs
>       tools lib traceevent, perf tools: Rename pevent print APIs
>       tools lib traceevent, perf tools: Rename pevent_read_number_* APIs
>       tools lib traceevent, perf tools: Rename pevent_register_* APIs
>       tools lib traceevent, perf tools: Rename pevent_set_* APIs
>       tools lib traceevent, perf tools: Rename traceevent_* APIs
>       tools lib traceevent, perf tools: Rename 'enum pevent_flag' to 'enum tep_flag'
>       tools lib traceevent, tools lib lockdep: Rename 'enum pevent_errno' to 'enum tep_errno'
>       tools lib traceevent: Rename pevent_function* APIs
>       tools lib traceevent,  perf tools: Rename traceevent_plugin_* APIs
>       tools lib traceevent: Rename pevent_filter* APIs
>       tools lib traceevent: Rename pevent_register / unregister APIs
>       tools lib traceevent: Rename pevent_data_ APIs
>       tools lib traceevent: Rename pevent field APIs
>       tools lib traceevent: Rename pevent_find_* APIs
>       tools lib traceevent: Rename various pevent get/set/is APIs
>       tools lib traceevent: Rename internal parser related APIs
>       tools lib traceevent: Rename various pevent APIs
>       tools lib traceevent: Rename static variables and functions in event-parse.c
> 
>  arch/x86/mm/cpu_entry_area.c                       |  33 +
>  fs/proc/kcore.c                                    |   7 +-
>  include/linux/kcore.h                              |  13 +
>  kernel/kallsyms.c                                  |  51 +-
>  tools/lib/lockdep/Makefile                         |   4 +-
>  tools/lib/traceevent/Makefile                      |   4 +-
>  tools/lib/traceevent/event-parse.c                 | 696 ++++++++++-----------
>  tools/lib/traceevent/event-parse.h                 | 458 +++++++-------
>  tools/lib/traceevent/event-plugin.c                |  70 +--
>  tools/lib/traceevent/parse-filter.c                | 288 ++++-----
>  tools/lib/traceevent/plugin_cfg80211.c             |  20 +-
>  tools/lib/traceevent/plugin_function.c             |  34 +-
>  tools/lib/traceevent/plugin_hrtimer.c              |  56 +-
>  tools/lib/traceevent/plugin_jbd2.c                 |  36 +-
>  tools/lib/traceevent/plugin_kmem.c                 |  66 +-
>  tools/lib/traceevent/plugin_kvm.c                  | 154 ++---
>  tools/lib/traceevent/plugin_mac80211.c             |  28 +-
>  tools/lib/traceevent/plugin_sched_switch.c         |  60 +-
>  tools/lib/traceevent/plugin_scsi.c                 |  24 +-
>  tools/lib/traceevent/plugin_xen.c                  |  20 +-
>  tools/perf/arch/arm64/util/arm-spe.c               |   1 +
>  tools/perf/arch/powerpc/util/sym-handling.c        |   4 +-
>  tools/perf/arch/x86/Makefile                       |   3 -
>  tools/perf/builtin-kmem.c                          |   6 +-
>  tools/perf/builtin-report.c                        |   6 +-
>  tools/perf/builtin-script.c                        |   6 +-
>  tools/perf/check-headers.sh                        |  17 +-
>  tools/perf/util/auxtrace.c                         |   3 +
>  tools/perf/util/data-convert-bt.c                  |   6 +-
>  tools/perf/util/evsel.c                            |   2 +-
>  tools/perf/util/header.c                           |   6 +-
>  tools/perf/util/machine.h                          |   2 +-
>  tools/perf/util/namespaces.c                       |   3 +
>  tools/perf/util/python.c                           |  10 +-
>  .../perf/util/scripting-engines/trace-event-perl.c |   2 +-
>  .../util/scripting-engines/trace-event-python.c    |   6 +-
>  tools/perf/util/setup.py                           |  10 +-
>  tools/perf/util/sort.c                             |  16 +-
>  tools/perf/util/sort.h                             |   2 +-
>  tools/perf/util/trace-event-parse.c                |  34 +-
>  tools/perf/util/trace-event-read.c                 |  44 +-
>  tools/perf/util/trace-event-scripting.c            |   4 +-
>  tools/perf/util/trace-event.c                      |  28 +-
>  tools/perf/util/trace-event.h                      |  20 +-
>  44 files changed, 1230 insertions(+), 1133 deletions(-)

Pulled into perf/urgent, thanks a lot Arnaldo!

	Ingo

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [GIT PULL 00/35] perf/core improvements and fixes
  2018-08-15 15:05 Arnaldo Carvalho de Melo
@ 2018-08-15 15:21 ` Andy Lutomirski
  2018-08-18 11:17 ` Ingo Molnar
  1 sibling, 0 replies; 50+ messages in thread
From: Andy Lutomirski @ 2018-08-15 15:21 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Clark Williams, linux-kernel, linux-perf-users,
	Arnaldo Carvalho de Melo, Adrian Hunter, Alexander Kapshuk,
	Alexander Shishkin, Andi Kleen, Andrew Morton, Andy Lutomirski,
	Aneesh Kumar, Benno Evers, Dave Hansen, David Ahern,
	Dongjiu Geng, H . Peter Anvin, Jiri Olsa, Joerg Roedel,
	Kim Phillips, Krister Johansen, linux-trace-devel,
	Michael Ellerman, Namhyung Kim, Naveen N . Rao, Peter Zijlstra,
	Ravi Bangoria, Sandipan Das, stable, Steven Rostedt,
	Thomas Gleixner, Tzvetomir Stoyanov, Wang Nan, x86,
	Yordan Karadzhov


> On Aug 15, 2018, at 8:05 AM, Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> 
> From: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> Hi Ingo,
> 
>    Please consider pulling, this is on top of
> perf-core-for-mingo-4.19-20180809, that is not yet in tip.
> 
> Thanks,
> 
> - Arnaldo
> 
> Test results at the end of this message, as usual.
> 
> The following changes since commit 6a9405b56c274024564f9014bba97b92c91b34d6:
> 
>  perf map: Optimize maps__fixup_overlappings() (2018-08-08 15:56:00 -0300)
> 
> 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.19-20180815
> 
> for you to fetch changes up to 6855dc41b24619c3d1de3dbd27dd0546b0e45272:
> 
>  x86: Add entry trampolines to kcore

I don’t object per se, but once I finish rebasing and testing my entry trampoline removal code, this will probably have to go.

^ permalink raw reply	[flat|nested] 50+ messages in thread

* [GIT PULL 00/35] perf/core improvements and fixes
@ 2018-08-15 15:05 Arnaldo Carvalho de Melo
  2018-08-15 15:21 ` Andy Lutomirski
  2018-08-18 11:17 ` Ingo Molnar
  0 siblings, 2 replies; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2018-08-15 15:05 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Clark Williams, linux-kernel, linux-perf-users,
	Arnaldo Carvalho de Melo, Adrian Hunter, Alexander Kapshuk,
	Alexander Shishkin, Andi Kleen, Andrew Morton, Andy Lutomirski,
	Aneesh Kumar, Benno Evers, Dave Hansen, David Ahern,
	Dongjiu Geng, H . Peter Anvin, Jiri Olsa, Joerg Roedel,
	Kim Phillips, Krister Johansen, linux-trace-devel,
	Michael Ellerman, Namhyung Kim, Naveen N . Rao, Peter Zijlstra,
	Ravi Bangoria, Sandipan Das, stable, Steven Rostedt,
	Thomas Gleixner, Tzvetomir Stoyanov, Wang Nan, x86,
	Yordan Karadzhov

From: Arnaldo Carvalho de Melo <acme@redhat.com>

Hi Ingo,

	Please consider pulling, this is on top of
perf-core-for-mingo-4.19-20180809, that is not yet in tip.

Thanks,

- Arnaldo

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

The following changes since commit 6a9405b56c274024564f9014bba97b92c91b34d6:

  perf map: Optimize maps__fixup_overlappings() (2018-08-08 15:56:00 -0300)

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.19-20180815

for you to fetch changes up to 6855dc41b24619c3d1de3dbd27dd0546b0e45272:

  x86: Add entry trampolines to kcore (2018-08-14 19:13:26 -0300)

----------------------------------------------------------------
perf/core improvements ad fixes:

kernel:

. kallsyms, x86: Export addresses of PTI entry trampolines (Alexander Shishkin)

. kallsyms: Simplify update_iter_mod() (Adrian Hunter)

. x86: Add entry trampolines to kcore (Adrian Hunter)

Hardware tracing:

. Fix auxtrace queue resize (Adrian Hunter)

Arch specific:

. Fix uninitialized ARM SPE record error variable (Kim Phillips)

. Fix trace event post-processing in powerpc (Sandipan Das)

Build:

. Fix check-headers.sh AND list path of execution (Alexander Kapshuk)

. Remove -mcet and -fcf-protection when building the python binding
  with older clang versions (Arnaldo Carvalho de Melo)

. Make check-headers.sh check based on kernel dir (Jiri Olsa)

. Move syscall_64.tbl check into check-headers.sh (Jiri Olsa)

Infrastructure:

. Check for null when copying nsinfo.  (Benno Evers)

Libraries:

. Rename libtraceevent prefixes, prep work for making it a shared
  library generaly available (Tzvetomir Stoyanov (VMware))

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

----------------------------------------------------------------
Adrian Hunter (3):
      perf auxtrace: Fix queue resize
      kallsyms: Simplify update_iter_mod()
      x86: Add entry trampolines to kcore

Alexander Kapshuk (1):
      perf tools: Fix check-headers.sh AND list path of execution

Alexander Shishkin (1):
      kallsyms, x86: Export addresses of PTI entry trampolines

Arnaldo Carvalho de Melo (1):
      perf python: Remove -mcet and -fcf-protection when building with clang

Benno Evers (1):
      perf tools: Check for null when copying nsinfo.

Jiri Olsa (2):
      perf tools: Make check-headers.sh check based on kernel dir
      perf tools: Move syscall_64.tbl check into check-headers.sh

Kim Phillips (1):
      perf arm spe: Fix uninitialized record error variable

Sandipan Das (1):
      perf probe powerpc: Fix trace event post-processing

Tzvetomir Stoyanov (VMware) (24):
      tools lib traceevent, perf tools: Rename struct pevent to struct tep_handle
      tools lib traceevent, perf tools: Rename 'struct pevent_record' to 'struct tep_record'
      tools lib traceevent, perf tools: Rename pevent plugin related APIs
      tools lib traceevent, perf tools: Rename pevent alloc / free APIs
      tools lib traceevent, perf tools: Rename pevent find APIs
      tools lib traceevent, perf tools: Rename pevent parse APIs
      tools lib traceevent, perf tools: Rename pevent print APIs
      tools lib traceevent, perf tools: Rename pevent_read_number_* APIs
      tools lib traceevent, perf tools: Rename pevent_register_* APIs
      tools lib traceevent, perf tools: Rename pevent_set_* APIs
      tools lib traceevent, perf tools: Rename traceevent_* APIs
      tools lib traceevent, perf tools: Rename 'enum pevent_flag' to 'enum tep_flag'
      tools lib traceevent, tools lib lockdep: Rename 'enum pevent_errno' to 'enum tep_errno'
      tools lib traceevent: Rename pevent_function* APIs
      tools lib traceevent,  perf tools: Rename traceevent_plugin_* APIs
      tools lib traceevent: Rename pevent_filter* APIs
      tools lib traceevent: Rename pevent_register / unregister APIs
      tools lib traceevent: Rename pevent_data_ APIs
      tools lib traceevent: Rename pevent field APIs
      tools lib traceevent: Rename pevent_find_* APIs
      tools lib traceevent: Rename various pevent get/set/is APIs
      tools lib traceevent: Rename internal parser related APIs
      tools lib traceevent: Rename various pevent APIs
      tools lib traceevent: Rename static variables and functions in event-parse.c

 arch/x86/mm/cpu_entry_area.c                       |  33 +
 fs/proc/kcore.c                                    |   7 +-
 include/linux/kcore.h                              |  13 +
 kernel/kallsyms.c                                  |  51 +-
 tools/lib/lockdep/Makefile                         |   4 +-
 tools/lib/traceevent/Makefile                      |   4 +-
 tools/lib/traceevent/event-parse.c                 | 696 ++++++++++-----------
 tools/lib/traceevent/event-parse.h                 | 458 +++++++-------
 tools/lib/traceevent/event-plugin.c                |  70 +--
 tools/lib/traceevent/parse-filter.c                | 288 ++++-----
 tools/lib/traceevent/plugin_cfg80211.c             |  20 +-
 tools/lib/traceevent/plugin_function.c             |  34 +-
 tools/lib/traceevent/plugin_hrtimer.c              |  56 +-
 tools/lib/traceevent/plugin_jbd2.c                 |  36 +-
 tools/lib/traceevent/plugin_kmem.c                 |  66 +-
 tools/lib/traceevent/plugin_kvm.c                  | 154 ++---
 tools/lib/traceevent/plugin_mac80211.c             |  28 +-
 tools/lib/traceevent/plugin_sched_switch.c         |  60 +-
 tools/lib/traceevent/plugin_scsi.c                 |  24 +-
 tools/lib/traceevent/plugin_xen.c                  |  20 +-
 tools/perf/arch/arm64/util/arm-spe.c               |   1 +
 tools/perf/arch/powerpc/util/sym-handling.c        |   4 +-
 tools/perf/arch/x86/Makefile                       |   3 -
 tools/perf/builtin-kmem.c                          |   6 +-
 tools/perf/builtin-report.c                        |   6 +-
 tools/perf/builtin-script.c                        |   6 +-
 tools/perf/check-headers.sh                        |  17 +-
 tools/perf/util/auxtrace.c                         |   3 +
 tools/perf/util/data-convert-bt.c                  |   6 +-
 tools/perf/util/evsel.c                            |   2 +-
 tools/perf/util/header.c                           |   6 +-
 tools/perf/util/machine.h                          |   2 +-
 tools/perf/util/namespaces.c                       |   3 +
 tools/perf/util/python.c                           |  10 +-
 .../perf/util/scripting-engines/trace-event-perl.c |   2 +-
 .../util/scripting-engines/trace-event-python.c    |   6 +-
 tools/perf/util/setup.py                           |  10 +-
 tools/perf/util/sort.c                             |  16 +-
 tools/perf/util/sort.h                             |   2 +-
 tools/perf/util/trace-event-parse.c                |  34 +-
 tools/perf/util/trace-event-read.c                 |  44 +-
 tools/perf/util/trace-event-scripting.c            |   4 +-
 tools/perf/util/trace-event.c                      |  28 +-
 tools/perf/util/trace-event.h                      |  20 +-
 44 files changed, 1230 insertions(+), 1133 deletions(-)

Test results:

The first ones are container (docker) based builds of tools/perf with
and without libelf support.  Where clang is available, it is also used
to build perf with/without libelf, and building with LIBCLANGLLVM=1
(built-in clang) with gcc and clang when clang and its devel libraries
are installed.

The objtool and samples/bpf/ builds are disabled now that I'm switching from
using the sources in a local volume to fetching them from a http server to
build it inside the container, to make it easier to build in a container cluster.
Those will come back later.

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.

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   gcc (Alpine 5.3.0) 5.3.0
   2 alpine:3.5                    : Ok   gcc (Alpine 6.2.1) 6.2.1 20160822
   3 alpine:3.6                    : Ok   gcc (Alpine 6.3.0) 6.3.0
   4 alpine:3.7                    : Ok   gcc (Alpine 6.4.0) 6.4.0
   5 alpine:3.8                    : Ok   gcc (Alpine 6.4.0) 6.4.0
   6 alpine:edge                   : Ok   gcc (Alpine 6.4.0) 6.4.0
   7 amazonlinux:1                 : Ok   gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28)
   8 amazonlinux:2                 : Ok   gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)
   9 android-ndk:r12b-arm          : Ok   arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease)
  10 android-ndk:r15c-arm          : Ok   arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease)
  11 centos:5                      : Ok   gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-55)
  12 centos:6                      : Ok   gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23)
  13 centos:7                      : Ok   gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28)
  14 debian:7                      : Ok   gcc (Debian 4.7.2-5) 4.7.2
  15 debian:8                      : Ok   gcc (Debian 4.9.2-10+deb8u1) 4.9.2
  16 debian:9                      : Ok   gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516
  17 debian:experimental           : Ok   gcc (Debian 8.2.0-1) 8.2.0
  18 debian:experimental-x-arm64   : Ok   aarch64-linux-gnu-gcc (Debian 8.1.0-12) 8.1.0
  19 debian:experimental-x-mips    : Ok   mips-linux-gnu-gcc (Debian 8.1.0-12) 8.1.0
  20 debian:experimental-x-mips64  : Ok   mips64-linux-gnuabi64-gcc (Debian 8.1.0-12) 8.1.0
  21 debian:experimental-x-mipsel  : Ok   mipsel-linux-gnu-gcc (Debian 8.1.0-12) 8.1.0
  22 fedora:20                     : Ok   gcc (GCC) 4.8.3 20140911 (Red Hat 4.8.3-7)
  23 fedora:21                     : Ok   gcc (GCC) 4.9.2 20150212 (Red Hat 4.9.2-6)
  24 fedora:22                     : Ok   gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6)
  25 fedora:23                     : Ok   gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6)
  26 fedora:24                     : Ok   gcc (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1)
  27 fedora:24-x-ARC-uClibc        : Ok   arc-linux-gcc (ARCompact ISA Linux uClibc toolchain 2017.09-rc2) 7.1.1 20170710
  28 fedora:25                     : Ok   gcc (GCC) 6.4.1 20170727 (Red Hat 6.4.1-1)
  29 fedora:26                     : Ok   gcc (GCC) 7.3.1 20180130 (Red Hat 7.3.1-2)
  30 fedora:27                     : Ok   gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-6)
  31 fedora:28                     : Ok   gcc (GCC) 8.1.1 20180712 (Red Hat 8.1.1-5)
  32 fedora:rawhide                : Ok   gcc (GCC) 8.0.1 20180324 (Red Hat 8.0.1-0.20)
  33 gentoo-stage3-amd64:latest    : Ok   gcc (Gentoo 7.3.0-r3 p1.4) 7.3.0
  34 mageia:5                      : Ok   gcc (GCC) 4.9.2
  35 mageia:6                      : Ok   gcc (Mageia 5.5.0-1.mga6) 5.5.0
  36 opensuse:13.2                 : Ok   gcc (SUSE Linux) 4.8.3 20140627 [gcc-4_8-branch revision 212064]
  37 opensuse:42.1                 : Ok   gcc (SUSE Linux) 4.8.5
  38 opensuse:42.2                 : Ok   gcc (SUSE Linux) 4.8.5
  39 opensuse:42.3                 : Ok   gcc (SUSE Linux) 4.8.5
  40 opensuse:tumbleweed           : Ok   gcc (SUSE Linux) 7.3.1 20180323 [gcc-7-branch revision 258812]
  41 oraclelinux:6                 : Ok   gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23.0.1)
  42 oraclelinux:7                 : Ok   gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28.0.1)
  43 ubuntu:12.04.5                : Ok   gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
  44 ubuntu:14.04.4                : Ok   gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
  45 ubuntu:14.04.4-x-linaro-arm64 : Ok   aarch64-linux-gnu-gcc (Linaro GCC 5.5-2017.10) 5.5.0
  46 ubuntu:16.04                  : Ok   gcc (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609
  47 ubuntu:16.04-x-arm            : Ok   arm-linux-gnueabihf-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
  48 ubuntu:16.04-x-arm64          : Ok   aarch64-linux-gnu-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
  49 ubuntu:16.04-x-powerpc        : Ok   powerpc-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
  50 ubuntu:16.04-x-powerpc64      : Ok   powerpc64-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
  51 ubuntu:16.04-x-powerpc64el    : Ok   powerpc64le-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
  52 ubuntu:16.04-x-s390           : Ok   s390x-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
  53 ubuntu:16.10                  : Ok   gcc (Ubuntu 6.2.0-5ubuntu12) 6.2.0 20161005
  54 ubuntu:17.10                  : Ok   gcc (Ubuntu 7.2.0-8ubuntu3.2) 7.2.0
  55 ubuntu:18.04                  : Ok   gcc (Ubuntu 7.3.0-16ubuntu3) 7.3.0
  56 ubuntu:18.04-x-arm            : Ok   arm-linux-gnueabihf-gcc (Ubuntu/Linaro 7.3.0-16ubuntu3) 7.3.0
  57 ubuntu:18.04-x-arm64          : Ok   aarch64-linux-gnu-gcc (Ubuntu/Linaro 7.3.0-16ubuntu3) 7.3.0
  58 ubuntu:18.04-x-m68k           : Ok   m68k-linux-gnu-gcc (Ubuntu 7.3.0-16ubuntu3) 7.3.0
  59 ubuntu:18.04-x-powerpc        : Ok   powerpc-linux-gnu-gcc (Ubuntu 7.3.0-16ubuntu3) 7.3.0
  60 ubuntu:18.04-x-powerpc64      : Ok   powerpc64-linux-gnu-gcc (Ubuntu 7.3.0-16ubuntu3) 7.3.0
  61 ubuntu:18.04-x-powerpc64el    : Ok   powerpc64le-linux-gnu-gcc (Ubuntu 7.3.0-16ubuntu3) 7.3.0
  62 ubuntu:18.04-x-riscv64        : Ok   riscv64-linux-gnu-gcc (Ubuntu 7.3.0-16ubuntu3) 7.3.0
  63 ubuntu:18.04-x-s390           : Ok   s390x-linux-gnu-gcc (Ubuntu 7.3.0-16ubuntu3) 7.3.0
  64 ubuntu:18.04-x-sh4            : Ok   sh4-linux-gnu-gcc (Ubuntu 7.3.0-16ubuntu3) 7.3.0
  65 ubuntu:18.04-x-sparc64        : Ok   sparc64-linux-gnu-gcc (Ubuntu 7.3.0-16ubuntu3) 7.3.0
  66 ubuntu:18.10                  : Ok   gcc (Ubuntu 8.2.0-1ubuntu2) 8.2.0
  # 

  # uname -a
  Linux seventh 4.18.0-rc8-00002-g1236568ee3cb #1 SMP Wed Aug 8 09:39:17 -03 2018 x86_64 x86_64 x86_64 GNU/Linux
  # git log --oneline -1
  6855dc41b246 (HEAD -> perf/core) x86: Add entry trampolines to kcore
  # perf version --build-options
  perf version 4.18.rc7.g6855dc
                   dwarf: [ on  ]  # HAVE_DWARF_SUPPORT
      dwarf_getlocations: [ on  ]  # HAVE_DWARF_GETLOCATIONS_SUPPORT
                   glibc: [ on  ]  # HAVE_GLIBC_SUPPORT
                    gtk2: [ on  ]  # HAVE_GTK2_SUPPORT
           syscall_table: [ on  ]  # HAVE_SYSCALL_TABLE_SUPPORT
                  libbfd: [ on  ]  # HAVE_LIBBFD_SUPPORT
                  libelf: [ on  ]  # HAVE_LIBELF_SUPPORT
                 libnuma: [ on  ]  # HAVE_LIBNUMA_SUPPORT
  numa_num_possible_cpus: [ on  ]  # HAVE_LIBNUMA_SUPPORT
                 libperl: [ on  ]  # HAVE_LIBPERL_SUPPORT
               libpython: [ on  ]  # HAVE_LIBPYTHON_SUPPORT
                libslang: [ on  ]  # HAVE_SLANG_SUPPORT
               libcrypto: [ on  ]  # HAVE_LIBCRYPTO_SUPPORT
               libunwind: [ on  ]  # HAVE_LIBUNWIND_SUPPORT
      libdw-dwarf-unwind: [ on  ]  # HAVE_DWARF_SUPPORT
                    zlib: [ on  ]  # HAVE_ZLIB_SUPPORT
                    lzma: [ on  ]  # HAVE_LZMA_SUPPORT
               get_cpuid: [ on  ]  # HAVE_AUXTRACE_SUPPORT
                     bpf: [ on  ]  # HAVE_LIBBPF_SUPPORT
  # 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: Test data source output                               : Ok
   6: Parse event definition strings                        : Ok
   7: Simple expression parser                              : Ok
   8: PERF_RECORD_* events & perf_sample fields             : Ok
   9: Parse perf pmu format                                 : Ok
  10: DSO data read                                         : Ok
  11: DSO data cache                                        : Ok
  12: DSO data reopen                                       : Ok
  13: Roundtrip evsel->name                                 : Ok
  14: Parse sched tracepoints fields                        : Ok
  15: syscalls:sys_enter_openat event fields                : Ok
  16: Setup struct perf_event_attr                          : Ok
  17: Match and link multiple hists                         : Ok
  18: 'import perf' in python                               : Ok
  19: Breakpoint overflow signal handler                    : Ok
  20: Breakpoint overflow sampling                          : Ok
  21: Breakpoint accounting                                 : Ok
  22: Number of exit events of a simple workload            : Ok
  23: Software clock events period values                   : Ok
  24: Object code reading                                   : Ok
  25: Sample parsing                                        : Ok
  26: Use a dummy software event to keep tracking           : Ok
  27: Parse with no sample_id_all bit set                   : Ok
  28: Filter hist entries                                   : Ok
  29: Lookup mmap thread                                    : Ok
  30: Share thread mg                                       : Ok
  31: Sort output of hist entries                           : Ok
  32: Cumulate child hist entries                           : Ok
  33: Track with sched_switch                               : Ok
  34: Filter fds with revents mask in a fdarray             : Ok
  35: Add fd to a fdarray, making it autogrow               : Ok
  36: kmod_path__parse                                      : Ok
  37: Thread map                                            : Ok
  38: LLVM search and compile                               :
  38.1: Basic BPF llvm compile                              : Ok
  38.2: kbuild searching                                    : Ok
  38.3: Compile source for BPF prologue generation          : Ok
  38.4: Compile source for BPF relocation                   : Ok
  39: Session topology                                      : Ok
  40: BPF filter                                            :
  40.1: Basic BPF filtering                                 : Ok
  40.2: BPF pinning                                         : Ok
  40.3: BPF prologue generation                             : Ok
  40.4: BPF relocation checker                              : Ok
  41: Synthesize thread map                                 : Ok
  42: Remove thread map                                     : Ok
  43: Synthesize cpu map                                    : Ok
  44: Synthesize stat config                                : Ok
  45: Synthesize stat                                       : Ok
  46: Synthesize stat round                                 : Ok
  47: Synthesize attr update                                : Ok
  48: Event times                                           : Ok
  49: Read backward ring buffer                             : Ok
  50: Print cpu map                                         : Ok
  51: Probe SDT events                                      : Ok
  52: is_printable_array                                    : Ok
  53: Print bitmap                                          : Ok
  54: perf hooks                                            : Ok
  55: builtin clang support                                 : Skip (not compiled in)
  56: unit_number__scnprintf                                : Ok
  57: mem2node                                              : Ok
  58: x86 rdpmc                                             : Ok
  59: Convert perf time to TSC                              : Ok
  60: DWARF unwind                                          : Ok
  61: x86 instruction decoder - new instructions            : Ok
  62: probe libc's inet_pton & backtrace it with ping       : Ok
  63: Check open filename arg using perf trace + vfs_getname: Ok
  64: Use vfs_getname probe to get syscall args filenames   : Ok
  65: Add vfs_getname probe to get syscall args filenames   : Ok
  # 
  
  $ make -C tools/perf build-test
  make: Entering directory '/home/acme/git/perf/tools/perf'
  - tarpkg: ./tests/perf-targz-src-pkg .
            make_no_libaudit_O: make NO_LIBAUDIT=1
                   make_tags_O: make tags
                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_libelf_O: make NO_LIBELF=1
              make_no_libbpf_O: make NO_LIBBPF=1
             make_util_map_o_O: make util/map.o
                    make_doc_O: make doc
   make_install_prefix_slash_O: make install prefix=/tmp/krava/
  make_no_libdw_dwarf_unwind_O: make NO_LIBDW_DWARF_UNWIND=1
            make_no_demangle_O: make NO_DEMANGLE=1
                 make_static_O: make LDFLAGS=-static
                make_install_O: make install
         make_with_clangllvm_O: make LIBCLANGLLVM=1
            make_install_bin_O: make install-bin
           make_no_libunwind_O: make NO_LIBUNWIND=1
                  make_no_ui_O: make NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
               make_no_slang_O: make NO_SLANG=1
           make_no_libpython_O: make NO_LIBPYTHON=1
                make_no_gtk2_O: make NO_GTK2=1
           make_no_libbionic_O: make NO_LIBBIONIC=1
         make_install_prefix_O: make install prefix=/tmp/krava
                  make_debug_O: make DEBUG=1
             make_no_libperl_O: make NO_LIBPERL=1
                   make_pure_O: make
             make_no_libnuma_O: make NO_LIBNUMA=1
       make_util_pmu_bison_o_O: make util/pmu-bison.o
                   make_help_O: make help
                make_no_newt_O: make NO_NEWT=1
           make_no_backtrace_O: make NO_BACKTRACE=1
              make_clean_all_O: make clean all
            make_no_auxtrace_O: make NO_AUXTRACE=1
             make_no_scripts_O: make NO_LIBPYTHON=1 NO_LIBPERL=1
                 make_perf_o_O: make perf.o
        make_with_babeltrace_O: make LIBBABELTRACE=1
  OK
  make: Leaving directory '/home/acme/git/perf/tools/perf'
  $ 

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [GIT PULL 00/35] perf/core improvements and fixes
  2017-12-28 14:29 Arnaldo Carvalho de Melo
@ 2017-12-28 15:17 ` Ingo Molnar
  0 siblings, 0 replies; 50+ messages in thread
From: Ingo Molnar @ 2017-12-28 15:17 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, linux-perf-users, Adrian Hunter,
	Alexander Shishkin, Andi Kleen, bhargavb, Cheng Jian,
	David Ahern, David S . Miller, Ganapatrao Kulkarni,
	Greg Kroah-Hartman, Heiko Carstens, Hendrik Brueckner, Jin Yao,
	Jiri Olsa, Jonathan Hermann, Kan Liang, Kim Phillips, Li Bin,
	linux-arm-kernel, linux-rt-users, linux s390 list,
	Martin Schwidefsky, Masami Hiramatsu, Mengting Zhang,
	Michael Petlan, Namhyung Kim, Naveen N . Rao, Paul Clarke,
	Peter Zijlstra, Pravin Shedge, Ravi Bangoria, Steven Rostedt,
	Thomas Gleixner, Thomas Richter, Wang Nan, Will Deacon,
	Arnaldo Carvalho de Melo


* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> Hi Ingo,
> 
> 	Please consider pulling,
> 
> - Arnaldo
> 
> 
> Test results at the end of this message, as usual.
> 
> The following changes since commit faaf95677f33dac910b6cbe917cabea43c8c1616:
> 
>   Merge branch 'perf/urgent' into perf/core, to pick up fixes (2017-12-18 18:13:00 +0100)
> 
> 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.16-20171227
> 
> for you to fetch changes up to 5d4fd9c8b83b36d34521b3af361a5726899045bf:
> 
>   perf tools: Auto-complete for events with ':' (2017-12-27 12:16:00 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> - Allow system wide 'perf stat --per-thread', sorting the result (Jin Yao)
> 
>   E.g.:
> 
>   [root@jouet ~]# perf stat --per-thread --metrics IPC
>   ^C
>    Performance counter stats for 'system wide':
> 
>               make-22229  23,012,094,032  inst_retired.any   #  0.8 IPC
>                cc1-22419     692,027,497  inst_retired.any   #  0.8 IPC
>                gcc-22418     328,231,855  inst_retired.any   #  0.9 IPC
>                cc1-22509     220,853,647  inst_retired.any   #  0.8 IPC
>                gcc-22486     199,874,810  inst_retired.any   #  1.0 IPC
>                 as-22466     177,896,365  inst_retired.any   #  0.9 IPC
>                cc1-22465     150,732,374  inst_retired.any   #  0.8 IPC
>                gcc-22508     112,555,593  inst_retired.any   #  0.9 IPC
>                cc1-22487     108,964,079  inst_retired.any   #  0.7 IPC
>    qemu-system-x86-2697       21,330,550  inst_retired.any   #  0.3 IPC
>    systemd-journal-551        20,642,951  inst_retired.any   #  0.4 IPC
>    docker-containe-17651       9,552,892  inst_retired.any   #  0.5 IPC
>    dockerd-current-9809        7,528,586  inst_retired.any   #  0.5 IPC
>               make-22153  12,504,194,380  inst_retired.any   #  0.8 IPC
>            python2-22429  12,081,290,954  inst_retired.any   #  0.8 IPC
>   <SNIP>
>            python2-22429  15,026,328,103  cpu_clk_unhalted.thread
>                cc1-22419     826,660,193  cpu_clk_unhalted.thread
>                gcc-22418     365,321,295  cpu_clk_unhalted.thread
>                cc1-22509     279,169,362  cpu_clk_unhalted.thread
>                gcc-22486     210,156,950  cpu_clk_unhalted.thread
>   <SNIP>
> 
>        5.638075538 seconds time elapsed
> 
>   [root@jouet ~]#
> 
> - Improve shell auto-completion of perf events (Jin Yao)
> 
> -  Fix symbol fixup issues in arm64 due to ELF type (Kim Phillips)
> 
> - Ignore threads when they vanish after procfs based enumeration and
>   before we try to use them with sys_perf_event_open(), i.e. just remove
>   them from the thread_map and continue with the rest. This makes, among
>   other cases, the previous new feature (perf stat --per-thread for system
>   wide, albeit that not seeming to be the motivation for this patch) more
>   robust. (Mengting Zhang)
> 
> - Generate s390 syscall table from asm/unistd.h, doing like x86,
>   removing the dependency on audit-libs to do this id->string translation,
>   speeding up the support for newly introducted syscalls (Hendrik Brueckner)
> 
> - Fix 'perf test' on filesystems where readdir() returns d_type == DT_UNKNOWN,
>   such as XFS (Jiri Olsa)
> 
> - Fix PERF_SAMPLE_RAW_DATA endianity handling for cross-arch tracepoint
>   processing (Jiri Olsa)
> 
> - Add __return suffix for return events in 'perf probe', streamlining
>   entry/exit tracing (Masami Hiramatsu)
> 
> - Improve support for versioned symbols in 'perf probe" (Masami Hiramatsu)
> 
> - Clarify error message about invalid 'perf probe' event names (Masami Hiramatsu)
> 
> - Fix check open filename arg using 'perf trace' in a 'perf test' entry for
>   systems using glibc >= 2.26, such as some ARM and s390 distros (Michael Petlan)
> 
> - Make method for obtaining the (normalized) architecture id for a
>   perf.data file or for the running system used by the annotation routines
>   generally available, next user will be for generating per arch errno
>   string tables to allow for pretty printing errno codes recorded in a
>   perf.data file in architecture A to be properly decoded on hardware
>   archictecture B.  (Arnaldo Carvalho de Melo)
> 
> - Remove duplicate includes, found using scripts/checkincludes.pl (Pravin Shedge)
> 
> - s390 needs -fPIC, enable it, also revert a patch that supposedly did
>   that but instead enabled -fPIC for x86 (Hendrik Brueckner, Arnaldo Carvalho de Melo)
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Arnaldo Carvalho de Melo (4):
>       perf annotate: Get the cpuid from evsel->evlist->env in symbol__annotate()
>       perf annotate: Use perf_env when obtaining the arch name
>       perf env: Adopt perf_env__arch() from the annotate code
>       Revert "perf s390: Always build with -fPIC"
> 
> Hendrik Brueckner (4):
>       tools include s390: Grab a copy of arch/s390/include/uapi/asm/unistd.h
>       perf s390: Generate system call table from asm/unistd.h
>       perf trace: Use generated syscall table on s390 too
>       perf s390: Always build with -fPIC
> 
> Jin Yao (14):
>       perf stat: Define a structure for per-thread shadow stats
>       perf stat: Extend rbtree to support per-thread shadow stats
>       perf stat: Create the runtime_stat init/exit function
>       perf stat: Update per-thread shadow stats
>       perf stat: Print per-thread shadow stats
>       perf stat: Remove a set of shadow stats static variables
>       perf stat: Allocate shadow stats buffer for threads
>       perf stat: Update or print per-thread stats
>       perf thread_map: Enumerate all threads from /proc
>       perf stat: Remove --per-thread pid/tid limitation
>       perf stat: Resort '--per-thread' result
>       perf tool: Improve bash command line auto-complete for multiple events with comma
>       perf tools: Return all events as auto-completions after comma
>       perf tools: Auto-complete for events with ':'
> 
> Jiri Olsa (3):
>       perf utils: Move is_directory() to path.h
>       perf test: Handle properly readdir DT_UNKNOWN
>       perf evsel: Fix swap for samples with raw data
> 
> Kim Phillips (1):
>       perf probe arm64: Fix symbol fixup issues due to ELF type
> 
> Masami Hiramatsu (6):
>       perf probe: Add warning message if there is unexpected event name
>       perf probe: Cut off the version suffix from event name
>       perf probe: Add __return suffix for return events
>       perf probe: Find versioned symbols from map
>       perf string: Add {strdup,strpbrk}_esc()
>       perf probe: Support escaped character in parser
> 
> Mengting Zhang (1):
>       perf evsel: Enable ignore_missing_thread for pid option
> 
> Michael Petlan (1):
>       perf test shell: Fix check open filename arg using 'perf trace'
> 
> Pravin Shedge (1):
>       perf perf: Remove duplicate includes
> 
>  tools/arch/s390/include/uapi/asm/unistd.h          | 412 ++++++++++++++++++++
>  tools/perf/Documentation/perf-probe.txt            |  18 +-
>  tools/perf/Makefile.config                         |  11 +-
>  tools/perf/arch/arm64/util/Build                   |   1 +
>  tools/perf/arch/arm64/util/sym-handling.c          |  22 ++
>  tools/perf/arch/common.c                           |  44 +--
>  tools/perf/arch/common.h                           |   1 -
>  tools/perf/arch/powerpc/util/sym-handling.c        |   8 +
>  tools/perf/arch/s390/Makefile                      |  21 ++
>  tools/perf/arch/s390/entry/syscalls/mksyscalltbl   |  36 ++
>  tools/perf/bench/futex-hash.c                      |   1 -
>  tools/perf/builtin-c2c.c                           |   3 -
>  tools/perf/builtin-record.c                        |   5 +-
>  tools/perf/builtin-script.c                        |  20 +-
>  tools/perf/builtin-stat.c                          | 168 +++++++--
>  tools/perf/builtin-top.c                           |   2 +-
>  tools/perf/check-headers.sh                        |   1 +
>  tools/perf/perf-completion.sh                      |  47 ++-
>  tools/perf/tests/builtin-test.c                    |  10 +-
>  tools/perf/tests/parse-events.c                    |   1 -
>  tools/perf/tests/shell/trace+probe_vfs_getname.sh  |   7 +-
>  tools/perf/tests/thread-map.c                      |   2 +-
>  tools/perf/ui/browsers/annotate.c                  |   4 +-
>  tools/perf/ui/gtk/annotate.c                       |   2 +-
>  tools/perf/util/annotate.c                         |  26 +-
>  tools/perf/util/annotate.h                         |   2 +-
>  tools/perf/util/auxtrace.c                         |   3 -
>  tools/perf/util/env.c                              |  47 +++
>  tools/perf/util/env.h                              |   2 +
>  tools/perf/util/evlist.c                           |   3 +-
>  tools/perf/util/evsel.c                            |  80 +++-
>  tools/perf/util/evsel.h                            |   3 +-
>  tools/perf/util/header.c                           |   2 -
>  tools/perf/util/metricgroup.c                      |   2 -
>  tools/perf/util/path.c                             |  14 +
>  tools/perf/util/path.h                             |   3 +
>  tools/perf/util/probe-event.c                      |  85 +++--
>  tools/perf/util/python-ext-sources                 |   1 +
>  .../util/scripting-engines/trace-event-python.c    |   1 -
>  tools/perf/util/stat-shadow.c                      | 416 ++++++++++++---------
>  tools/perf/util/stat.c                             |  15 +-
>  tools/perf/util/stat.h                             |  63 +++-
>  tools/perf/util/string.c                           |  46 +++
>  tools/perf/util/string2.h                          |   2 +
>  tools/perf/util/symbol.c                           |   5 +
>  tools/perf/util/symbol.h                           |   1 +
>  tools/perf/util/syscalltbl.c                       |   4 +
>  tools/perf/util/target.h                           |   7 +
>  tools/perf/util/thread_map.c                       |   5 +-
>  tools/perf/util/thread_map.h                       |   2 +-
>  tools/perf/util/unwind-libunwind.c                 |   4 +-
>  51 files changed, 1328 insertions(+), 363 deletions(-)
>  create mode 100644 tools/arch/s390/include/uapi/asm/unistd.h
>  create mode 100644 tools/perf/arch/arm64/util/sym-handling.c
>  create mode 100755 tools/perf/arch/s390/entry/syscalls/mksyscalltbl

Pulled, thanks a lot Arnaldo!

	Ingo

^ permalink raw reply	[flat|nested] 50+ messages in thread

* [GIT PULL 00/35] perf/core improvements and fixes
@ 2017-12-28 14:29 Arnaldo Carvalho de Melo
  2017-12-28 15:17 ` Ingo Molnar
  0 siblings, 1 reply; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-12-28 14:29 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, linux-perf-users, Arnaldo Carvalho de Melo,
	Adrian Hunter, Alexander Shishkin, Andi Kleen, bhargavb,
	Cheng Jian, David Ahern, David S . Miller, Ganapatrao Kulkarni,
	Greg Kroah-Hartman, Heiko Carstens, Hendrik Brueckner, Jin Yao,
	Jiri Olsa, Jonathan Hermann, Kan Liang, Kim Phillips, Li Bin,
	linux-arm-kernel, linux-rt-users, linux s390 list,
	Martin Schwidefsky, Masami Hiramatsu, Mengting Zhang,
	Michael Petlan, Namhyung Kim, Naveen N . Rao, Paul Clarke,
	Peter Zijlstra, Pravin Shedge, Ravi Bangoria, Steven Rostedt,
	Thomas Gleixner, Thomas Richter, Wang Nan, Will Deacon,
	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 faaf95677f33dac910b6cbe917cabea43c8c1616:

  Merge branch 'perf/urgent' into perf/core, to pick up fixes (2017-12-18 18:13:00 +0100)

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.16-20171227

for you to fetch changes up to 5d4fd9c8b83b36d34521b3af361a5726899045bf:

  perf tools: Auto-complete for events with ':' (2017-12-27 12:16:00 -0300)

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

- Allow system wide 'perf stat --per-thread', sorting the result (Jin Yao)

  E.g.:

  [root@jouet ~]# perf stat --per-thread --metrics IPC
  ^C
   Performance counter stats for 'system wide':

              make-22229  23,012,094,032  inst_retired.any   #  0.8 IPC
               cc1-22419     692,027,497  inst_retired.any   #  0.8 IPC
               gcc-22418     328,231,855  inst_retired.any   #  0.9 IPC
               cc1-22509     220,853,647  inst_retired.any   #  0.8 IPC
               gcc-22486     199,874,810  inst_retired.any   #  1.0 IPC
                as-22466     177,896,365  inst_retired.any   #  0.9 IPC
               cc1-22465     150,732,374  inst_retired.any   #  0.8 IPC
               gcc-22508     112,555,593  inst_retired.any   #  0.9 IPC
               cc1-22487     108,964,079  inst_retired.any   #  0.7 IPC
   qemu-system-x86-2697       21,330,550  inst_retired.any   #  0.3 IPC
   systemd-journal-551        20,642,951  inst_retired.any   #  0.4 IPC
   docker-containe-17651       9,552,892  inst_retired.any   #  0.5 IPC
   dockerd-current-9809        7,528,586  inst_retired.any   #  0.5 IPC
              make-22153  12,504,194,380  inst_retired.any   #  0.8 IPC
           python2-22429  12,081,290,954  inst_retired.any   #  0.8 IPC
  <SNIP>
           python2-22429  15,026,328,103  cpu_clk_unhalted.thread
               cc1-22419     826,660,193  cpu_clk_unhalted.thread
               gcc-22418     365,321,295  cpu_clk_unhalted.thread
               cc1-22509     279,169,362  cpu_clk_unhalted.thread
               gcc-22486     210,156,950  cpu_clk_unhalted.thread
  <SNIP>

       5.638075538 seconds time elapsed

  [root@jouet ~]#

- Improve shell auto-completion of perf events (Jin Yao)

-  Fix symbol fixup issues in arm64 due to ELF type (Kim Phillips)

- Ignore threads when they vanish after procfs based enumeration and
  before we try to use them with sys_perf_event_open(), i.e. just remove
  them from the thread_map and continue with the rest. This makes, among
  other cases, the previous new feature (perf stat --per-thread for system
  wide, albeit that not seeming to be the motivation for this patch) more
  robust. (Mengting Zhang)

- Generate s390 syscall table from asm/unistd.h, doing like x86,
  removing the dependency on audit-libs to do this id->string translation,
  speeding up the support for newly introducted syscalls (Hendrik Brueckner)

- Fix 'perf test' on filesystems where readdir() returns d_type == DT_UNKNOWN,
  such as XFS (Jiri Olsa)

- Fix PERF_SAMPLE_RAW_DATA endianity handling for cross-arch tracepoint
  processing (Jiri Olsa)

- Add __return suffix for return events in 'perf probe', streamlining
  entry/exit tracing (Masami Hiramatsu)

- Improve support for versioned symbols in 'perf probe" (Masami Hiramatsu)

- Clarify error message about invalid 'perf probe' event names (Masami Hiramatsu)

- Fix check open filename arg using 'perf trace' in a 'perf test' entry for
  systems using glibc >= 2.26, such as some ARM and s390 distros (Michael Petlan)

- Make method for obtaining the (normalized) architecture id for a
  perf.data file or for the running system used by the annotation routines
  generally available, next user will be for generating per arch errno
  string tables to allow for pretty printing errno codes recorded in a
  perf.data file in architecture A to be properly decoded on hardware
  archictecture B.  (Arnaldo Carvalho de Melo)

- Remove duplicate includes, found using scripts/checkincludes.pl (Pravin Shedge)

- s390 needs -fPIC, enable it, also revert a patch that supposedly did
  that but instead enabled -fPIC for x86 (Hendrik Brueckner, Arnaldo Carvalho de Melo)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

----------------------------------------------------------------
Arnaldo Carvalho de Melo (4):
      perf annotate: Get the cpuid from evsel->evlist->env in symbol__annotate()
      perf annotate: Use perf_env when obtaining the arch name
      perf env: Adopt perf_env__arch() from the annotate code
      Revert "perf s390: Always build with -fPIC"

Hendrik Brueckner (4):
      tools include s390: Grab a copy of arch/s390/include/uapi/asm/unistd.h
      perf s390: Generate system call table from asm/unistd.h
      perf trace: Use generated syscall table on s390 too
      perf s390: Always build with -fPIC

Jin Yao (14):
      perf stat: Define a structure for per-thread shadow stats
      perf stat: Extend rbtree to support per-thread shadow stats
      perf stat: Create the runtime_stat init/exit function
      perf stat: Update per-thread shadow stats
      perf stat: Print per-thread shadow stats
      perf stat: Remove a set of shadow stats static variables
      perf stat: Allocate shadow stats buffer for threads
      perf stat: Update or print per-thread stats
      perf thread_map: Enumerate all threads from /proc
      perf stat: Remove --per-thread pid/tid limitation
      perf stat: Resort '--per-thread' result
      perf tool: Improve bash command line auto-complete for multiple events with comma
      perf tools: Return all events as auto-completions after comma
      perf tools: Auto-complete for events with ':'

Jiri Olsa (3):
      perf utils: Move is_directory() to path.h
      perf test: Handle properly readdir DT_UNKNOWN
      perf evsel: Fix swap for samples with raw data

Kim Phillips (1):
      perf probe arm64: Fix symbol fixup issues due to ELF type

Masami Hiramatsu (6):
      perf probe: Add warning message if there is unexpected event name
      perf probe: Cut off the version suffix from event name
      perf probe: Add __return suffix for return events
      perf probe: Find versioned symbols from map
      perf string: Add {strdup,strpbrk}_esc()
      perf probe: Support escaped character in parser

Mengting Zhang (1):
      perf evsel: Enable ignore_missing_thread for pid option

Michael Petlan (1):
      perf test shell: Fix check open filename arg using 'perf trace'

Pravin Shedge (1):
      perf perf: Remove duplicate includes

 tools/arch/s390/include/uapi/asm/unistd.h          | 412 ++++++++++++++++++++
 tools/perf/Documentation/perf-probe.txt            |  18 +-
 tools/perf/Makefile.config                         |  11 +-
 tools/perf/arch/arm64/util/Build                   |   1 +
 tools/perf/arch/arm64/util/sym-handling.c          |  22 ++
 tools/perf/arch/common.c                           |  44 +--
 tools/perf/arch/common.h                           |   1 -
 tools/perf/arch/powerpc/util/sym-handling.c        |   8 +
 tools/perf/arch/s390/Makefile                      |  21 ++
 tools/perf/arch/s390/entry/syscalls/mksyscalltbl   |  36 ++
 tools/perf/bench/futex-hash.c                      |   1 -
 tools/perf/builtin-c2c.c                           |   3 -
 tools/perf/builtin-record.c                        |   5 +-
 tools/perf/builtin-script.c                        |  20 +-
 tools/perf/builtin-stat.c                          | 168 +++++++--
 tools/perf/builtin-top.c                           |   2 +-
 tools/perf/check-headers.sh                        |   1 +
 tools/perf/perf-completion.sh                      |  47 ++-
 tools/perf/tests/builtin-test.c                    |  10 +-
 tools/perf/tests/parse-events.c                    |   1 -
 tools/perf/tests/shell/trace+probe_vfs_getname.sh  |   7 +-
 tools/perf/tests/thread-map.c                      |   2 +-
 tools/perf/ui/browsers/annotate.c                  |   4 +-
 tools/perf/ui/gtk/annotate.c                       |   2 +-
 tools/perf/util/annotate.c                         |  26 +-
 tools/perf/util/annotate.h                         |   2 +-
 tools/perf/util/auxtrace.c                         |   3 -
 tools/perf/util/env.c                              |  47 +++
 tools/perf/util/env.h                              |   2 +
 tools/perf/util/evlist.c                           |   3 +-
 tools/perf/util/evsel.c                            |  80 +++-
 tools/perf/util/evsel.h                            |   3 +-
 tools/perf/util/header.c                           |   2 -
 tools/perf/util/metricgroup.c                      |   2 -
 tools/perf/util/path.c                             |  14 +
 tools/perf/util/path.h                             |   3 +
 tools/perf/util/probe-event.c                      |  85 +++--
 tools/perf/util/python-ext-sources                 |   1 +
 .../util/scripting-engines/trace-event-python.c    |   1 -
 tools/perf/util/stat-shadow.c                      | 416 ++++++++++++---------
 tools/perf/util/stat.c                             |  15 +-
 tools/perf/util/stat.h                             |  63 +++-
 tools/perf/util/string.c                           |  46 +++
 tools/perf/util/string2.h                          |   2 +
 tools/perf/util/symbol.c                           |   5 +
 tools/perf/util/symbol.h                           |   1 +
 tools/perf/util/syscalltbl.c                       |   4 +
 tools/perf/util/target.h                           |   7 +
 tools/perf/util/thread_map.c                       |   5 +-
 tools/perf/util/thread_map.h                       |   2 +-
 tools/perf/util/unwind-libunwind.c                 |   4 +-
 51 files changed, 1328 insertions(+), 363 deletions(-)
 create mode 100644 tools/arch/s390/include/uapi/asm/unistd.h
 create mode 100644 tools/perf/arch/arm64/util/sym-handling.c
 create mode 100755 tools/perf/arch/s390/entry/syscalls/mksyscalltbl

Test results:

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

The objtool and samples/bpf/ builds are disabled now that I'm switching from
using the sources in a local volume to fetching them from a http server to
build it inside the container, to make it easier to build in a container cluster.
Those will come back later.

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 second column is the time it takes on a i5-7500 CPU @ 3.40GHz, with
a 240 GB SSD from Sandisk. Take it with a grain of salt because we do
the build with clang as well when availalbe.

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.

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 38.08 alpine:3.4                    : Ok   gcc (Alpine 5.3.0) 5.3.0
   2 44.14 alpine:3.5                    : Ok   gcc (Alpine 6.2.1) 6.2.1 20160822
   3 39.23 alpine:3.6                    : Ok   gcc (Alpine 6.3.0) 6.3.0
   4 39.94 alpine:edge                   : Ok   gcc (Alpine 6.4.0) 6.4.0
   5 34.36 amazonlinux:1                 : Ok   gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-11)
   6 39.75 amazonlinux:2                 : Ok   gcc (GCC) 7.2.1 20170915 (Red Hat 7.2.1-2)
   7 28.21 android-ndk:r12b-arm          : Ok   arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease)
   8 26.06 android-ndk:r15c-arm          : Ok   arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease)
   9 20.89 centos:5                      : Ok   gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-55)
  10 33.98 centos:6                      : Ok   gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18)
  11 38.71 centos:7                      : Ok   gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16)
  12 32.67 debian:7                      : Ok   gcc (Debian 4.7.2-5) 4.7.2
  13 35.71 debian:8                      : Ok   gcc (Debian 4.9.2-10) 4.9.2
  14 60.76 debian:9                      : Ok   gcc (Debian 6.3.0-18) 6.3.0 20170516
  15 63.80 debian:experimental           : Ok   gcc (Debian 7.2.0-18) 7.2.0
  16 37.26 debian:experimental-x-arm64   : Ok   aarch64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
  17 36.71 debian:experimental-x-mips    : Ok   mips-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
  18 33.56 debian:experimental-x-mips64  : Ok   mips64-linux-gnuabi64-gcc (Debian 7.2.0-11) 7.2.0
  19 37.09 debian:experimental-x-mipsel  : Ok   mipsel-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
  20 37.44 fedora:20                     : Ok   gcc (GCC) 4.8.3 20140911 (Red Hat 4.8.3-7)
  21 38.19 fedora:21                     : Ok   gcc (GCC) 4.9.2 20150212 (Red Hat 4.9.2-6)
  22 37.92 fedora:22                     : Ok   gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6)
  23 39.25 fedora:23                     : Ok   gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6)
  24 39.44 fedora:24                     : Ok   gcc (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1)
  25 34.11 fedora:24-x-ARC-uClibc        : Ok   arc-linux-gcc (ARCompact ISA Linux uClibc toolchain 2017.09-rc2) 7.1.1 20170710
  26 76.13 fedora:25                     : Ok   gcc (GCC) 6.4.1 20170727 (Red Hat 6.4.1-1)
  27 80.30 fedora:26                     : Ok   gcc (GCC) 7.2.1 20170915 (Red Hat 7.2.1-2)
  28 75.38 fedora:27                     : Ok   gcc (GCC) 7.2.1 20170915 (Red Hat 7.2.1-2)
  29 78.37 fedora:rawhide                : Ok   gcc (GCC) 7.2.1 20170915 (Red Hat 7.2.1-4)
  30 42.54 gentoo-stage3-amd64:latest    : Ok   gcc (Gentoo 6.4.0 p1.1) 6.4.0
  31 44.86 mageia:5                      : Ok   gcc (GCC) 4.9.2
  32 45.95 mageia:6                      : Ok   gcc (Mageia 5.4.0-5.mga6) 5.4.0
  33 44.47 opensuse:42.1                 : Ok   gcc (SUSE Linux) 4.8.5
  34 46.53 opensuse:42.2                 : Ok   gcc (SUSE Linux) 4.8.5
  35 45.51 opensuse:42.3                 : Ok   gcc (SUSE Linux) 4.8.5
  36 89.91 opensuse:tumbleweed           : Ok   gcc (SUSE Linux) 7.2.1 20171020 [gcc-7-branch revision 253932]
  37 40.36 oraclelinux:6                 : Ok   gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18)
  38 42.95 oraclelinux:7                 : Ok   gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16)
  39 37.95 ubuntu:12.04.5                : Ok   gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
  40 37.70 ubuntu:14.04.4                : Ok   gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
  41 37.09 ubuntu:14.04.4-x-linaro-arm64 : Ok   aarch64-linux-gnu-gcc (Linaro GCC 5.5-2017.10) 5.5.0
  42 69.99 ubuntu:16.04                  : Ok   gcc (Ubuntu 5.4.0-6ubuntu1~16.04.5) 5.4.0 20160609
  43 38.08 ubuntu:16.04-x-arm            : Ok   arm-linux-gnueabihf-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
  44 36.04 ubuntu:16.04-x-arm64          : Ok   aarch64-linux-gnu-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
  45 34.35 ubuntu:16.04-x-powerpc        : Ok   powerpc-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
  46 35.10 ubuntu:16.04-x-powerpc64      : Ok   powerpc64-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.1) 5.4.0 20160609
  47 34.80 ubuntu:16.04-x-powerpc64el    : Ok   powerpc64le-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
  48 34.28 ubuntu:16.04-x-s390           : Ok   s390x-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
  49 66.92 ubuntu:16.10                  : Ok   gcc (Ubuntu 6.2.0-5ubuntu12) 6.2.0 20161005
  50 66.80 ubuntu:17.04                  : Ok   gcc (Ubuntu 6.3.0-12ubuntu2) 6.3.0 20170406
  51 74.57 ubuntu:17.10                  : Ok   gcc (Ubuntu 7.2.0-8ubuntu3) 7.2.0
  52 73.70 ubuntu:18.04                  : Ok   gcc (Ubuntu 7.2.0-18ubuntu2) 7.2.0
  # 

  # uname -a
  Linux jouet 4.15.0-rc3+ #3 SMP Wed Dec 13 10:14:18 -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: Test data source output                               : Ok
   6: Parse event definition strings                        : Ok
   7: Simple expression parser                              : Ok
   8: PERF_RECORD_* events & perf_sample fields             : Ok
   9: Parse perf pmu format                                 : Ok
  10: DSO data read                                         : Ok
  11: DSO data cache                                        : Ok
  12: DSO data reopen                                       : Ok
  13: Roundtrip evsel->name                                 : Ok
  14: Parse sched tracepoints fields                        : Ok
  15: syscalls:sys_enter_openat event fields                : Ok
  16: Setup struct perf_event_attr                          : Ok
  17: Match and link multiple hists                         : Ok
  18: 'import perf' in python                               : Ok
  19: Breakpoint overflow signal handler                    : Ok
  20: Breakpoint overflow sampling                          : Ok
  21: Number of exit events of a simple workload            : Ok
  22: Software clock events period values                   : Ok
  23: Object code reading                                   : Ok
  24: Sample parsing                                        : Ok
  25: Use a dummy software event to keep tracking           : Ok
  26: Parse with no sample_id_all bit set                   : Ok
  27: Filter hist entries                                   : Ok
  28: Lookup mmap thread                                    : Ok
  29: Share thread mg                                       : Ok
  30: Sort output of hist entries                           : Ok
  31: Cumulate child hist entries                           : Ok
  32: Track with sched_switch                               : Ok
  33: Filter fds with revents mask in a fdarray             : Ok
  34: Add fd to a fdarray, making it autogrow               : Ok
  35: kmod_path__parse                                      : Ok
  36: Thread map                                            : Ok
  37: LLVM search and compile                               :
  37.1: Basic BPF llvm compile                              : Ok
  37.2: kbuild searching                                    : Ok
  37.3: Compile source for BPF prologue generation          : Ok
  37.4: Compile source for BPF relocation                   : Ok
  38: Session topology                                      : Ok
  39: BPF filter                                            :
  39.1: Basic BPF filtering                                 : Ok
  39.2: BPF pinning                                         : Ok
  39.3: BPF prologue generation                             : Ok
  39.4: BPF relocation checker                              : Ok
  40: Synthesize thread map                                 : Ok
  41: Remove thread map                                     : Ok
  42: Synthesize cpu map                                    : Ok
  43: Synthesize stat config                                : Ok
  44: Synthesize stat                                       : Ok
  45: Synthesize stat round                                 : Ok
  46: Synthesize attr update                                : Ok
  47: Event times                                           : Ok
  48: Read backward ring buffer                             : Ok
  49: Print cpu map                                         : Ok
  50: Probe SDT events                                      : Ok
  51: is_printable_array                                    : Ok
  52: Print bitmap                                          : Ok
  53: perf hooks                                            : Ok
  54: builtin clang support                                 : Skip (not compiled in)
  55: unit_number__scnprintf                                : Ok
  56: x86 rdpmc                                             : Ok
  57: Convert perf time to TSC                              : Ok
  58: DWARF unwind                                          : Ok
  59: x86 instruction decoder - new instructions            : Ok
  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
  # 
  
  $ make -C tools/perf build-test
  make: Entering directory '/home/acme/git/perf/tools/perf'
  - tarpkg: ./tests/perf-targz-src-pkg .
                   make_tags_O: make tags
              make_no_libelf_O: make NO_LIBELF=1
           make_no_backtrace_O: make NO_BACKTRACE=1
           make_no_libpython_O: make NO_LIBPYTHON=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_pure_O: make
                 make_perf_o_O: make perf.o
  make_no_libdw_dwarf_unwind_O: make NO_LIBDW_DWARF_UNWIND=1
            make_no_libaudit_O: make NO_LIBAUDIT=1
             make_no_libnuma_O: make NO_LIBNUMA=1
             make_util_map_o_O: make util/map.o
                  make_debug_O: make DEBUG=1
                   make_help_O: make help
                make_no_newt_O: make NO_NEWT=1
                    make_doc_O: make doc
             make_no_libperl_O: make NO_LIBPERL=1
            make_no_auxtrace_O: make NO_AUXTRACE=1
         make_install_prefix_O: make install prefix=/tmp/krava
               make_no_slang_O: make NO_SLANG=1
         make_with_clangllvm_O: make LIBCLANGLLVM=1
   make_install_prefix_slash_O: make install prefix=/tmp/krava/
       make_util_pmu_bison_o_O: make util/pmu-bison.o
           make_no_libbionic_O: make NO_LIBBIONIC=1
             make_no_scripts_O: make NO_LIBPYTHON=1 NO_LIBPERL=1
                  make_no_ui_O: make NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
           make_no_libunwind_O: make NO_LIBUNWIND=1
        make_with_babeltrace_O: make LIBBABELTRACE=1
            make_install_bin_O: make install-bin
                make_install_O: make install
                make_no_gtk2_O: make NO_GTK2=1
                 make_static_O: make LDFLAGS=-static
                 make_cscope_O: make cscope
              make_no_libbpf_O: make NO_LIBBPF=1
            make_no_demangle_O: make NO_DEMANGLE=1
              make_clean_all_O: make clean all
  OK
  make: Leaving directory '/home/acme/git/perf/tools/perf'
  $

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [GIT PULL 00/35] perf/core improvements and fixes
  2017-03-06 19:37 Arnaldo Carvalho de Melo
@ 2017-03-07  7:17 ` Ingo Molnar
  0 siblings, 0 replies; 50+ messages in thread
From: Ingo Molnar @ 2017-03-07  7:17 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Alexander Shishkin, Ananth N Mavinakayanahalli, Andi Kleen,
	Andrew Morton, Borislav Petkov, Charles Baylis, Dave Hansen,
	David Ahern, Davidlohr Bueso, David Windsor, Elena Reshetova,
	Frederic Weisbecker, Greg Kroah-Hartman, Hans Liljestrand,
	Jiri Hladky, Jiri Olsa, Kan Liang, Karol Wachowski, Kees Kook,
	kernel-team, linuxppc-dev, Mark Rutland, Masami Hiramatsu,
	Matija Glavinic Pecotic, Maxim Kuvyrkov, Michael Ellerman,
	Namhyung Kim, Naveen N . Rao, Peter Zijlstra, Piotr Luc,
	Robert Richter, Srinivas Pandruvada, Steven Rostedt,
	Vince Weaver, Wang Nan


* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> From: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> Hi Ingo,
> 
> 	Please consider pulling,
> 
> - Arnaldo
> 
> Test results at the end of this message, as usual.
> 
> The following changes since commit 9d020d33fc1b2faa0eb35859df1381ca5dc94ffe:
> 
>   Merge branch 'linus' into perf/urgent, to resolve conflict (2017-03-02 08:05:45 +0100)
> 
> 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.11-20170306
> 
> for you to fetch changes up to 001916b94a04809a94abb07daba6f9ace01906ba:
> 
>   perf bench numa: Add more comment for -c option (2017-03-06 12:39:30 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> New features:
> 
> - Allow sorting by symbol_size in 'perf report' and 'perf top' (Charles Baylis)
> 
>   E.g.:
> 
>   # perf report -s symbol_size,symbol
> 
>   Samples: 9K of event 'cycles:k', Event count (approx.): 2870461623
>   Overhead  Symbol size  Symbol
>     14.55%          326  [k] flush_tlb_mm_range
>      7.20%         1045  [k] filemap_map_pages
>      5.82%          124  [k] vma_interval_tree_insert
>      5.18%         2430  [k] unmap_page_range
>      2.57%          571  [k] vma_interval_tree_remove
>      1.94%          494  [k] page_add_file_rmap
>      1.82%          740  [k] page_remove_rmap
>      1.66%         1017  [k] release_pages
>      1.57%         1636  [k] update_blocked_averages
>      1.57%           76  [k] unlock_page
> 
> - Add support for -p/--pid, -a/--all-cpus and -C/--cpu in 'perf ftrace' (Namhyung Kim)
> 
> Change in behaviour:
> 
> - Make system wide (-a) the default option if no target was specified and one
>   of following conditions is met:
> 
>   - No workload specified (current behaviour)
> 
>   - A workload is specified but all requested events are system wide ones,
>     like uncore ones. (Jiri Olsa)
> 
> Fixes:
> 
> - Add missing initialization to the instruction decoder used in the
>   intel PT/BTS code, which was causing lots of failures in 'perf test',
>   looking for a value when there was none (Adrian Hunter)
> 
> Infrastructure:
> 
> - Add arch code needed to adopt the kernel's refcount_t to aid in
>   catching bugs when using atomic_t as a reference counter, basically
>   cmpxchg related functions (Arnaldo Carvalho de Melo)
> 
> - Convert the code using atomic_t as reference counts to refcount_t
>   (Elena Rashetova)
> 
> - Add feature test for sched_getcpu() to more easily check for its
>   presence in the many libc implementations and accross different
>   versions of such C libraries (Arnaldo Carvalho de Melo)
> 
> - Issue a HW watchdog disable hint in 'perf stat' for when some of the
>   requested events can't get counted because a PMU counter is taken by that
>   watchdog (Borislav Petkov).
> 
> - Add mapping for Intel's KnightsMill PMU events (Karol Wachowski)
> 
> Documentation:
> 
> - Clarify the term 'convergence' in:
> 
>    perf bench numa numa-mem -h --show_convergence (Jiri Olsa)
> 
> Kernel code:
> 
> - Ensure probe location is at function entry in kretprobes (Naveen N. Rao)
> 
> - Allow return probes with offsets and absolute addresses (Naveen N. Rao)
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Adrian Hunter (1):
>       perf intel-PT/BTS: Add missing initialization
> 
> Arnaldo Carvalho de Melo (12):
>       tools include: Adopt __compiletime_error
>       tools arch x86: Include asm/cmpxchg.h
>       tools arch x86: Introduce atomic_cmpxchg()
>       tools include: Introduce atomic_cmpxchg_{relaxed,release}()
>       tools include: Provide gcc based cmpxchg fallback for !x86
>       tools include: Add UINT_MAX def to kernel.h
>       tools include: Adopt kernel's refcount.h
>       perf evlist: Clarify a bit the use of perf_mmap->refcnt
>       tools build: Add test for sched_getcpu()
>       perf bench futex: Use __maybe_unused
>       perf bench futex: Fix build on musl + clang
>       tools build: Use the same CC for feature detection and actual build
> 
> Borislav Petkov (1):
>       perf stat: Issue a HW watchdog disable hint
> 
> Charles Baylis (1):
>       perf tools: Allow sorting by symbol size
> 
> Elena Reshetova (9):
>       perf cgroup: Convert cgroup_sel.refcnt from atomic_t to refcount_t
>       perf cpumap: Convert cpu_map.refcnt from atomic_t to refcount_t
>       perf comm: Convert comm_str.refcnt from atomic_t to refcount_t
>       perf dso: Convert dso.refcnt from atomic_t to refcount_t
>       perf map: Convert map.refcnt from atomic_t to refcount_t
>       perf map: Convert map_groups.refcnt from atomic_t to refcount_t
>       perf evlist: Convert perf_map.refcnt from atomic_t to refcount_t
>       perf thread: convert thread.refcnt from atomic_t to refcount_t
>       perf thread_map: Convert thread_map.refcnt from atomic_t to refcount_t
> 
> Jiri Olsa (2):
>       perf tools: Force uncore events to system wide monitoring
>       perf bench numa: Add more comment for -c option
> 
> Karol Wachowski (1):
>       perf vendor events: Add mapping for KnightsMill PMU events
> 
> Namhyung Kim (4):
>       perf ftrace: Add support for --pid option
>       perf cpumap: Introduce cpu_map__snprint_mask()
>       perf ftrace: Add support for -a and -C option
>       perf ftrace: Use pager for displaying result
> 
> Naveen N. Rao (3):
>       kretprobes: Ensure probe location is at function entry
>       trace/kprobes: Allow return probes with offsets and absolute addresses
>       perf probe: Generalize probe event file open routine
> 
> Steven Rostedt (VMware) (1):
>       trace/kprobes: Add back warning about offset in return probes
> 
>  include/linux/kprobes.h                            |   1 +
>  kernel/kprobes.c                                   |  13 ++
>  kernel/trace/trace.c                               |   1 +
>  kernel/trace/trace_kprobe.c                        |   9 +-
>  tools/arch/x86/include/asm/atomic.h                |   7 +
>  tools/arch/x86/include/asm/cmpxchg.h               |  89 ++++++++++++
>  tools/build/Makefile.feature                       |   1 +
>  tools/build/feature/Makefile                       |  10 +-
>  tools/build/feature/test-all.c                     |   5 +
>  tools/build/feature/test-sched_getcpu.c            |   7 +
>  tools/include/asm-generic/atomic-gcc.h             |   8 ++
>  tools/include/linux/atomic.h                       |   6 +
>  tools/include/linux/compiler-gcc.h                 |   4 +
>  tools/include/linux/compiler.h                     |   4 +
>  tools/include/linux/kernel.h                       |   4 +
>  tools/include/linux/refcount.h                     | 151 ++++++++++++++++++++
>  tools/perf/Documentation/perf-ftrace.txt           |  18 +++
>  tools/perf/Documentation/perf-report.txt           |   1 +
>  tools/perf/MANIFEST                                |   2 +
>  tools/perf/Makefile.config                         |   4 +
>  tools/perf/bench/futex-hash.c                      |   1 +
>  tools/perf/bench/futex-lock-pi.c                   |   1 +
>  tools/perf/bench/futex-requeue.c                   |   1 +
>  tools/perf/bench/futex-wake-parallel.c             |   1 +
>  tools/perf/bench/futex-wake.c                      |   1 +
>  tools/perf/bench/futex.h                           |  10 +-
>  tools/perf/bench/numa.c                            |   3 +-
>  tools/perf/builtin-ftrace.c                        | 152 +++++++++++++++++----
>  tools/perf/builtin-stat.c                          |  44 +++++-
>  tools/perf/pmu-events/arch/x86/mapfile.csv         |   1 +
>  tools/perf/tests/cpumap.c                          |   2 +-
>  tools/perf/tests/thread-map.c                      |   6 +-
>  tools/perf/tests/thread-mg-share.c                 |  12 +-
>  tools/perf/util/cgroup.c                           |   6 +-
>  tools/perf/util/cgroup.h                           |   4 +-
>  tools/perf/util/cloexec.h                          |   6 -
>  tools/perf/util/comm.c                             |  15 +-
>  tools/perf/util/cpumap.c                           |  62 +++++++--
>  tools/perf/util/cpumap.h                           |   5 +-
>  tools/perf/util/dso.c                              |   6 +-
>  tools/perf/util/dso.h                              |   4 +-
>  tools/perf/util/evlist.c                           |  31 +++--
>  tools/perf/util/evlist.h                           |   4 +-
>  tools/perf/util/hist.h                             |   1 +
>  .../util/intel-pt-decoder/intel-pt-insn-decoder.c  |   2 +
>  tools/perf/util/machine.c                          |   2 +-
>  tools/perf/util/map.c                              |  10 +-
>  tools/perf/util/map.h                              |  10 +-
>  tools/perf/util/parse-events.c                     |   5 +-
>  tools/perf/util/probe-file.c                       |  20 +--
>  tools/perf/util/probe-file.h                       |   1 +
>  tools/perf/util/sort.c                             |  41 ++++++
>  tools/perf/util/sort.h                             |   1 +
>  tools/perf/util/thread.c                           |   6 +-
>  tools/perf/util/thread.h                           |   4 +-
>  tools/perf/util/thread_map.c                       |  20 +--
>  tools/perf/util/thread_map.h                       |   4 +-
>  tools/perf/util/util.h                             |   4 +-
>  tools/scripts/Makefile.include                     |   9 ++
>  59 files changed, 720 insertions(+), 143 deletions(-)
>  create mode 100644 tools/arch/x86/include/asm/cmpxchg.h
>  create mode 100644 tools/build/feature/test-sched_getcpu.c
>  create mode 100644 tools/include/linux/refcount.h

Pulled, thanks a lot Arnaldo!

	Ingo

^ permalink raw reply	[flat|nested] 50+ messages in thread

* [GIT PULL 00/35] perf/core improvements and fixes
@ 2017-03-06 19:37 Arnaldo Carvalho de Melo
  2017-03-07  7:17 ` Ingo Molnar
  0 siblings, 1 reply; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-03-06 19:37 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Alexander Shishkin, Ananth N Mavinakayanahalli, Andi Kleen,
	Andrew Morton, Borislav Petkov, Charles Baylis, Dave Hansen,
	David Ahern, Davidlohr Bueso, David Windsor, Elena Reshetova,
	Frederic Weisbecker, Greg Kroah-Hartman, Hans Liljestrand,
	Jiri Hladky, Jiri Olsa, Kan Liang, Karol Wachowski, Kees Kook,
	kernel-team, linuxppc-dev, Mark Rutland, Masami Hiramatsu,
	Matija Glavinic Pecotic, Maxim Kuvyrkov, Michael Ellerman,
	Namhyung Kim, Naveen N . Rao, Peter Zijlstra, Piotr Luc,
	Robert Richter, Srinivas Pandruvada, Steven Rostedt,
	Vince Weaver, Wang Nan

From: Arnaldo Carvalho de Melo <acme@redhat.com>

Hi Ingo,

	Please consider pulling,

- Arnaldo

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

The following changes since commit 9d020d33fc1b2faa0eb35859df1381ca5dc94ffe:

  Merge branch 'linus' into perf/urgent, to resolve conflict (2017-03-02 08:05:45 +0100)

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.11-20170306

for you to fetch changes up to 001916b94a04809a94abb07daba6f9ace01906ba:

  perf bench numa: Add more comment for -c option (2017-03-06 12:39:30 -0300)

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

New features:

- Allow sorting by symbol_size in 'perf report' and 'perf top' (Charles Baylis)

  E.g.:

  # perf report -s symbol_size,symbol

  Samples: 9K of event 'cycles:k', Event count (approx.): 2870461623
  Overhead  Symbol size  Symbol
    14.55%          326  [k] flush_tlb_mm_range
     7.20%         1045  [k] filemap_map_pages
     5.82%          124  [k] vma_interval_tree_insert
     5.18%         2430  [k] unmap_page_range
     2.57%          571  [k] vma_interval_tree_remove
     1.94%          494  [k] page_add_file_rmap
     1.82%          740  [k] page_remove_rmap
     1.66%         1017  [k] release_pages
     1.57%         1636  [k] update_blocked_averages
     1.57%           76  [k] unlock_page

- Add support for -p/--pid, -a/--all-cpus and -C/--cpu in 'perf ftrace' (Namhyung Kim)

Change in behaviour:

- Make system wide (-a) the default option if no target was specified and one
  of following conditions is met:

  - No workload specified (current behaviour)

  - A workload is specified but all requested events are system wide ones,
    like uncore ones. (Jiri Olsa)

Fixes:

- Add missing initialization to the instruction decoder used in the
  intel PT/BTS code, which was causing lots of failures in 'perf test',
  looking for a value when there was none (Adrian Hunter)

Infrastructure:

- Add arch code needed to adopt the kernel's refcount_t to aid in
  catching bugs when using atomic_t as a reference counter, basically
  cmpxchg related functions (Arnaldo Carvalho de Melo)

- Convert the code using atomic_t as reference counts to refcount_t
  (Elena Rashetova)

- Add feature test for sched_getcpu() to more easily check for its
  presence in the many libc implementations and accross different
  versions of such C libraries (Arnaldo Carvalho de Melo)

- Issue a HW watchdog disable hint in 'perf stat' for when some of the
  requested events can't get counted because a PMU counter is taken by that
  watchdog (Borislav Petkov).

- Add mapping for Intel's KnightsMill PMU events (Karol Wachowski)

Documentation:

- Clarify the term 'convergence' in:

   perf bench numa numa-mem -h --show_convergence (Jiri Olsa)

Kernel code:

- Ensure probe location is at function entry in kretprobes (Naveen N. Rao)

- Allow return probes with offsets and absolute addresses (Naveen N. Rao)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

----------------------------------------------------------------
Adrian Hunter (1):
      perf intel-PT/BTS: Add missing initialization

Arnaldo Carvalho de Melo (12):
      tools include: Adopt __compiletime_error
      tools arch x86: Include asm/cmpxchg.h
      tools arch x86: Introduce atomic_cmpxchg()
      tools include: Introduce atomic_cmpxchg_{relaxed,release}()
      tools include: Provide gcc based cmpxchg fallback for !x86
      tools include: Add UINT_MAX def to kernel.h
      tools include: Adopt kernel's refcount.h
      perf evlist: Clarify a bit the use of perf_mmap->refcnt
      tools build: Add test for sched_getcpu()
      perf bench futex: Use __maybe_unused
      perf bench futex: Fix build on musl + clang
      tools build: Use the same CC for feature detection and actual build

Borislav Petkov (1):
      perf stat: Issue a HW watchdog disable hint

Charles Baylis (1):
      perf tools: Allow sorting by symbol size

Elena Reshetova (9):
      perf cgroup: Convert cgroup_sel.refcnt from atomic_t to refcount_t
      perf cpumap: Convert cpu_map.refcnt from atomic_t to refcount_t
      perf comm: Convert comm_str.refcnt from atomic_t to refcount_t
      perf dso: Convert dso.refcnt from atomic_t to refcount_t
      perf map: Convert map.refcnt from atomic_t to refcount_t
      perf map: Convert map_groups.refcnt from atomic_t to refcount_t
      perf evlist: Convert perf_map.refcnt from atomic_t to refcount_t
      perf thread: convert thread.refcnt from atomic_t to refcount_t
      perf thread_map: Convert thread_map.refcnt from atomic_t to refcount_t

Jiri Olsa (2):
      perf tools: Force uncore events to system wide monitoring
      perf bench numa: Add more comment for -c option

Karol Wachowski (1):
      perf vendor events: Add mapping for KnightsMill PMU events

Namhyung Kim (4):
      perf ftrace: Add support for --pid option
      perf cpumap: Introduce cpu_map__snprint_mask()
      perf ftrace: Add support for -a and -C option
      perf ftrace: Use pager for displaying result

Naveen N. Rao (3):
      kretprobes: Ensure probe location is at function entry
      trace/kprobes: Allow return probes with offsets and absolute addresses
      perf probe: Generalize probe event file open routine

Steven Rostedt (VMware) (1):
      trace/kprobes: Add back warning about offset in return probes

 include/linux/kprobes.h                            |   1 +
 kernel/kprobes.c                                   |  13 ++
 kernel/trace/trace.c                               |   1 +
 kernel/trace/trace_kprobe.c                        |   9 +-
 tools/arch/x86/include/asm/atomic.h                |   7 +
 tools/arch/x86/include/asm/cmpxchg.h               |  89 ++++++++++++
 tools/build/Makefile.feature                       |   1 +
 tools/build/feature/Makefile                       |  10 +-
 tools/build/feature/test-all.c                     |   5 +
 tools/build/feature/test-sched_getcpu.c            |   7 +
 tools/include/asm-generic/atomic-gcc.h             |   8 ++
 tools/include/linux/atomic.h                       |   6 +
 tools/include/linux/compiler-gcc.h                 |   4 +
 tools/include/linux/compiler.h                     |   4 +
 tools/include/linux/kernel.h                       |   4 +
 tools/include/linux/refcount.h                     | 151 ++++++++++++++++++++
 tools/perf/Documentation/perf-ftrace.txt           |  18 +++
 tools/perf/Documentation/perf-report.txt           |   1 +
 tools/perf/MANIFEST                                |   2 +
 tools/perf/Makefile.config                         |   4 +
 tools/perf/bench/futex-hash.c                      |   1 +
 tools/perf/bench/futex-lock-pi.c                   |   1 +
 tools/perf/bench/futex-requeue.c                   |   1 +
 tools/perf/bench/futex-wake-parallel.c             |   1 +
 tools/perf/bench/futex-wake.c                      |   1 +
 tools/perf/bench/futex.h                           |  10 +-
 tools/perf/bench/numa.c                            |   3 +-
 tools/perf/builtin-ftrace.c                        | 152 +++++++++++++++++----
 tools/perf/builtin-stat.c                          |  44 +++++-
 tools/perf/pmu-events/arch/x86/mapfile.csv         |   1 +
 tools/perf/tests/cpumap.c                          |   2 +-
 tools/perf/tests/thread-map.c                      |   6 +-
 tools/perf/tests/thread-mg-share.c                 |  12 +-
 tools/perf/util/cgroup.c                           |   6 +-
 tools/perf/util/cgroup.h                           |   4 +-
 tools/perf/util/cloexec.h                          |   6 -
 tools/perf/util/comm.c                             |  15 +-
 tools/perf/util/cpumap.c                           |  62 +++++++--
 tools/perf/util/cpumap.h                           |   5 +-
 tools/perf/util/dso.c                              |   6 +-
 tools/perf/util/dso.h                              |   4 +-
 tools/perf/util/evlist.c                           |  31 +++--
 tools/perf/util/evlist.h                           |   4 +-
 tools/perf/util/hist.h                             |   1 +
 .../util/intel-pt-decoder/intel-pt-insn-decoder.c  |   2 +
 tools/perf/util/machine.c                          |   2 +-
 tools/perf/util/map.c                              |  10 +-
 tools/perf/util/map.h                              |  10 +-
 tools/perf/util/parse-events.c                     |   5 +-
 tools/perf/util/probe-file.c                       |  20 +--
 tools/perf/util/probe-file.h                       |   1 +
 tools/perf/util/sort.c                             |  41 ++++++
 tools/perf/util/sort.h                             |   1 +
 tools/perf/util/thread.c                           |   6 +-
 tools/perf/util/thread.h                           |   4 +-
 tools/perf/util/thread_map.c                       |  20 +--
 tools/perf/util/thread_map.h                       |   4 +-
 tools/perf/util/util.h                             |   4 +-
 tools/scripts/Makefile.include                     |   9 ++
 59 files changed, 720 insertions(+), 143 deletions(-)
 create mode 100644 tools/arch/x86/include/asm/cmpxchg.h
 create mode 100644 tools/build/feature/test-sched_getcpu.c
 create mode 100644 tools/include/linux/refcount.h

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.

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.

  [root@jouet ~]# waitp `pidof perf` ; time dm
     1 alpine:3.4: Ok
     2 alpine:3.5: Ok
     3 alpine:edge: Ok
     4 android-ndk:r12b-arm: Ok
     5 archlinux:latest: Ok
     6 centos:5: Ok
     7 centos:6: Ok
     8 centos:7: Ok
     9 debian:7: Ok
    10 debian:8: Ok
    11 debian:experimental: Ok
    12 debian:experimental-x-arm64: Ok
    13 debian:experimental-x-mips: Ok
    14 debian:experimental-x-mips64: Ok
    15 debian:experimental-x-mipsel: Ok
    16 fedora:20: Ok
    17 fedora:21: Ok
    18 fedora:22: Ok
    19 fedora:23: Ok
    20 fedora:24: Ok
    21 fedora:24-x-ARC-uClibc: Ok
    22 fedora:25: Ok
    23 fedora:rawhide: Ok
    24 mageia:5: Ok
    25 opensuse:13.2: Ok
    26 opensuse:42.1: Ok
    27 opensuse:tumbleweed: Ok
    28 ubuntu:12.04.5: Ok
    29 ubuntu:14.04.4: Ok
    30 ubuntu:14.04.4-x-linaro-arm64: Ok
    31 ubuntu:15.10: Ok
    32 ubuntu:16.04: Ok
    33 ubuntu:16.04-x-arm: Ok
    34 ubuntu:16.04-x-arm64: Ok
    35 ubuntu:16.04-x-powerpc: Ok
    36 ubuntu:16.04-x-powerpc64: Ok
    37 ubuntu:16.04-x-s390: Ok
    38 ubuntu:16.10: Ok
    39 ubuntu:17.04: Ok
  [root@jouet ~]#

  [root@zoo ~]# uname -a
  Linux zoo 4.9.13-100.fc24.x86_64 #1 SMP Mon Feb 27 16:57:22 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
  [root@zoo ~]# perf test
   1: vmlinux symtab matches kallsyms            : Ok
   2: Detect openat syscall event                : Ok
   3: Detect openat syscall event on all cpus    : Ok
   4: Read samples using the mmap interface      : Ok
   5: Parse event definition strings             : Ok
   6: PERF_RECORD_* events & perf_sample fields  : Ok
   7: Parse perf pmu format                      : Ok
   8: DSO data read                              : Ok
   9: DSO data cache                             : Ok
  10: DSO data reopen                            : Ok
  11: Roundtrip evsel->name                      : Ok
  12: Parse sched tracepoints fields             : Ok
  13: syscalls:sys_enter_openat event fields     : Ok
  14: Setup struct perf_event_attr               : Ok
  15: Match and link multiple hists              : Ok
  16: 'import perf' in python                    : Ok
  17: Breakpoint overflow signal handler         : Ok
  18: Breakpoint overflow sampling               : Ok
  19: Number of exit events of a simple workload : Ok
  20: Software clock events period values        : Ok
  21: Object code reading                        : Ok
  22: Sample parsing                             : Ok
  23: Use a dummy software event to keep tracking: Ok
  24: Parse with no sample_id_all bit set        : Ok
  25: Filter hist entries                        : Ok
  26: Lookup mmap thread                         : Ok
  27: Share thread mg                            : Ok
  28: Sort output of hist entries                : Ok
  29: Cumulate child hist entries                : Ok
  30: Track with sched_switch                    : Ok
  31: Filter fds with revents mask in a fdarray  : Ok
  32: Add fd to a fdarray, making it autogrow    : Ok
  33: kmod_path__parse                           : Ok
  34: Thread map                                 : Ok
  35: LLVM search and compile                    :
  35.1: Basic BPF llvm compile                    : Ok
  35.2: kbuild searching                          : Ok
  35.3: Compile source for BPF prologue generation: Ok
  35.4: Compile source for BPF relocation         : Ok
  36: Session topology                           : Ok
  37: BPF filter                                 :
  37.1: Basic BPF filtering                      : Ok
  37.2: BPF pinning                              : Ok
  37.3: BPF prologue generation                  : Ok
  37.4: BPF relocation checker                   : Ok
  38: Synthesize thread map                      : Ok
  39: Remove thread map                          : Ok
  40: Synthesize cpu map                         : Ok
  41: Synthesize stat config                     : Ok
  42: Synthesize stat                            : Ok
  43: Synthesize stat round                      : Ok
  44: Synthesize attr update                     : Ok
  45: Event times                                : Ok
  46: Read backward ring buffer                  : Ok
  47: Print cpu map                              : Ok
  48: Probe SDT events                           : Ok
  49: is_printable_array                         : Ok
  50: Print bitmap                               : Ok
  51: perf hooks                                 : Ok
  52: builtin clang support                      : Skip (not compiled in)
  53: unit_number__scnprintf                     : Ok
  54: x86 rdpmc                                  : Ok
  55: Convert perf time to TSC                   : Ok
  56: DWARF unwind                               : Ok
  57: x86 instruction decoder - new instructions : Ok
  58: Intel cqm nmi context read                 : Skip
  [root@zoo ~]#

  [acme@jouet linux]$ make -C tools/perf build-test
  make: Entering directory '/home/acme/git/linux/tools/perf'
  - tarpkg: ./tests/perf-targz-src-pkg .
                   make_pure_O: make
                    make_doc_O: make doc
   make_install_prefix_slash_O: make install prefix=/tmp/krava/
         make_with_clangllvm_O: make LIBCLANGLLVM=1
                 make_static_O: make LDFLAGS=-static
                   make_help_O: make help
             make_no_libnuma_O: make NO_LIBNUMA=1
              make_clean_all_O: make clean all
              make_no_libelf_O: make NO_LIBELF=1
           make_no_libbionic_O: make NO_LIBBIONIC=1
                  make_no_ui_O: make NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
            make_no_libaudit_O: make NO_LIBAUDIT=1
             make_no_libperl_O: make NO_LIBPERL=1
             make_no_scripts_O: make NO_LIBPYTHON=1 NO_LIBPERL=1
           make_no_libunwind_O: make NO_LIBUNWIND=1
  make_no_libdw_dwarf_unwind_O: make NO_LIBDW_DWARF_UNWIND=1
                   make_tags_O: make tags
                  make_debug_O: make DEBUG=1
                make_no_newt_O: make NO_NEWT=1
         make_install_prefix_O: make install prefix=/tmp/krava
            make_install_bin_O: make install-bin
                 make_perf_o_O: make perf.o
               make_no_slang_O: make NO_SLANG=1
        make_with_babeltrace_O: make LIBBABELTRACE=1
       make_util_pmu_bison_o_O: make util/pmu-bison.o
             make_util_map_o_O: make util/map.o
           make_no_libpython_O: make NO_LIBPYTHON=1
            make_no_auxtrace_O: make NO_AUXTRACE=1
            make_no_demangle_O: make NO_DEMANGLE=1
           make_no_backtrace_O: make NO_BACKTRACE=1
                make_no_gtk2_O: make NO_GTK2=1
              make_no_libbpf_O: make NO_LIBBPF=1
                make_install_O: make install
                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
  OK
  [acme@jouet linux]$

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [GIT PULL 00/35] perf/core improvements and fixes
  2016-08-23 21:03 Arnaldo Carvalho de Melo
@ 2016-08-24  9:09 ` Ingo Molnar
  0 siblings, 0 replies; 50+ messages in thread
From: Ingo Molnar @ 2016-08-24  9:09 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Adrian Hunter, Alexander Shishkin,
	Alexander Yarygin, Alexey Brodkin, Alexei Starovoitov,
	Arjan van de Ven, Colin King, David Ahern, He Kuang,
	Hemant Kumar, Jiri Olsa, Masami Hiramatsu, Mathieu Poirier,
	Namhyung Kim, Naohiro Aota, Pekka Enberg, Peter Zijlstra,
	Rui Teng, Stanislav Fomichev, Steven Rostedt, Vince Weaver,
	Vineet Gupta, Wang Nan, Arnaldo Carvalho de Melo


* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> Hi Ingo,
> 
> 	Please consider pulling, I first merged tip/perf/urgent into a
> tip/perf/core and rebased the patches I had in acme/perf/core.
> 
> - Arnaldo
> 
> Build stats at the end of this message.
> 
> The following changes since commit ce90c12d2453aa6be743719bb0a5d4040b92700f:
> 
>   Merge branch 'perf/urgent' into perf/core, to pick up fixes before merging new changes (2016-08-23 15:35:47 -0300)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-20160823
> 
> for you to fetch changes up to 5e30d55c71de058e4156080fe32d426c22d094cb:
> 
>   perf record: Fix spelling mistake "Finshed" -> "Finished" (2016-08-23 17:06:40 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> User visible:
> 
> . Allow configuring the default 'perf report -s' sort order in ~/.perfconfig,
>   for instance, "sym,dso" may be more fitting for kernel developers. (Arnaldo Carvalho de Melo)
> 
> - Support x8/x16/x32/x64 hexadecimal "types" in ftrace and 'perf probe' (Masami Hiramatsu)
> 
> Infrastructure:
> 
> - Skip running the feature tests for 'make install-doc' (Rui Teng)
> 
> - Introduce tools/include/linux/time64.h with *SEC_PER_*SEC macros
>   to use in all of tools/ (Arnaldo Carvalho de Melo)
> 
> - Break down symbol__disassemble() into multiple functions, to ease
>   future work on better reporting the errors that may take place in
>   the various steps it performs (possibly decompressing kernel module
>   files, getting build-id keyed files, calling objdump, parsing its
>   output, etc) (Arnaldo Carvalho de Melo)
> 
> - Typo fixes in various places (Colin Ian King)
> 
> - Remove superfluous NULL check in the TUI code (Colin Ian King)
> 
> - Allow displaying multiple header lines in the TUI browser, prep
>   work for the 'perf c2c' browser (Jiri Olsa)
> 
> - Copy coresight-pmu.h header file needed by perf tools (Mathieu Poirier)
> 
> - Use __weak definition from linux/compiler.h (Rui Teng)
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> 
> Arnaldo Carvalho de Melo (16):
>       tools: Introduce tools/include/linux/time64.h for *SEC_PER_*SEC macros
>       perf bench numa: Use NSEC_PER_U?SEC
>       perf sched: Use linux/time64.h
>       perf timechart: Use NSEC_PER_U?SEC
>       perf bench sched-pipe: Use linux/time64.h, USEC_PER_SEC
>       perf stat: Use *SEC_PER_*SEC macros
>       perf bench mem: Use USEC_PER_SEC
>       perf bench sched-messaging: Use USEC_PER_MSEC
>       perf record: Use USEC_PER_MSEC
>       perf kvm: Use NSEC_PER_USEC
>       perf bench futex: Use NSEC_PER_USEC
>       perf top: Use MSEC_PER_SEC
>       perf disassemble: Move check for kallsyms + !kcore
>       perf disassemble: Simplify logic for picking the filename to disassemble
>       perf disassemble: Extract logic to find file to pass to objdump to a separate function
>       perf report: Allow configuring the default sort order in ~/.perfconfig
> 
> Colin Ian King (5):
>       perf hists browser: Remove superfluous null check on map
>       perf tools: Fix typo: "ehough" -> "enough"
>       perf test bpf: Fix typo: "ehough" -> "enough"
>       perf bpf: Fix typo: "ehough" -> "enough"
>       perf record: Fix spelling mistake "Finshed" -> "Finished"
> 
> Jiri Olsa (5):
>       perf hists: Introduce nr_header_lines into struct perf_hpp_list
>       perf hists: Add line argument into perf_hpp_fmt's header callback
>       perf tools tui: Display multiple header lines
>       perf tools stdio: Display multiple header lines
>       perf hists: Add support for header span
> 
> Masami Hiramatsu (6):
>       ftrace: kprobe: uprobe: Add x8/x16/x32/x64 for hexadecimal types
>       ftrace: probe: Add README entries for k/uprobe-events
>       perf probe: Add supported for type casting by the running kernel
>       perf probe: Support hexadecimal casting
>       perf probe: Use hexadecimal type by default if possible
>       ftrace: kprobe: uprobe: Show u8/u16/u32/u64 types in decimal
> 
> Mathieu Poirier (1):
>       tools: Copy coresight-pmu.h header file needed by perf tools
> 
> Rui Teng (2):
>       perf tools: Use __weak definition from linux/compiler.h
>       perf tools: Skip running the feature tests for 'make install-doc'
> 
>  Documentation/trace/kprobetrace.txt                |  9 ++-
>  Documentation/trace/uprobetracer.txt               |  9 ++-
>  kernel/trace/trace.c                               | 24 ++++++
>  kernel/trace/trace_kprobe.c                        |  4 +
>  kernel/trace/trace_probe.c                         | 30 ++++----
>  kernel/trace/trace_probe.h                         | 11 ++-
>  kernel/trace/trace_uprobe.c                        |  4 +
>  tools/include/linux/coresight-pmu.h                | 39 ++++++++++
>  tools/include/linux/time64.h                       | 12 +++
>  tools/perf/Documentation/perf-config.txt           |  4 +
>  tools/perf/Documentation/perf-probe.txt            |  5 +-
>  tools/perf/MANIFEST                                |  2 +
>  tools/perf/Makefile.perf                           |  5 +-
>  tools/perf/bench/futex-requeue.c                   |  5 +-
>  tools/perf/bench/futex-wake-parallel.c             |  5 +-
>  tools/perf/bench/futex-wake.c                      |  5 +-
>  tools/perf/bench/mem-functions.c                   |  3 +-
>  tools/perf/bench/numa.c                            | 53 ++++++-------
>  tools/perf/bench/sched-messaging.c                 |  5 +-
>  tools/perf/bench/sched-pipe.c                      |  9 ++-
>  tools/perf/builtin-diff.c                          |  4 +-
>  tools/perf/builtin-kvm.c                           | 11 +--
>  tools/perf/builtin-record.c                        |  8 +-
>  tools/perf/builtin-report.c                        |  4 +
>  tools/perf/builtin-sched.c                         | 37 ++++-----
>  tools/perf/builtin-script.c                        |  7 +-
>  tools/perf/builtin-stat.c                          | 19 ++---
>  tools/perf/builtin-timechart.c                     | 13 ++--
>  tools/perf/builtin-top.c                           |  3 +-
>  tools/perf/builtin-trace.c                         |  1 +
>  tools/perf/perf.h                                  |  7 --
>  tools/perf/tests/backward-ring-buffer.c            |  2 +-
>  tools/perf/tests/bpf.c                             |  2 +-
>  tools/perf/ui/browsers/hists.c                     | 50 +++++++++----
>  tools/perf/ui/gtk/hists.c                          |  2 +-
>  tools/perf/ui/hist.c                               |  4 +-
>  tools/perf/ui/stdio/hist.c                         | 45 +++++++----
>  tools/perf/util/annotate.c                         | 87 +++++++++++-----------
>  tools/perf/util/bpf-loader.c                       |  2 +-
>  tools/perf/util/debug.c                            | 10 +--
>  tools/perf/util/header.c                           |  3 +-
>  tools/perf/util/hist.h                             |  3 +-
>  tools/perf/util/probe-file.c                       | 57 ++++++++++++++
>  tools/perf/util/probe-file.h                       | 10 +++
>  tools/perf/util/probe-finder.c                     | 19 +++--
>  .../perf/util/scripting-engines/trace-event-perl.c |  5 +-
>  .../util/scripting-engines/trace-event-python.c    |  5 +-
>  tools/perf/util/sort.c                             |  9 ++-
>  tools/perf/util/sort.h                             |  2 +-
>  tools/perf/util/svghelper.c                        | 11 +--
>  tools/perf/util/util.c                             |  1 +
>  tools/perf/util/util.h                             |  4 -
>  52 files changed, 464 insertions(+), 226 deletions(-)
>  create mode 100644 tools/include/linux/coresight-pmu.h
>  create mode 100644 tools/include/linux/time64.h
> 
> Build Stats:
> 
> News:
> 
> The fedora:24-x-ARC-uClibc adds the ARC arch and the uClibc libc to the mix of
> targets tested, still with a minimal build that doesn't include even libelf,
> that will be added soon, using a more full featured pre-built toolchain provided
> by the Synopsys folks.
> 
>   [root@jouet ~]# time dm
>    1 70.304638757 alpine:3.4: Ok
>    2 24.806303766 android-ndk:r12b-arm: Ok
>    3 71.829633643 archlinux:latest: Ok
>    4 39.316551941 centos:5: Ok
>    5 59.282978228 centos:6: Ok
>    6 69.836088394 centos:7: Ok
>    7 63.476952272 debian:7: Ok
>    8 69.450110099 debian:8: Ok
>    9 72.484714796 debian:experimental: Ok
>   10 69.730035221 fedora:20: Ok
>   11 73.629813614 fedora:21: Ok
>   12 71.955425760 fedora:22: Ok
>   13 73.015579053 fedora:23: Ok
>   14 81.186943795 fedora:24: Ok
>   15 31.401503154 fedora:24-x-ARC-uClibc: Ok
>   16 78.366606942 fedora:rawhide: Ok
>   17 77.434661064 mageia:5: Ok
>   18 74.491020416 opensuse:13.2: Ok
>   19 71.673570141 opensuse:42.1: Ok
>   20 79.587415167 opensuse:tumbleweed: Ok
>   21 57.802976895 ubuntu:12.04.5: Ok
>   22 68.505810699 ubuntu:14.04.4: Ok
>   23 69.478057262 ubuntu:15.10: Ok
>   24 65.596669700 ubuntu:16.04: Ok
>   25 52.759886216 ubuntu:16.04-x-arm: Ok
>   26 52.389293077 ubuntu:16.04-x-arm64: Ok
>   27 52.319141734 ubuntu:16.04-x-powerpc64: Ok
>   28 54.378287607 ubuntu:16.04-x-powerpc64el: Ok
>   29 72.794919209 ubuntu:16.10: Ok
>   30 53.351899868 ubuntu:16.10-x-s390: Ok
>      1922.64s
> 
>   real	32m3.246s
>   user	0m1.858s
>   sys	0m2.363s
>   [root@jouet ~]#

Pulled, thanks a lot Arnaldo!

	Ingo

^ permalink raw reply	[flat|nested] 50+ messages in thread

* [GIT PULL 00/35] perf/core improvements and fixes
@ 2016-08-23 21:03 Arnaldo Carvalho de Melo
  2016-08-24  9:09 ` Ingo Molnar
  0 siblings, 1 reply; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-08-23 21:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Alexander Shishkin, Alexander Yarygin, Alexey Brodkin,
	Alexei Starovoitov, Arjan van de Ven, Colin King, David Ahern,
	He Kuang, Hemant Kumar, Jiri Olsa, Masami Hiramatsu,
	Mathieu Poirier, Namhyung Kim, Naohiro Aota, Pekka Enberg,
	Peter Zijlstra, Rui Teng, Stanislav Fomichev, Steven Rostedt,
	Vince Weaver, Vineet Gupta, Wang Nan, Arnaldo Carvalho de Melo

Hi Ingo,

	Please consider pulling, I first merged tip/perf/urgent into a
tip/perf/core and rebased the patches I had in acme/perf/core.

- Arnaldo

Build stats at the end of this message.

The following changes since commit ce90c12d2453aa6be743719bb0a5d4040b92700f:

  Merge branch 'perf/urgent' into perf/core, to pick up fixes before merging new changes (2016-08-23 15:35:47 -0300)

are available in the git repository at:

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

for you to fetch changes up to 5e30d55c71de058e4156080fe32d426c22d094cb:

  perf record: Fix spelling mistake "Finshed" -> "Finished" (2016-08-23 17:06:40 -0300)

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

User visible:

. Allow configuring the default 'perf report -s' sort order in ~/.perfconfig,
  for instance, "sym,dso" may be more fitting for kernel developers. (Arnaldo Carvalho de Melo)

- Support x8/x16/x32/x64 hexadecimal "types" in ftrace and 'perf probe' (Masami Hiramatsu)

Infrastructure:

- Skip running the feature tests for 'make install-doc' (Rui Teng)

- Introduce tools/include/linux/time64.h with *SEC_PER_*SEC macros
  to use in all of tools/ (Arnaldo Carvalho de Melo)

- Break down symbol__disassemble() into multiple functions, to ease
  future work on better reporting the errors that may take place in
  the various steps it performs (possibly decompressing kernel module
  files, getting build-id keyed files, calling objdump, parsing its
  output, etc) (Arnaldo Carvalho de Melo)

- Typo fixes in various places (Colin Ian King)

- Remove superfluous NULL check in the TUI code (Colin Ian King)

- Allow displaying multiple header lines in the TUI browser, prep
  work for the 'perf c2c' browser (Jiri Olsa)

- Copy coresight-pmu.h header file needed by perf tools (Mathieu Poirier)

- Use __weak definition from linux/compiler.h (Rui Teng)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

----------------------------------------------------------------

Arnaldo Carvalho de Melo (16):
      tools: Introduce tools/include/linux/time64.h for *SEC_PER_*SEC macros
      perf bench numa: Use NSEC_PER_U?SEC
      perf sched: Use linux/time64.h
      perf timechart: Use NSEC_PER_U?SEC
      perf bench sched-pipe: Use linux/time64.h, USEC_PER_SEC
      perf stat: Use *SEC_PER_*SEC macros
      perf bench mem: Use USEC_PER_SEC
      perf bench sched-messaging: Use USEC_PER_MSEC
      perf record: Use USEC_PER_MSEC
      perf kvm: Use NSEC_PER_USEC
      perf bench futex: Use NSEC_PER_USEC
      perf top: Use MSEC_PER_SEC
      perf disassemble: Move check for kallsyms + !kcore
      perf disassemble: Simplify logic for picking the filename to disassemble
      perf disassemble: Extract logic to find file to pass to objdump to a separate function
      perf report: Allow configuring the default sort order in ~/.perfconfig

Colin Ian King (5):
      perf hists browser: Remove superfluous null check on map
      perf tools: Fix typo: "ehough" -> "enough"
      perf test bpf: Fix typo: "ehough" -> "enough"
      perf bpf: Fix typo: "ehough" -> "enough"
      perf record: Fix spelling mistake "Finshed" -> "Finished"

Jiri Olsa (5):
      perf hists: Introduce nr_header_lines into struct perf_hpp_list
      perf hists: Add line argument into perf_hpp_fmt's header callback
      perf tools tui: Display multiple header lines
      perf tools stdio: Display multiple header lines
      perf hists: Add support for header span

Masami Hiramatsu (6):
      ftrace: kprobe: uprobe: Add x8/x16/x32/x64 for hexadecimal types
      ftrace: probe: Add README entries for k/uprobe-events
      perf probe: Add supported for type casting by the running kernel
      perf probe: Support hexadecimal casting
      perf probe: Use hexadecimal type by default if possible
      ftrace: kprobe: uprobe: Show u8/u16/u32/u64 types in decimal

Mathieu Poirier (1):
      tools: Copy coresight-pmu.h header file needed by perf tools

Rui Teng (2):
      perf tools: Use __weak definition from linux/compiler.h
      perf tools: Skip running the feature tests for 'make install-doc'

 Documentation/trace/kprobetrace.txt                |  9 ++-
 Documentation/trace/uprobetracer.txt               |  9 ++-
 kernel/trace/trace.c                               | 24 ++++++
 kernel/trace/trace_kprobe.c                        |  4 +
 kernel/trace/trace_probe.c                         | 30 ++++----
 kernel/trace/trace_probe.h                         | 11 ++-
 kernel/trace/trace_uprobe.c                        |  4 +
 tools/include/linux/coresight-pmu.h                | 39 ++++++++++
 tools/include/linux/time64.h                       | 12 +++
 tools/perf/Documentation/perf-config.txt           |  4 +
 tools/perf/Documentation/perf-probe.txt            |  5 +-
 tools/perf/MANIFEST                                |  2 +
 tools/perf/Makefile.perf                           |  5 +-
 tools/perf/bench/futex-requeue.c                   |  5 +-
 tools/perf/bench/futex-wake-parallel.c             |  5 +-
 tools/perf/bench/futex-wake.c                      |  5 +-
 tools/perf/bench/mem-functions.c                   |  3 +-
 tools/perf/bench/numa.c                            | 53 ++++++-------
 tools/perf/bench/sched-messaging.c                 |  5 +-
 tools/perf/bench/sched-pipe.c                      |  9 ++-
 tools/perf/builtin-diff.c                          |  4 +-
 tools/perf/builtin-kvm.c                           | 11 +--
 tools/perf/builtin-record.c                        |  8 +-
 tools/perf/builtin-report.c                        |  4 +
 tools/perf/builtin-sched.c                         | 37 ++++-----
 tools/perf/builtin-script.c                        |  7 +-
 tools/perf/builtin-stat.c                          | 19 ++---
 tools/perf/builtin-timechart.c                     | 13 ++--
 tools/perf/builtin-top.c                           |  3 +-
 tools/perf/builtin-trace.c                         |  1 +
 tools/perf/perf.h                                  |  7 --
 tools/perf/tests/backward-ring-buffer.c            |  2 +-
 tools/perf/tests/bpf.c                             |  2 +-
 tools/perf/ui/browsers/hists.c                     | 50 +++++++++----
 tools/perf/ui/gtk/hists.c                          |  2 +-
 tools/perf/ui/hist.c                               |  4 +-
 tools/perf/ui/stdio/hist.c                         | 45 +++++++----
 tools/perf/util/annotate.c                         | 87 +++++++++++-----------
 tools/perf/util/bpf-loader.c                       |  2 +-
 tools/perf/util/debug.c                            | 10 +--
 tools/perf/util/header.c                           |  3 +-
 tools/perf/util/hist.h                             |  3 +-
 tools/perf/util/probe-file.c                       | 57 ++++++++++++++
 tools/perf/util/probe-file.h                       | 10 +++
 tools/perf/util/probe-finder.c                     | 19 +++--
 .../perf/util/scripting-engines/trace-event-perl.c |  5 +-
 .../util/scripting-engines/trace-event-python.c    |  5 +-
 tools/perf/util/sort.c                             |  9 ++-
 tools/perf/util/sort.h                             |  2 +-
 tools/perf/util/svghelper.c                        | 11 +--
 tools/perf/util/util.c                             |  1 +
 tools/perf/util/util.h                             |  4 -
 52 files changed, 464 insertions(+), 226 deletions(-)
 create mode 100644 tools/include/linux/coresight-pmu.h
 create mode 100644 tools/include/linux/time64.h

Build Stats:

News:

The fedora:24-x-ARC-uClibc adds the ARC arch and the uClibc libc to the mix of
targets tested, still with a minimal build that doesn't include even libelf,
that will be added soon, using a more full featured pre-built toolchain provided
by the Synopsys folks.

  [root@jouet ~]# time dm
   1 70.304638757 alpine:3.4: Ok
   2 24.806303766 android-ndk:r12b-arm: Ok
   3 71.829633643 archlinux:latest: Ok
   4 39.316551941 centos:5: Ok
   5 59.282978228 centos:6: Ok
   6 69.836088394 centos:7: Ok
   7 63.476952272 debian:7: Ok
   8 69.450110099 debian:8: Ok
   9 72.484714796 debian:experimental: Ok
  10 69.730035221 fedora:20: Ok
  11 73.629813614 fedora:21: Ok
  12 71.955425760 fedora:22: Ok
  13 73.015579053 fedora:23: Ok
  14 81.186943795 fedora:24: Ok
  15 31.401503154 fedora:24-x-ARC-uClibc: Ok
  16 78.366606942 fedora:rawhide: Ok
  17 77.434661064 mageia:5: Ok
  18 74.491020416 opensuse:13.2: Ok
  19 71.673570141 opensuse:42.1: Ok
  20 79.587415167 opensuse:tumbleweed: Ok
  21 57.802976895 ubuntu:12.04.5: Ok
  22 68.505810699 ubuntu:14.04.4: Ok
  23 69.478057262 ubuntu:15.10: Ok
  24 65.596669700 ubuntu:16.04: Ok
  25 52.759886216 ubuntu:16.04-x-arm: Ok
  26 52.389293077 ubuntu:16.04-x-arm64: Ok
  27 52.319141734 ubuntu:16.04-x-powerpc64: Ok
  28 54.378287607 ubuntu:16.04-x-powerpc64el: Ok
  29 72.794919209 ubuntu:16.10: Ok
  30 53.351899868 ubuntu:16.10-x-s390: Ok
     1922.64s

  real	32m3.246s
  user	0m1.858s
  sys	0m2.363s
  [root@jouet ~]#

^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [GIT PULL 00/35] perf/core improvements and fixes
  2013-12-20 19:08 Arnaldo Carvalho de Melo
@ 2013-12-27 20:05 ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-27 20:05 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Adrian Hunter, Arun Sharma, Corey Ashford,
	David Ahern, Frederic Weisbecker, Jiri Olsa, Mike Galbraith,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra, Rodrigo Campos,
	Stephane Eranian, Steven Rostedt

Em Fri, Dec 20, 2013 at 04:08:35PM -0300, Arnaldo Carvalho de Melo escreveu:
> User visible changes:
> 
> Improvements:
> 
> . Do not show stats if workload fails in 'stat' (David Ahern)

Hi Ingo,

	Please hold on, as reported elsewhere, the above change broke
'perf stat valid-workload', so I removed it from my tree.

	I'll resubmit soon with a bunch more,

Thanks,

- Arnaldo

^ permalink raw reply	[flat|nested] 50+ messages in thread

* [GIT PULL 00/35] perf/core improvements and fixes
@ 2013-12-20 19:08 Arnaldo Carvalho de Melo
  2013-12-27 20:05 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 50+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-20 19:08 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Arun Sharma, Corey Ashford, David Ahern, Frederic Weisbecker,
	Jiri Olsa, Mike Galbraith, Namhyung Kim, Paul Mackerras,
	Peter Zijlstra, Rodrigo Campos, Stephane Eranian, Steven Rostedt,
	Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>

Hi Ingo,

	Please consider pulling,

Best regards,

- Arnaldo

The following changes since commit fa6e8e5f7cbf85f364ebd5a90525dbbe9de2083b:

  Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2013-12-18 14:07:26 +0100)

are available in the git repository at:


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

for you to fetch changes up to a419e512731892c3e7e661cd96e7f7d6a7acdc91:

  perf stat: Do not show stats if workload fails (2013-12-20 13:37:50 -0300)

----------------------------------------------------------------
User visible changes:

Improvements:

. Do not show stats if workload fails in 'stat' (David Ahern)

. Print session information only if --stdio is given (Namhyung Kim)

Developer stuff:

Fixes:

. Get rid of a duplicate va_end() in error reporting (Namhyung Kim)

. If a hist entry doesn't have symbol information, compare it with its
  address. Affects upcoming new feature (--cumulate) (Namhyung Kim)

Improvements:

. Make libtraceevent install target quieter (Jiri Olsa)

. Make tests/make output more compact (Jiri Olsa)

New APIs:

. Introduce pevent_filter_strerror() in libtraceevent, similar in
  purpose to libc's strerror() function. (Namhyung Kim)

Refactorings:

. Use perf_data_file methods to write output file in 'record' and
  'inject' (Jiri Olsa)

. Use pr_*() functions where applicable in 'report' (Namhyumg Kim)

. Add 'machine' 'addr_location' struct to have full picture (machine,
  thread, map, symbol, addr) for a (partially) resolved address, reducing
  function signatures (Arnaldo Carvalho de Melo)

. Reduce code duplication in the histogram entry creation/insertion. (Arnaldo Carvalho de Melo)

. Auto allocate annotation histogram data structures, (Arnaldo Carvalho de Melo)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

----------------------------------------------------------------
Arnaldo Carvalho de Melo (16):
      perf annotate: Auto allocate symbol per addr hist buckets
      perf hists: Leave symbol addr hist bucket auto alloc to symbol layer
      perf annotate: Add inc_samples method to addr_map_symbol
      perf top: Use hist_entry__inc_addr_sample
      perf annotate: Adopt methods from hists
      perf annotate: Make symbol__inc_addr_samples private
      perf report: Introduce helpers for processing callchains
      perf record: Simplify perf_record__write
      perf record: Rename 'perf_record' to plain 'record'
      perf tools: Rename 'perf_record_opts' to 'record_opts
      perf report: Rename 'perf_report' to 'report'
      perf ui browser: Remove misplaced __maybe_unused
      perf scripting python: Shorten function signatures
      perf scripting perl: Shorten function signatures
      perf mem: Remove unused parameter from dump_raw_samples()
      perf symbols: Add 'machine' member to struct addr_location

David Ahern (1):
      perf stat: Do not show stats if workload fails

Jiri Olsa (11):
      perf inject: Handle output file via perf_data_file object
      perf record: Use perf_data_file__write for output file
      perf tests: Factor make install tests
      perf tools: Making QUIET_(CLEAN|INSTAL) variables global
      tools lib traceevent: Remove print_app_build variable
      tools lib traceevent: Use global QUIET_CC build output
      tools lib traceevent: Add global QUIET_CC_FPIC build output
      tools lib traceevent: Use global QUIET_LINK build output
      tools lib traceevent: Use global QUIET_INSTALL build output
      tools lib traceevent: Use global QUIET_CLEAN build output
      tools lib traceevent: Use global 'O' processing code

Namhyung Kim (7):
      perf sort: Compare addresses if no symbol info
      perf sort: Do not compare dso again
      perf hists: Do not pass period and weight to add_hist_entry()
      tools lib traceevent: Introduce pevent_filter_strerror()
      perf tools: Get rid of a duplicate va_end() in error reporting routine
      perf report: Use pr_*() functions where applicable
      perf report: Print session information only if --stdio is given

 tools/lib/traceevent/Makefile                      |  85 +++----
 tools/lib/traceevent/event-parse.c                 |  17 +-
 tools/lib/traceevent/event-parse.h                 |   7 +-
 tools/lib/traceevent/parse-filter.c                |  98 ++++----
 tools/perf/builtin-annotate.c                      |  10 +-
 tools/perf/builtin-inject.c                        |  65 +++---
 tools/perf/builtin-kvm.c                           |   2 +-
 tools/perf/builtin-mem.c                           |   5 +-
 tools/perf/builtin-record.c                        |  94 ++++----
 tools/perf/builtin-report.c                        | 259 +++++++--------------
 tools/perf/builtin-script.c                        |  16 +-
 tools/perf/builtin-stat.c                          |  11 +-
 tools/perf/builtin-top.c                           |  23 +-
 tools/perf/builtin-trace.c                         |   2 +-
 tools/perf/config/utilities.mak                    |   7 -
 tools/perf/perf.h                                  |   2 +-
 tools/perf/tests/code-reading.c                    |   2 +-
 tools/perf/tests/keep-tracking.c                   |   2 +-
 tools/perf/tests/make                              |  38 ++-
 tools/perf/tests/open-syscall-tp-fields.c          |   2 +-
 tools/perf/tests/perf-record.c                     |   2 +-
 tools/perf/tests/perf-time-to-tsc.c                |   2 +-
 tools/perf/ui/browser.c                            |   2 +-
 tools/perf/util/annotate.c                         |  41 +++-
 tools/perf/util/annotate.h                         |   9 +-
 tools/perf/util/callchain.h                        |   2 +-
 tools/perf/util/debug.c                            |   1 -
 tools/perf/util/event.c                            |   1 +
 tools/perf/util/evlist.h                           |   7 +-
 tools/perf/util/evsel.c                            |   3 +-
 tools/perf/util/evsel.h                            |   4 +-
 tools/perf/util/hist.c                             |  21 +-
 tools/perf/util/hist.h                             |   3 -
 tools/perf/util/record.c                           |   9 +-
 .../perf/util/scripting-engines/trace-event-perl.c |  19 +-
 .../util/scripting-engines/trace-event-python.c    |  25 +-
 tools/perf/util/session.c                          |   4 +-
 tools/perf/util/session.h                          |   2 +-
 tools/perf/util/sort.c                             |  22 +-
 tools/perf/util/symbol.h                           |   1 +
 tools/perf/util/top.c                              |   2 +-
 tools/perf/util/top.h                              |   2 +-
 tools/perf/util/trace-event-scripting.c            |   3 +-
 tools/perf/util/trace-event.h                      |   1 -
 tools/scripts/Makefile.include                     |   4 +
 45 files changed, 415 insertions(+), 524 deletions(-)

^ permalink raw reply	[flat|nested] 50+ messages in thread

end of thread, other threads:[~2019-03-09 16:02 UTC | newest]

Thread overview: 50+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-07 17:43 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
2019-03-07 17:43 ` [PATCH 01/35] perf, bpf: Consider events with attr.bpf_event as side-band events Arnaldo Carvalho de Melo
2019-03-07 17:44 ` [PATCH 02/35] perf probe: Clarify error message about not finding kernel modules debuginfo Arnaldo Carvalho de Melo
2019-03-07 23:30   ` Masami Hiramatsu
2019-03-07 23:58     ` Arnaldo Carvalho de Melo
2019-03-07 17:44 ` [PATCH 03/35] tools lib traceevent: Fix buffer overflow in arg_eval Arnaldo Carvalho de Melo
2019-03-07 17:44 ` [PATCH 04/35] perf: Mark expected switch fall-through Arnaldo Carvalho de Melo
2019-03-07 17:44 ` [PATCH 05/35] perf time-utils: Refactor time range parsing code Arnaldo Carvalho de Melo
2019-03-07 17:44 ` [PATCH 06/35] perf auxtrace: Improve address filter error message when there is no DSO Arnaldo Carvalho de Melo
2019-03-07 17:44 ` [PATCH 07/35] perf intel-pt: Fix divide by zero when TSC is not available Arnaldo Carvalho de Melo
2019-03-07 17:44 ` [PATCH 08/35] perf db-export: Add calls parent_id to enable creation of call trees Arnaldo Carvalho de Melo
2019-03-07 17:44 ` [PATCH 09/35] perf scripts python: export-to-sqlite.py: Export calls parent_id Arnaldo Carvalho de Melo
2019-03-07 17:44 ` [PATCH 10/35] perf scripts python: export-to-postgresql.py: Fix invalid input syntax for integer error Arnaldo Carvalho de Melo
2019-03-07 17:44 ` [PATCH 11/35] perf scripts python: export-to-postgresql.py: Export calls parent_id Arnaldo Carvalho de Melo
2019-03-07 17:44 ` [PATCH 12/35] perf scripts python: exported-sql-viewer.py: Factor out TreeWindowBase Arnaldo Carvalho de Melo
2019-03-07 17:44 ` [PATCH 13/35] perf scripts python: exported-sql-viewer.py: Improve TreeModel abstraction Arnaldo Carvalho de Melo
2019-03-07 17:44 ` [PATCH 14/35] perf scripts python: exported-sql-viewer.py: Factor out CallGraphModelBase Arnaldo Carvalho de Melo
2019-03-07 17:44 ` [PATCH 15/35] perf scripts python: exported-sql-viewer.py: Add call tree Arnaldo Carvalho de Melo
2019-03-07 17:44 ` [PATCH 16/35] perf beauty msg_flags: Add missing %s lost when adding prefix suppression logic Arnaldo Carvalho de Melo
2019-03-07 17:44 ` [PATCH 17/35] perf bpf: Automatically add BTF ELF markers Arnaldo Carvalho de Melo
2019-03-07 17:44 ` [PATCH 18/35] perf clang: Remove needless extra semicolon Arnaldo Carvalho de Melo
2019-03-07 17:44 ` [PATCH 19/35] perf annotate: Calculate the max instruction name, align column to that Arnaldo Carvalho de Melo
2019-03-07 17:44 ` [PATCH 20/35] perf thread: Generalize function to copy from thread addr space from intel-bts code Arnaldo Carvalho de Melo
2019-03-07 17:44 ` [PATCH 21/35] perf diff: Support --time filter option Arnaldo Carvalho de Melo
2019-03-07 17:44 ` [PATCH 22/35] perf diff: Support --cpu " Arnaldo Carvalho de Melo
2019-03-07 17:44 ` [PATCH 23/35] perf diff: Support --pid/--tid filter options Arnaldo Carvalho de Melo
2019-03-07 17:44 ` [PATCH 24/35] perf script python: Remove mixed indentation Arnaldo Carvalho de Melo
2019-03-07 17:44 ` [PATCH 25/35] perf script python: Add Python3 support to futex-contention.py Arnaldo Carvalho de Melo
2019-03-07 17:44 ` [PATCH 26/35] perf script python: add Python3 support to check-perf-trace.py Arnaldo Carvalho de Melo
2019-03-07 17:44 ` [PATCH 27/35] perf script python: Add Python3 support to event_analyzing_sample.py Arnaldo Carvalho de Melo
2019-03-07 17:44 ` [PATCH 28/35] perf script python: Add Python3 support to intel-pt-events.py Arnaldo Carvalho de Melo
2019-03-07 17:44 ` [PATCH 29/35] perf c2c: Fix c2c report for empty numa node Arnaldo Carvalho de Melo
2019-03-07 17:44 ` [PATCH 30/35] perf hist: Add error path into hist_entry__init Arnaldo Carvalho de Melo
2019-03-07 17:44 ` [PATCH 31/35] perf hist: Fix memory leak of srcline Arnaldo Carvalho de Melo
2019-03-07 17:44 ` [PATCH 32/35] perf tools: Read and store caps/max_precise in perf_pmu Arnaldo Carvalho de Melo
2019-03-07 17:44 ` [PATCH 33/35] perf evsel: Probe for precise_ip with simple attr Arnaldo Carvalho de Melo
2019-03-07 17:44 ` [PATCH 34/35] perf session: Fix double free in perf_data__close Arnaldo Carvalho de Melo
2019-03-07 17:44 ` [PATCH 35/35] perf data: Force perf_data__open|close zero data->file.path Arnaldo Carvalho de Melo
2019-03-09 16:02 ` [GIT PULL 00/35] perf/core improvements and fixes Ingo Molnar
  -- strict thread matches above, loose matches on Subject: below --
2018-08-15 15:05 Arnaldo Carvalho de Melo
2018-08-15 15:21 ` Andy Lutomirski
2018-08-18 11:17 ` Ingo Molnar
2017-12-28 14:29 Arnaldo Carvalho de Melo
2017-12-28 15:17 ` Ingo Molnar
2017-03-06 19:37 Arnaldo Carvalho de Melo
2017-03-07  7:17 ` Ingo Molnar
2016-08-23 21:03 Arnaldo Carvalho de Melo
2016-08-24  9:09 ` Ingo Molnar
2013-12-20 19:08 Arnaldo Carvalho de Melo
2013-12-27 20:05 ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).