[GIT PULL 00/66] perf/core improvements and fixes

From: Arnaldo Carvalho de Melo
Date: Tue Jul 12 2016 - 18:51:29 EST


Hi Ingo,

Please consider pulling, several more patches in my queue pending
review, this branch now builds in all of these systems, with Alpine Linux, that
uses different versions of libelf, libc helping in keeping this codebase
portable, soon I'll add containers for the Android SDK and Yocto:

# perf stat dm
alpine:3.4: Ok
centos:5: Ok
centos:6: Ok
centos:7: Ok
debian:7: Ok
debian:8: Ok
debian:experimental: Ok
fedora:21: Ok
fedora:22: Ok
fedora:23: Ok
fedora:24: Ok
fedora:rawhide: Ok
mageia:5: Ok
opensuse:13.2: Ok
opensuse:42.1: Ok
ubuntu:12.04.5: Ok
ubuntu:14.04.4: Ok
ubuntu:15.10: Ok
ubuntu:16.04: Ok

Performance counter stats for 'dm':

1734.724897 task-clock (msec) # 0.003 CPUs utilized
70,156 context-switches # 0.040 M/sec
7,182 cpu-migrations # 0.004 M/sec
51,490 page-faults # 0.030 M/sec
5,093,434,618 cycles # 2.936 GHz
4,839,787,241 instructions # 0.95 insn per cycle
898,488,442 branches # 517.943 M/sec
16,155,791 branch-misses # 1.80% of all branches

684.926493347 seconds time elapsed
#

- Arnaldo

The following changes since commit 44530d588e142a96cf0cd345a7cb8911c4f88720:

Revert "perf/x86/intel, watchdog: Switch NMI watchdog to ref cycles on x86" (2016-07-10 20:58:36 +0200)

are available in the git repository at:

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

for you to fetch changes up to 6d248fbda59c51ef5f2e90e11551d9e17aeb226f:

tools lib traceevent: Add filter on task CPU id (2016-07-12 16:27:39 -0300)

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

User visible:

- Add demangling of symbols in programs written in the Rust language (David Tolnay)

- Add support for tracepoints in the python binding, including an example, that
sets up and parses sched:sched_switch events, tools/perf/python/tracepoint.py
(Jiri Olsa)

- Introduce --stdio-color to setup the color output mode selection in
'annotate' and 'report', allowing emit color escape sequences when
redirecting the output of these tools (Arnaldo Carvalho de Melo)

Infrastructure:

- Various tweaks to allow the 'perf trace' beautifiers to build without using
kernel headers and in a wider range of Linux distributions/releases (Arnaldo Carvalho de Melo)

- Stop using kernel source files, instead copy what is needed and
check when the original kernel source file gets modified, warning
the developers about it. This helps in building the tool in older
systems and even in recent ones, for just added kernel features
for which ABI details (struct changes, defines, etc) still are not
available on system headers (Arnaldo Carvalho de Melo)

- Be consistent in how to use strerror_r, adding a wrapper that makes sure that
it returns a pointer to passed buffer, and using the XSI variant, that is
available in more libc implementations (Arnaldo Carvalho de Melo)

- Avoid checking code drift on busibox's diff perf intel-pt-decoder, as it
doesn't have the '-I' command line switch to check for regexps (Arnaldo Carvalho de Melo)

- Add missing headers in various places (Arnaldo Carvalho de Melo)

- Remove unneeded headers from various other places (Arnaldo Carvalho de Melo)

- Add feature detection for gelf_getnote(), disabling SDT support if not
present (Arnaldo Carvalho de Melo)

- Fix oddities with gcc 5.3.0 by initializing some variables (Arnaldo Carvalho de Melo)

- With those changes in place perf now builds on Alpine Linux 3.4, in addition to
on centos (5, 6, 7), debian (7, 8, experimental), fedora (21, 22, 23, 24, rawhide),
mageia 5, opensuse (13.2, 42.1) and ubuntu (12.04.5, 14.04.4, 15.10, 16.04) and
will be test build on those systems prior to future pull requests.

Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>

