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

From: Arnaldo Carvalho de Melo
Date: Wed Apr 27 2016 - 10:32:37 EST


From: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>

Hi Ingo,

Please consider pulling,

- Arnaldo

The following changes since commit 67d61296ffcc850bffdd4466430cb91e5328f39a:

Merge tag 'perf-core-for-mingo-20160419' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux (2016-04-23 14:50:39 +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-20160427

for you to fetch changes up to 4cb93446c587d56e2a54f4f83113daba2c0b6dee:

perf tools: Set the maximum allowed stack from /proc/sys/kernel/perf_event_max_stack (2016-04-27 10:29:07 -0300)

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

User visible:

- perf trace --pf maj/min/all works with --call-graph: (Arnaldo Carvalho de Melo)

Tracing write syscalls and major page faults with callchains while starting
firefox, limiting the stack to 5 frames:

# perf trace -e write --pf maj --max-stack 5 firefox
589.549 ( 0.014 ms): firefox/15377 write(fd: 4, buf: 0x7fff80acc898, count: 151) = 151
[0xfaed] (/usr/lib64/libpthread-2.22.so)
fire_glxtest_process+0x5c (/usr/lib64/firefox/libxul.so)
InstallGdkErrorHandler+0x41 (/usr/lib64/firefox/libxul.so)
XREMain::XRE_mainInit+0x12c (/usr/lib64/firefox/libxul.so)
XREMain::XRE_main+0x1e4 (/usr/lib64/firefox/libxul.so)
760.704 ( 0.000 ms): firefox/15332 majfault [gtk_tree_view_accessible_get_type+0x0] => /usr/lib64/libgtk-3.so.0.1800.9@0xa0850 (x.)
gtk_tree_view_accessible_get_type+0x0 (/usr/lib64/libgtk-3.so.0.1800.9)
gtk_tree_view_class_intern_init+0x1a54 (/usr/lib64/libgtk-3.so.0.1800.9)
g_type_class_ref+0x6dd (/usr/lib64/libgobject-2.0.so.0.4600.2)
[0x115378] (/usr/lib64/libgnutls.so.30.6.3)

This automagically selects "--call-graph dwarf", use "--call-graph fp" on systems
where -fno-omit-frame-pointer was used to built the components of interest, to
incur in less overhead, or tune "--call-graph dwarf" appropriately, see 'perf record --help'.

- Allow /proc/sys/kernel/perf_event_max_stack, that defaults to the old hard coded value
of PERF_MAX_STACK_DEPTH (127), useful for huge callstacks for things like Groovy, Ruby, etc,
and also to reduce overhead by limiting it to a smaller value, upcoming work will allow
this to be done per-event (Arnaldo Carvalho de Melo)

- Make 'perf trace --min-stack' be honoured by --pf and --event (Arnaldo Carvalho de Melo)

- Make 'perf evlist -v' decode perf_event_attr->branch_sample_type (Arnaldo Carvalho de Melo)

# perf record --call lbr usleep 1
# perf evlist -v
cycles:ppp: ... sample_type: IP|TID|TIME|CALLCHAIN|PERIOD|BRANCH_STACK, ...
branch_sample_type: USER|CALL_STACK|NO_FLAGS|NO_CYCLES
#

- Clear dummy entry accumulated period, fixing such 'perf top/report' output
as: (Kan Liang)

4769.98% 0.01% 0.00% 0.01% tchain_edit [kernel] [k] update_fast_timekeeper

- System calls with pid_t arguments gets them augmented with the COMM event
more thoroughly:

# trace -e perf_event_open perf stat -e cycles -p 15608
6.876 ( 0.014 ms): perf_event_open(attr_uptr: 0x2ae20d8, pid: 15608 (hexchat), cpu: -1, group_fd: -1, flags: FD_CLOEXEC) = 3
6.882 ( 0.005 ms): perf_event_open(attr_uptr: 0x2ae20d8, pid: 15639 (gmain), cpu: -1, group_fd: -1, flags: FD_CLOEXEC) = 4
6.889 ( 0.005 ms): perf_event_open(attr_uptr: 0x2ae20d8, pid: 15640 (gdbus), cpu: -1, group_fd: -1, flags: FD_CLOEXEC) = 5
^^^^^^^^^^^^^^^^^^
^C

- Fix offline module name mismatch issue in 'perf probe' (Ravi Bangoria)

- Fix module probe issue if no dwarf support in (Ravi Bangoria)

Assorted fixes:

- Fix off-by-one in write_buildid() (Andrey Ryabinin)

- Fix segfault when printing callchains in 'perf script' (Chris Phlipot)

- Replace assignment with comparison on assert check in 'perf test' entry (Colin Ian King)

- Fix off-by-one comparison in intel-pt code (Colin Ian King)

- Close target file on error path in 'perf probe' (Masami Hiramatsu)

- Set default kprobe group name if not given in 'perf probe' (Masami Hiramatsu)

- Avoid partial perf_event_header reads (Wang Nan)

Infrastructure:

- Update x86's syscall_64.tbl copy, adding preadv2 & pwritev2 (Arnaldo Carvalho de Melo)

- Make the x86 clean quiet wrt syscall table removal (Jiri Olsa)

Cleanups:

- Simplify wrapper for LOCK_PI in 'perf bench futex' (Davidlohr Bueso)

- Remove duplicate const qualifier (Eric Engestrom)

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

----------------------------------------------------------------
Andrey Ryabinin (1):
perf buildid: Fix off-by-one in write_buildid()

Arnaldo Carvalho de Melo (14):
perf trace: Extract evsel contructor from perf_evlist__add_pgfault
perf trace: Make --pf maj/min/all use callchains too
perf trace: Make --event honour --min-stack too
perf trace: Make --pf honour --min-stack too
perf evlist: Decode perf_event_attr->branch_sample_type
perf trace: Move perf_flags beautifier to tools/perf/trace/beauty/
perf trace: Do not beautify the 'pid' parameter as a simple integer
tools lib api fs: Add helper to read string from procfs file
perf thread: Introduce method to set comm from /proc/pid/self
perf trace: Read thread's COMM from /proc when not set
perf tools: Update x86's syscall_64.tbl, adding preadv2 & pwritev2
perf bench: Remove one more die() call
perf core: Allow setting up max frame stack depth via sysctl
perf tools: Set the maximum allowed stack from /proc/sys/kernel/perf_event_max_stack

Chris Phlipot (1):
perf script: Fix segfault when printing callchains

Colin Ian King (2):
perf tests: Replace assignment with comparison on assert check
perf intel-pt: Fix off-by-one comparison on maximum code

Davidlohr Bueso (1):
perf bench futex: Simplify wrapper for LOCK_PI

Eric Engestrom (1):
perf tools: Remove duplicate const qualifier

Jiri Olsa (2):
perf tools: Make the x86 clean quiet
tools build: Fix perf_clean target

Kan Liang (1):
perf hists: Clear dummy entry accumulated period

Masami Hiramatsu (4):
perf probe: Close target file on error path
perf tools: Add lsdir() helper to read a directory
perf probe: Let probe_file__add_event return 0 if succeeded
perf probe: Set default kprobe group name if it is not given

Ravi Bangoria (2):
perf probe: Fix offline module name missmatch issue
perf probe: Fix module probe issue if no dwarf support

Wang Nan (1):
perf evlist: Enforce ring buffer reading

Documentation/sysctl/kernel.txt | 14 ++
arch/arm/kernel/perf_callchain.c | 2 +-
arch/arm64/kernel/perf_callchain.c | 4 +-
arch/metag/kernel/perf_callchain.c | 2 +-
arch/mips/kernel/perf_event.c | 4 +-
arch/powerpc/perf/callchain.c | 4 +-
arch/sparc/kernel/perf_event.c | 6 +-
arch/x86/events/core.c | 4 +-
arch/xtensa/kernel/perf_event.c | 4 +-
include/linux/perf_event.h | 8 +-
kernel/bpf/stackmap.c | 8 +-
kernel/events/callchain.c | 35 ++++-
kernel/sysctl.c | 12 ++
tools/Makefile | 3 +-
tools/lib/api/fs/fs.c | 13 ++
tools/lib/api/fs/fs.h | 2 +
tools/perf/Documentation/perf-report.txt | 2 +-
tools/perf/Documentation/perf-script.txt | 2 +-
tools/perf/Documentation/perf-top.txt | 2 +-
tools/perf/Documentation/perf-trace.txt | 2 +-
tools/perf/arch/x86/Makefile | 2 +-
tools/perf/arch/x86/entry/syscalls/syscall_64.tbl | 2 +
tools/perf/bench/futex-lock-pi.c | 2 +-
tools/perf/bench/futex.h | 6 +-
tools/perf/bench/mem-functions.c | 22 ++-
tools/perf/builtin-report.c | 4 +-
tools/perf/builtin-script.c | 16 +-
tools/perf/builtin-top.c | 4 +-
tools/perf/builtin-trace.c | 174 +++++++++++----------
tools/perf/perf.c | 5 +
tools/perf/tests/event_update.c | 2 +-
tools/perf/tests/hists_cumulate.c | 2 +-
tools/perf/tests/hists_filter.c | 2 +-
tools/perf/tests/hists_output.c | 2 +-
tools/perf/trace/beauty/perf_event_open.c | 43 +++++
tools/perf/trace/beauty/pid.c | 5 +-
tools/perf/util/build-id.c | 6 +-
tools/perf/util/evlist.c | 12 +-
tools/perf/util/evsel.c | 18 ++-
tools/perf/util/hist.c | 2 +
.../perf/util/intel-pt-decoder/intel-pt-decoder.c | 2 +-
tools/perf/util/machine.c | 6 +-
tools/perf/util/probe-event.c | 114 +++++++++++---
tools/perf/util/probe-file.c | 3 +-
.../perf/util/scripting-engines/trace-event-perl.c | 2 +-
tools/perf/util/thread.c | 21 ++-
tools/perf/util/thread.h | 2 +
tools/perf/util/util.c | 36 +++++
tools/perf/util/util.h | 4 +
49 files changed, 475 insertions(+), 179 deletions(-)
create mode 100644 tools/perf/trace/beauty/perf_event_open.c