----------------------------------------------------------------
Arnaldo Carvalho de Melo (52):
perf ui stdio: Add way to setup the color output mode selection
perf annotate: Introduce --stdio-color to setup the color output mode selection
perf report: Introduce --stdio-color to setup the color output mode selection
perf trace beauty msg_flags: Remove MSG_TRYHARD
perf trace beauty flock: Add missing fcntl.h include
perf trace beauty open_flags: Add missing headers
perf trace beauty mmap: Add more conditional defines
perf trace beauty flock: Add more conditional defines
perf trace beauty open_flags: Add more conditional defines
tools: Introduce str_error_r()
perf bench: Add missing pthread.h include for CPU_*() macros
perf tests: Add missing pthread.h include for CPU_*() macros
perf trace: Add conditional define for AT_FDCWD
perf tests openat-syscall-tp-fields: Add some conditional defines
perf bench: Disentangle headers
perf tools: Move syscall number fallbacks from perf-sys.h to tools/arch/x86/include/asm/
perf strbuf: Add missing headers
perf quote: Disentangle headers
perf tests cpumap: Add missing headers
perf test fdarray: Add missing poll.h header
perf tests x86 rdpmc: Add missing headers
perf tools: Add missing header to color.c
perf tools: Remove needless includes from cache.h
perf evsel: Uninline the is_function_event method
perf tools: Uninline scnprintf() and vscnprint()
tools lib traceevent: Use str_error_r()
tools lib api fs: Use str_error_r()
tools lib: Guard the strlcpy() header with __GLIBC__
tools lib subcmd: Use str_error_r()
perf bench futex: Add missing compiler.h header
perf tools: event.h needs asm/perf_regs.h
tools: Add copy of perf_event.h to tools/include/linux/
perf bench: Copy kernel files needed to build mem{cpy,set} x86_64 benchmarks
tools lib bpf: Copy bpf.h and bpf_common.h from the kernel
tools: Copy uapi/asm/perf_regs.h from the kernel
perf test bpf: Use epoll_wait() instead of epoll_pwait()
tools: Copy uapi/linux/hw_breakpoint.h from the kernel
perf tools: Introduce weak alternative to sched_getcpu()
perf tools: Remove unneeded magic.h include from util.h
perf trace: Remove unused sys/ptrace.h include
kvm arm/arm64: Remove trailing whitespace from headers
tools: Copy the header files needed by perf tools
perf tools: Fallback to reading sysfs to get cacheline size
perf trace beauty futex_op: Add missing defines for older systems
perf trace beauty seccomp: Remove seccomp.h include
perf symbols: Provide a GElf_Nhdr typedef
perf script python: Silence -Werror=maybe-uninitialized on gcc 5.3.0
tools: Copy the bitsperlong.h files from the kernel
perf tools: Add the tools/ stringify copy to the MANIFEST
perf tools: Don't add kernel directories to the header search path
perf intel-pt-decoder: Avoid checking code drift on busibox's diff
perf tools: Add feature detection for gelf_getnote()

David Tolnay (1):
perf symbols: Add Rust demangling

Jiri Olsa (12):
perf hists: Introduce hist_entry__init function
perf hists: Introduce hist_entry_ops
perf hists: Introduce hists__add_entry_ops function
perf evlist: Make event2evsel public
perf tools: Introduce trace_event__tp_format_id()
perf python: Init perf_event_attr::size in perf.evsel constructor
perf python: Fix pyrf_evlist__read_on_cpu event consuming
perf python: Put perf.event objects into dictionary
perf python: Add perf.tracepoint method
perf python: Add struct evsel into struct pyrf_event
perf python: Add support to resolve tracepoint fields
perf python: Add tracepoint example

Steven Rostedt (1):
tools lib traceevent: Add filter on task CPU id

arch/arm/include/uapi/asm/kvm.h | 4 +-
tools/arch/alpha/include/uapi/asm/bitsperlong.h | 8 +
tools/arch/arm/include/uapi/asm/kvm.h | 224 +++++
tools/arch/arm/include/uapi/asm/perf_regs.h | 23 +
tools/arch/arm64/include/uapi/asm/bitsperlong.h | 23 +
tools/arch/arm64/include/uapi/asm/kvm.h | 258 ++++++
tools/arch/arm64/include/uapi/asm/perf_regs.h | 40 +
tools/arch/frv/include/uapi/asm/bitsperlong.h | 1 +
tools/arch/h8300/include/asm/bitsperlong.h | 14 +
tools/arch/hexagon/include/uapi/asm/bitsperlong.h | 26 +
tools/arch/ia64/include/uapi/asm/bitsperlong.h | 8 +
tools/arch/m32r/include/uapi/asm/bitsperlong.h | 1 +
.../arch/microblaze/include/uapi/asm/bitsperlong.h | 1 +
tools/arch/mips/include/uapi/asm/bitsperlong.h | 8 +
tools/arch/mips/include/uapi/asm/kvm.h | 208 +++++
tools/arch/mn10300/include/uapi/asm/bitsperlong.h | 1 +
tools/arch/parisc/include/uapi/asm/bitsperlong.h | 14 +
tools/arch/powerpc/include/uapi/asm/bitsperlong.h | 12 +
tools/arch/powerpc/include/uapi/asm/kvm.h | 612 +++++++++++++
tools/arch/powerpc/include/uapi/asm/perf_regs.h | 50 ++
tools/arch/s390/include/uapi/asm/bitsperlong.h | 12 +
tools/arch/s390/include/uapi/asm/kvm.h | 192 ++++
tools/arch/s390/include/uapi/asm/kvm_perf.h | 25 +
tools/arch/s390/include/uapi/asm/sie.h | 250 ++++++
tools/arch/score/include/uapi/asm/bitsperlong.h | 6 +
tools/arch/sparc/include/uapi/asm/bitsperlong.h | 12 +
tools/arch/tile/include/uapi/asm/bitsperlong.h | 26 +
tools/arch/x86/include/asm/cpufeatures.h | 316 +++++++
tools/arch/x86/include/asm/disabled-features.h | 60 ++
tools/arch/x86/include/asm/required-features.h | 103 +++
tools/arch/x86/include/asm/unistd_32.h | 12 +
tools/arch/x86/include/asm/unistd_64.h | 12 +
tools/arch/x86/include/uapi/asm/bitsperlong.h | 12 +
tools/arch/x86/include/uapi/asm/kvm.h | 360 ++++++++
tools/arch/x86/include/uapi/asm/kvm_perf.h | 16 +
tools/arch/x86/include/uapi/asm/perf_regs.h | 33 +
tools/arch/x86/include/uapi/asm/svm.h | 178 ++++
tools/arch/x86/include/uapi/asm/vmx.h | 136 +++
tools/arch/x86/lib/memcpy_64.S | 297 +++++++
tools/arch/x86/lib/memset_64.S | 138 +++
tools/build/Makefile.feature | 1 +
tools/build/feature/Makefile | 4 +
tools/build/feature/test-all.c | 5 +
tools/build/feature/test-libelf-gelf_getnote.c | 7 +
tools/include/asm-generic/bitops/__ffs.h | 1 +
tools/include/asm-generic/bitops/atomic.h | 1 +
tools/include/asm-generic/bitsperlong.h | 25 +
.../{perf/util => }/include/asm/alternative-asm.h | 4 +-
tools/include/linux/kernel.h | 28 +-
tools/include/linux/string.h | 4 +-
tools/include/uapi/asm-generic/bitsperlong.h | 15 +
tools/include/uapi/linux/bpf.h | 389 ++++++++
tools/include/uapi/linux/bpf_common.h | 55 ++
tools/include/uapi/linux/hw_breakpoint.h | 30 +
tools/include/uapi/linux/perf_event.h | 983 +++++++++++++++++++++
tools/lib/api/Makefile | 1 +
tools/lib/api/fs/tracing_path.c | 3 +-
tools/lib/bpf/Makefile | 8 +-
tools/lib/str_error_r.c | 26 +
tools/lib/subcmd/run-command.c | 5 +-
tools/lib/traceevent/event-parse.c | 8 +-
tools/lib/traceevent/parse-filter.c | 18 +-
tools/lib/vsprintf.c | 24 +
tools/objtool/Build | 5 +
tools/objtool/builtin-check.c | 1 +
tools/perf/Documentation/perf-annotate.txt | 7 +
tools/perf/Documentation/perf-report.txt | 7 +
tools/perf/MANIFEST | 41 +-
tools/perf/Makefile.perf | 63 ++
tools/perf/arch/common.c | 1 +
tools/perf/arch/x86/tests/rdpmc.c | 8 +-
tools/perf/bench/futex-hash.c | 15 +-
tools/perf/bench/futex-lock-pi.c | 11 +-
tools/perf/bench/futex-requeue.c | 11 +-
tools/perf/bench/futex-wake-parallel.c | 11 +-
tools/perf/bench/futex-wake.c | 11 +-
tools/perf/bench/mem-memcpy-x86-64-asm.S | 2 +-
tools/perf/bench/mem-memset-x86-64-asm.S | 2 +-
tools/perf/bench/numa.c | 4 +-
tools/perf/builtin-annotate.c | 3 +
tools/perf/builtin-buildid-cache.c | 8 +-
tools/perf/builtin-help.c | 8 +-
tools/perf/builtin-kvm.c | 4 +-
tools/perf/builtin-probe.c | 2 +-
tools/perf/builtin-record.c | 6 +-
tools/perf/builtin-report.c | 3 +
tools/perf/builtin-sched.c | 2 +-
tools/perf/builtin-stat.c | 4 +-
tools/perf/builtin-top.c | 6 +-
tools/perf/builtin-trace.c | 9 +-
tools/perf/config/Makefile | 16 +-
tools/perf/perf-sys.h | 18 -
tools/perf/perf.c | 18 +-
tools/perf/python/tracepoint.py | 47 +
tools/perf/tests/backward-ring-buffer.c | 4 +-
tools/perf/tests/bpf-script-example.c | 4 +-
tools/perf/tests/bpf.c | 10 +-
tools/perf/tests/builtin-test.c | 2 +-
tools/perf/tests/cpumap.c | 7 +
tools/perf/tests/event-times.c | 2 +-
tools/perf/tests/fdarray.c | 1 +
tools/perf/tests/llvm.c | 1 +
tools/perf/tests/mmap-basic.c | 9 +-
tools/perf/tests/openat-syscall-all-cpus.c | 7 +-
tools/perf/tests/openat-syscall-tp-fields.c | 11 +-
tools/perf/tests/openat-syscall.c | 2 +-
tools/perf/tests/perf-record.c | 11 +-
tools/perf/tests/sw-clock.c | 4 +-
tools/perf/tests/task-exit.c | 4 +-
tools/perf/trace/beauty/flock.c | 17 +
tools/perf/trace/beauty/futex_op.c | 16 +
tools/perf/trace/beauty/mmap.c | 77 +-
tools/perf/trace/beauty/msg_flags.c | 1 -
tools/perf/trace/beauty/open_flags.c | 15 +
tools/perf/trace/beauty/seccomp.c | 2 -
tools/perf/ui/browsers/hists.c | 2 +-
tools/perf/ui/gtk/util.c | 1 +
tools/perf/ui/helpline.c | 1 +
tools/perf/ui/setup.c | 7 +
tools/perf/ui/tui/setup.c | 2 +
tools/perf/ui/ui.h | 4 +
tools/perf/util/Build | 11 +
tools/perf/util/alias.c | 1 +
tools/perf/util/bpf-loader.c | 2 +-
tools/perf/util/build-id.c | 2 +-
tools/perf/util/cache.h | 3 -
tools/perf/util/cloexec.c | 18 +-
tools/perf/util/color.c | 3 +
tools/perf/util/data.c | 4 +-
tools/perf/util/debug.h | 2 +-
tools/perf/util/demangle-rust.c | 269 ++++++
tools/perf/util/demangle-rust.h | 7 +
tools/perf/util/dso.c | 6 +-
tools/perf/util/dso.h | 1 +
tools/perf/util/event.h | 1 +
tools/perf/util/evlist.c | 8 +-
tools/perf/util/evlist.h | 3 +
tools/perf/util/evsel.c | 20 +-
tools/perf/util/evsel.h | 18 +-
tools/perf/util/help-unknown-cmd.c | 1 +
tools/perf/util/hist.c | 204 +++--
tools/perf/util/hist.h | 11 +
tools/perf/util/include/asm/unistd_32.h | 1 -
tools/perf/util/include/asm/unistd_64.h | 1 -
tools/perf/util/intel-pt-decoder/Build | 5 +-
tools/perf/util/levenshtein.c | 4 +-
tools/perf/util/llvm-utils.c | 10 +-
tools/perf/util/path.c | 2 +
tools/perf/util/probe-event.c | 6 +-
tools/perf/util/probe-file.c | 12 +-
tools/perf/util/probe-finder.c | 4 +-
tools/perf/util/python-ext-sources | 2 +
tools/perf/util/python.c | 162 +++-
tools/perf/util/quote.c | 4 +-
tools/perf/util/quote.h | 3 +-
.../util/scripting-engines/trace-event-python.c | 4 +-
tools/perf/util/sort.h | 6 +
tools/perf/util/strbuf.c | 2 +-
tools/perf/util/strbuf.h | 3 +
tools/perf/util/symbol-elf.c | 11 +
tools/perf/util/target.c | 3 +-
tools/perf/util/trace-event.c | 8 +
tools/perf/util/trace-event.h | 2 +
tools/perf/util/util.h | 6 +-
164 files changed, 6478 insertions(+), 333 deletions(-)
create mode 100644 tools/arch/alpha/include/uapi/asm/bitsperlong.h
create mode 100644 tools/arch/arm/include/uapi/asm/kvm.h
create mode 100644 tools/arch/arm/include/uapi/asm/perf_regs.h
create mode 100644 tools/arch/arm64/include/uapi/asm/bitsperlong.h
create mode 100644 tools/arch/arm64/include/uapi/asm/kvm.h
create mode 100644 tools/arch/arm64/include/uapi/asm/perf_regs.h
create mode 100644 tools/arch/frv/include/uapi/asm/bitsperlong.h
create mode 100644 tools/arch/h8300/include/asm/bitsperlong.h
create mode 100644 tools/arch/hexagon/include/uapi/asm/bitsperlong.h
create mode 100644 tools/arch/ia64/include/uapi/asm/bitsperlong.h
create mode 100644 tools/arch/m32r/include/uapi/asm/bitsperlong.h
create mode 100644 tools/arch/microblaze/include/uapi/asm/bitsperlong.h
create mode 100644 tools/arch/mips/include/uapi/asm/bitsperlong.h
create mode 100644 tools/arch/mips/include/uapi/asm/kvm.h
create mode 100644 tools/arch/mn10300/include/uapi/asm/bitsperlong.h
create mode 100644 tools/arch/parisc/include/uapi/asm/bitsperlong.h
create mode 100644 tools/arch/powerpc/include/uapi/asm/bitsperlong.h
create mode 100644 tools/arch/powerpc/include/uapi/asm/kvm.h
create mode 100644 tools/arch/powerpc/include/uapi/asm/perf_regs.h
create mode 100644 tools/arch/s390/include/uapi/asm/bitsperlong.h
create mode 100644 tools/arch/s390/include/uapi/asm/kvm.h
create mode 100644 tools/arch/s390/include/uapi/asm/kvm_perf.h
create mode 100644 tools/arch/s390/include/uapi/asm/sie.h
create mode 100644 tools/arch/score/include/uapi/asm/bitsperlong.h
create mode 100644 tools/arch/sparc/include/uapi/asm/bitsperlong.h
create mode 100644 tools/arch/tile/include/uapi/asm/bitsperlong.h
create mode 100644 tools/arch/x86/include/asm/cpufeatures.h
create mode 100644 tools/arch/x86/include/asm/disabled-features.h
create mode 100644 tools/arch/x86/include/asm/required-features.h
create mode 100644 tools/arch/x86/include/asm/unistd_32.h
create mode 100644 tools/arch/x86/include/asm/unistd_64.h
create mode 100644 tools/arch/x86/include/uapi/asm/bitsperlong.h
create mode 100644 tools/arch/x86/include/uapi/asm/kvm.h
create mode 100644 tools/arch/x86/include/uapi/asm/kvm_perf.h
create mode 100644 tools/arch/x86/include/uapi/asm/perf_regs.h
create mode 100644 tools/arch/x86/include/uapi/asm/svm.h
create mode 100644 tools/arch/x86/include/uapi/asm/vmx.h
create mode 100644 tools/arch/x86/lib/memcpy_64.S
create mode 100644 tools/arch/x86/lib/memset_64.S
create mode 100644 tools/build/feature/test-libelf-gelf_getnote.c
create mode 100644 tools/include/asm-generic/bitsperlong.h
rename tools/{perf/util => }/include/asm/alternative-asm.h (66%)
create mode 100644 tools/include/uapi/asm-generic/bitsperlong.h
create mode 100644 tools/include/uapi/linux/bpf.h
create mode 100644 tools/include/uapi/linux/bpf_common.h
create mode 100644 tools/include/uapi/linux/hw_breakpoint.h
create mode 100644 tools/include/uapi/linux/perf_event.h
create mode 100644 tools/lib/str_error_r.c
create mode 100644 tools/lib/vsprintf.c
create mode 100755 tools/perf/python/tracepoint.py
create mode 100644 tools/perf/util/demangle-rust.c
create mode 100644 tools/perf/util/demangle-rust.h
delete mode 100644 tools/perf/util/include/asm/unistd_32.h
delete mode 100644 tools/perf/util/include/asm/unistd_64.h