perf/core improvements and fixes
Subsystems (2)
Arnaldo Carvalho de Melo
maintainerHi Ingo,
Please consider pulling, more to come soon,
- Arnaldo
Build and test results at the end of this message.
The following changes since commit 6b652de2b27c0a4020ce0e8f277e782b6af76096:
Merge tag 'perf-core-for-mingo-20160922' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2016-09-23 07:21:38 +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-20160929
for you to fetch changes up to d18019a53a07e009899ff6b8dc5ec30f249360d9:
perf tests: Add dwarf unwind test for powerpc (2016-09-29 11:18:21 -0300)
----------------------------------------------------------------
perf/core improvements and fixes:
User visible:
-------------
New features:
- Add support for using symbols in address filters with Intel PT and ARM CoreSight (hardware assisted tracing facilities) (Adrian Hunter, Mathieu Poirier)
Fixes:
- Fix MMAP event synthesis for pre-existing threads when no hugetlbfs mount is in place (Adrian Hunter)
- Don't ignore kernel idle symbols in 'perf script' (Adrian Hunter)
- Assorted Intel PT fixes (Adrian Hunter)
Improvements:
- Fix handling of C++ symbols in 'perf probe' (Masami Hiramatsu)
- Beautify sched_[gs]et_attr return value in 'perf trace' (Arnaldo Carvalho de Melo)
Infrastructure:
---------------
New features:
- Add dwarf unwind 'perf test' for powerpc (Ravi Bangoria)
Fixes:
- Fix error paths in 'perf record' (Adrian Hunter)
Documentation:
- Update documentation info about quipper, a C++ parser for converting to/from perf.data/chromium profiling format (Simon Que)
Build Fixes:
Fix building in 32 bit platform with libbabeltrace (Wang Nan)
----------------------------------------------------------------
Adrian Hunter (16):
perf record: Fix documentation 'event_sources' -> 'event_source' perf tools: Fix MMAP event synthesis broken by MAP_HUGETLB change perf script: Fix vanished idle symbols
perf record: Rename label 'out_symbol_exit'
perf record: Fix error paths
perf symbols: Add dso__last_symbol()
perf record: Add support for using symbols in address filters perf probe: Increase debug level of SDT debug messages perf intel-pt: Fix snapshot overlap detection decoder errors perf intel-pt: Add support for recording the max non-turbo ratio perf intel-pt: Fix missing error codes processing auxtrace_info perf intel-pt: Add a helper function for processing AUXTRACE_INFO perf intel-pt: Record address filter in AUXTRACE_INFO event perf intel-pt: Read address filter from AUXTRACE_INFO event perf intel-pt: Enable decoder to handle TIP.PGD with missing IP perf intel-pt: Fix decoding when there are address filters
Arnaldo Carvalho de Melo (1):
perf trace: Beautify sched_[gs]et_attr return value
Masami Hiramatsu (4):
perf probe: Ignore the error of finding inline instance perf probe: Skip if the function address is 0
perf probe: Fix to cut off incompatible chars from group name perf probe: Match linkage name with mangled name
Mathieu Poirier (3):
perf tools: Make perf_evsel__append_filter() generic perf evsel: New tracepoint specific function perf evsel: Add support for address filters
Ravi Bangoria (1):
perf tests: Add dwarf unwind test for powerpc
Simon Que (1):
perf tools: Update documentation info about quipper
Wang Nan (1):
perf data: Fix building in 32 bit platform with libbabeltrace
tools/perf/Documentation/perf-record.txt | 61 +- tools/perf/Documentation/perf.data-file-format.txt | 6 +- tools/perf/arch/powerpc/Build | 1 + tools/perf/arch/powerpc/include/arch-tests.h | 13 + tools/perf/arch/powerpc/include/perf_regs.h | 2 + tools/perf/arch/powerpc/tests/Build | 4 + tools/perf/arch/powerpc/tests/arch-tests.c | 15 + tools/perf/arch/powerpc/tests/dwarf-unwind.c | 62 ++ tools/perf/arch/powerpc/tests/regs_load.S | 94 +++ tools/perf/arch/x86/util/intel-pt.c | 57 +- tools/perf/builtin-record.c | 32 +- tools/perf/builtin-trace.c | 10 +- tools/perf/tests/Build | 2 +- tools/perf/tests/dwarf-unwind.c | 2 +- tools/perf/util/auxtrace.c | 737 +++++++++++++++++++++ tools/perf/util/auxtrace.h | 54 ++ tools/perf/util/build-id.c | 4 +- tools/perf/util/data-convert-bt.c | 2 +- tools/perf/util/dwarf-aux.c | 28 +- tools/perf/util/dwarf-aux.h | 3 + tools/perf/util/event.c | 3 +- tools/perf/util/evsel.c | 16 +- tools/perf/util/evsel.h | 5 +- tools/perf/util/evsel_fprintf.c | 7 +- .../perf/util/intel-pt-decoder/intel-pt-decoder.c | 30 + .../perf/util/intel-pt-decoder/intel-pt-decoder.h | 1 + tools/perf/util/intel-pt.c | 172 ++++- tools/perf/util/intel-pt.h | 4 +- tools/perf/util/parse-events.c | 41 +- tools/perf/util/probe-event.c | 10 +- tools/perf/util/probe-file.c | 2 +- tools/perf/util/probe-finder.c | 17 +- tools/perf/util/symbol.c | 15 + tools/perf/util/symbol.h | 1 + 34 files changed, 1451 insertions(+), 62 deletions(-) create mode 100644 tools/perf/arch/powerpc/include/arch-tests.h create mode 100644 tools/perf/arch/powerpc/tests/Build create mode 100644 tools/perf/arch/powerpc/tests/arch-tests.c create mode 100644 tools/perf/arch/powerpc/tests/dwarf-unwind.c create mode 100644 tools/perf/arch/powerpc/tests/regs_load.S
# time dm 1 alpine:3.4: Ok 2 android-ndk:r12b-arm: Ok 3 archlinux:latest: Ok 4 centos:5: Ok 5 centos:6: Ok 6 centos:7: Ok 7 debian:7: Ok 8 debian:8: Ok 9 debian:experimental: Ok 10 fedora:20: Ok 11 fedora:21: Ok 12 fedora:22: Ok 13 fedora:23: Ok 14 fedora:24: Ok 15 fedora:24-x-ARC-uClibc: Ok 16 fedora:rawhide: Ok 17 mageia:5: Ok 18 opensuse:13.2: Ok 19 opensuse:42.1: Ok 20 opensuse:tumbleweed: Ok 21 ubuntu:12.04.5: Ok 22 ubuntu:14.04: Ok 23 ubuntu:14.04.4: Ok 24 ubuntu:15.10: Ok 25 ubuntu:16.04: Ok 26 ubuntu:16.04-x-arm: Ok 27 ubuntu:16.04-x-arm64: Ok 28 ubuntu:16.04-x-powerpc: Ok 29 ubuntu:16.04-x-powerpc64: Ok 30 ubuntu:16.04-x-powerpc64el: Ok 31 ubuntu:16.04-x-s390: Ok 32 ubuntu:16.10: Ok 33 2246.21
real 37m26.862s
user 0m2.148s
sys 0m2.256s
#
# 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 events tests : Ok 6: Validate PERF_RECORD_* events & perf_sample fields : Ok 7: Test perf pmu format parsing : Ok 8: Test dso data read : Ok 9: Test dso data cache : Ok 10: Test dso data reopen : Ok 11: roundtrip evsel->name check : Ok 12: Check parsing of sched tracepoints fields : Ok 13: Generate and check syscalls:sys_enter_openat event fields: Ok 14: struct perf_event_attr setup : Ok 15: Test matching and linking multiple hists : Ok 16: Try 'import perf' in python, checking link problems : Ok 17: Test breakpoint overflow signal handler : Ok 18: Test breakpoint overflow sampling : Ok 19: Test number of exit event of a simple workload : Ok 20: Test software clock events have valid period values : Ok 21: Test object code reading : Ok 22: Test sample parsing : Ok 23: Test using a dummy software event to keep tracking : Ok 24: Test parsing with no sample_id_all bit set : Ok 25: Test filtering hist entries : Ok 26: Test mmap thread lookup : Ok 27: Test thread mg sharing : Ok 28: Test output sorting of hist entries : Ok 29: Test cumulation of child hist entries : Ok 30: Test tracking 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: Test kmod_path__parse function : Ok 34: Test thread map : Ok 35: Test LLVM searching and compiling : 35.1: Basic BPF llvm compiling test : Ok 35.2: Test kbuild searching : Ok 35.3: Compile source for BPF prologue generation test : Ok 35.4: Compile source for BPF relocation test : Ok 36: Test topology in session : Ok 37: Test BPF filter : 37.1: Test basic BPF filtering : Ok 37.2: Test BPF prologue generation : Ok 37.3: Test BPF relocation checker : Ok 38: Test thread map synthesize : Ok 39: Test cpu map synthesize : Ok 40: Test stat config synthesize : Ok 41: Test stat synthesize : Ok 42: Test stat round synthesize : Ok 43: Test attr update synthesize : Ok 44: Test events times : Ok 45: Test backward reading from ring buffer : Ok 46: Test cpu map print : Ok 47: Test SDT event probing : Ok 48: Test is_printable_array function : Ok 49: Test bitmap print : Ok 50: x86 rdpmc test : Ok 51: Test converting perf time to TSC : Ok 52: Test dwarf unwind : Ok 53: Test x86 instruction decoder - new instructions : Ok 54: Test intel cqm nmi context read : Skip #
$ make -C tools/perf build-test
make: Entering directory '/home/acme/git/linux/tools/perf'
tarpkg: ./tests/perf-targz-src-pkg .
make_debug_O: make DEBUG=1
make_no_libnuma_O: make NO_LIBNUMA=1
make_no_slang_O: make NO_SLANG=1
make_no_libaudit_O: make NO_LIBAUDIT=1
make_no_libbpf_O: make NO_LIBBPF=1
make_install_prefix_slash_O: make install prefix=/tmp/krava/
make_tags_O: make tags
make_doc_O: make doc
make_no_libunwind_O: make NO_LIBUNWIND=1
make_install_bin_O: make install-bin
make_no_libbionic_O: make NO_LIBBIONIC=1
make_with_babeltrace_O: make LIBBABELTRACE=1
make_no_demangle_O: make NO_DEMANGLE=1
make_perf_o_O: make perf.o
make_no_auxtrace_O: make NO_AUXTRACE=1
make_no_scripts_O: make NO_LIBPYTHON=1 NO_LIBPERL=1
make_pure_O: make
make_util_map_o_O: make util/map.o
make_no_libdw_dwarf_unwind_O: make NO_LIBDW_DWARF_UNWIND=1
make_no_newt_O: make NO_NEWT=1
make_no_libpython_O: make NO_LIBPYTHON=1
make_util_pmu_bison_o_O: make util/pmu-bison.o
make_help_O: make help
make_install_prefix_O: make install prefix=/tmp/krava
make_static_O: make LDFLAGS=-static
make_no_ui_O: make NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
make_no_backtrace_O: make NO_BACKTRACE=1
make_clean_all_O: make clean all
make_install_O: make install
make_no_libelf_O: make NO_LIBELF=1
make_no_libperl_O: make NO_LIBPERL=1
make_no_gtk2_O: make NO_GTK2=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
OK
make: Leaving directory '/home/acme/git/linux/tools/perf'
$Arnaldo Carvalho de Melo
maintainerPATCH 1/27 perf record: Fix documentation 'event_sources' -> 'event_source'
From: Adrian Hunter <[email protected]>
Change '/sys/bus/event_sources' to the correct path which is '/sys/bus/event_source'.
--- tools/perf/Documentation/perf-record.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/perf/Documentation/perf-record.txt +3 -3
@@ -35,15 +35,15 @@ OPTIONS - a symbolically formed PMU event like 'pmu/param1=0x3,param2/' where 'param1', 'param2', etc are defined as formats for the PMU in - /sys/bus/event_sources/devices/<pmu>/format/*. + /sys/bus/event_source/devices/<pmu>/format/*. - a symbolically formed event like 'pmu/config=M,config1=N,config3=K/' where M, N, K are numbers (in decimal, hex, octal format). Acceptable values for each of 'config', 'config1' and 'config2' are defined by - corresponding entries in /sys/bus/event_sources/devices/<pmu>/format/* + corresponding entries in /sys/bus/event_source/devices/<pmu>/format/* param1 and param2 are defined as formats for the PMU in: - /sys/bus/event_sources/devices/<pmu>/format/* + /sys/bus/event_source/devices/<pmu>/format/* There are also some params which are not defined in .../<pmu>/format/*. These params can be used to overload default config values per event.
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 2/27 perf tools: Fix MMAP event synthesis broken by MAP_HUGETLB change
In reply to Arnaldo Carvalho de MeloFrom: Adrian Hunter <[email protected]>
Patch "perf record: Mark MAP_HUGETLB when synthesizing mmap events") breaks MMAP event synthesis. The executable name comparison will match any name if the length is zero, resulting in all the user space maps becoming anonymous. This is particularly noticeable with system-wide traces. Example:
perf record -a sleep 1 perf script --show-mmap-events
Committer note:
That is not the case when, say, one has a qemu instance and libvirt actually mounts hugetlbfs. To test this I had to first umount it:
[root@jouet ~]# mount | grep hugetlbfs
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,seclabel) [root@jouet ~]#
After unmount it the error fixed by this patch manifests itself:
# perf record -a sleep 1
# perf script --show-mmap-events | grep PERF_RECORD_MMAP2 | head -5
systemd 0 [000] 0.000000: PERF_RECORD_MMAP2 1/1: [0x557d47ed8000(0x167000) @ 0 fd:00 3146896 7362875424355726126]: r-xp //anon
systemd 0 [000] 0.000000: PERF_RECORD_MMAP2 1/1: [0x7f96c488d000(0x4000) @ 0 fd:00 3153214 7362875424355726126]: r-xp //anon
systemd 0 [000] 0.000000: PERF_RECORD_MMAP2 1/1: [0x7f96c4a92000(0x3d000) @ 0 fd:00 3159276 7362875424355726126]: r-xp //anon
systemd 0 [000] 0.000000: PERF_RECORD_MMAP2 1/1: [0x7f96c4cd5000(0x15000) @ 0 fd:00 3153725 7362875424355726126]: r-xp //anon
systemd 0 [000] 0.000000: PERF_RECORD_MMAP2 1/1: [0x7f96c4eeb000(0x25000) @ 0 fd:00 3153260 7362875424355726126]: r-xp //anon
#Fixed version:
# perf record -a sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 1.419 MB perf.data (182 samples) ]
# perf script --show-mmap-events | grep PERF_RECORD_MMAP2 | head -5
systemd 0 [000] 0.000000: PERF_RECORD_MMAP2 1/1: [0x557d47ed8000(0x167000) @ 0 fd:00 3146896 7362875424355726126]: r-xp /usr/lib/systemd/systemd
systemd 0 [000] 0.000000: PERF_RECORD_MMAP2 1/1: [0x7f96c488d000(0x4000) @ 0 fd:00 3153214 7362875424355726126]: r-xp /usr/lib64/libuuid.so.1.3.0
systemd 0 [000] 0.000000: PERF_RECORD_MMAP2 1/1: [0x7f96c4a92000(0x3d000) @ 0 fd:00 3159276 7362875424355726126]: r-xp /usr/lib64/libblkid.so.1.1.0
systemd 0 [000] 0.000000: PERF_RECORD_MMAP2 1/1: [0x7f96c4cd5000(0x15000) @ 0 fd:00 3153725 7362875424355726126]: r-xp /usr/lib64/libz.so.1.2.8
systemd 0 [000] 0.000000: PERF_RECORD_MMAP2 1/1: [0x7f96c4eeb000(0x25000) @ 0 fd:00 3153260 7362875424355726126]: r-xp /usr/lib64/liblzma.so.5.2.2
[root@jouet ~]#--- tools/perf/util/event.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/util/event.c +2 -1
@@ -346,7 +346,8 @@ out:if (!strcmp (execname,"" ))strcpy (execname, anonstr); -if (!strncmp (execname, hugetlbfs_mnt, hugetlbfs_mnt_len)) { +if (hugetlbfs_mnt_len && + !strncmp (execname, hugetlbfs_mnt, hugetlbfs_mnt_len)) {strcpy (execname, anonstr); event->mmap2.flags |=MAP_HUGETLB ; }
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 3/27 perf data: Fix building in 32 bit platform with libbabeltrace
In reply to Arnaldo Carvalho de MeloFrom: Wang Nan <[email protected]>
On ARM32 building it report following error when we build with libbabeltrace:
util/data-convert-bt.c: In function 'add_bpf_output_values':
util/data-convert-bt.c:440:3: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'unsigned int' [-Werror=format]
cc1: all warnings being treated as errors
Fix it by changing %lu to %zu.
--- tools/perf/util/data-convert-bt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/data-convert-bt.c +1 -1
@@ -437,7 +437,7 @@ add_bpf_output_values(struct bt_ctf_event_class *event_class,int ret;if (nr_elements *sizeof (u32) != raw_size) -pr_warning ("Incorrect raw_size (%u) in bpf output event, skip %lu bytes\n" , +pr_warning ("Incorrect raw_size (%u) in bpf output event, skip %zu bytes\n" , raw_size, nr_elements *sizeof (u32) - raw_size); len_type =bt_ctf_event_class_get_field_by_name (event_class,"raw_len" );
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 4/27 perf trace: Beautify sched_[gs]et_attr return value
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Both return errno, show the string associated then.
More work needed to capture the sched_attr arg to beautify it in turn, probably using BPF.
Before:
0.210 ( 0.001 ms): sched_setattr(uattr: 0x7ffc684f02b0) = -22
After the patch, for this sched_attr, all other parms are zero, so not shown:
struct sched_attr attr = {
.size = sizeof(attr),
.sched_policy = SCHED_DEADLINE,
.sched_runtime = 10 * USECS_PER_SEC,
.sched_period = 30 * USECS_PER_SEC,
.sched_deadline = attr.sched_period,
};
0.321 ( 0.002 ms): sched_setattr(uattr: 0x7ffc44116da0) = -1 EINVAL Invalid argument
[root@jouet c]# perf trace -e sched_setattr ./sched_deadline Couldn't negotiate deadline: Invalid argument
0.229 ( 0.003 ms): sched_setattr(uattr: 0x7ffd8dcd8df0) = -1 EINVAL Invalid argument
[root@jouet c]#
Now to figure out the reason for this EINVAL.
--- tools/perf/builtin-trace.c | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/builtin-trace.c +2 -0
@@ -742,6 +742,8 @@ static struct syscall_fmt { .arg_scnprintf = { [1] = SCA_SIGNUM, /* sig */ }, }, { .name = "rt_tgsigqueueinfo", .errmsg = true, .arg_scnprintf = { [2] = SCA_SIGNUM, /* sig */ }, }, + { .name = "sched_getattr", .errmsg = true, }, + { .name = "sched_setattr", .errmsg = true, }, { .name = "sched_setscheduler", .errmsg = true, .arg_scnprintf = { [1] = SCA_SCHED_POLICY, /* policy */ }, }, { .name = "seccomp", .errmsg = true,
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 5/27 perf tools: Update documentation info about quipper
In reply to Arnaldo Carvalho de MeloFrom: Simon Que <[email protected]>
The existing link is outdated. The most recent quipper code can be found at the new URL.
Committer notes:
Quipper is a C++ parser that can be used to convert from a perf.data file to and from a protobuf, a Chromium OS facility.
--- tools/perf/Documentation/perf.data-file-format.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
tools/perf/Documentation/perf.data-file-format.txt +5 -1
@@ -437,6 +437,10 @@ in pmu-tools parser. This allows to read perf.data from python and dump it. quipper The quipper C++ parser is available at -https://chromium.googlesource.com/chromiumos/platform/chromiumos-wide-profiling/ +https://chromium.googlesource.com/chromiumos/platform2 + +It is under the chromiumos-wide-profiling/ subdirectory. This library can +convert a perf data file to a protobuf and vice versa. + Unfortunately this parser tends to be many versions behind and may not be able to parse data files generated by recent perf.
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 6/27 perf tools: Make perf_evsel__append_filter() generic
In reply to Arnaldo Carvalho de MeloFrom: Mathieu Poirier <[email protected]>
By making function perf_evsel__append_filter() take a format rather than an operator it is possible to reuse the code for other purposes (ex. Intel PT and CoreSight) than tracepoints.
--- tools/perf/builtin-trace.c | 9 +++++++-- tools/perf/util/evsel.c | 4 ++-- tools/perf/util/evsel.h | 2 +- tools/perf/util/parse-events.c | 4 ++-- 4 files changed, 12 insertions(+), 7 deletions(-)
tools/perf/builtin-trace.c +7 -2
@@ -2143,6 +2143,7 @@ out_delete_sys_enter:static int trace__set_ev_qualifier_filter (struct trace *trace) {int err =-1 ; +struct perf_evsel *sys_exit;char *filter =asprintf_expr_inout_ints ("id" , !trace->not_ev_qualifier, trace->ev_qualifier_ids.nr, trace->ev_qualifier_ids.entries);
@@ -2150,8 +2151,12 @@ static int trace__set_ev_qualifier_filter(struct trace *trace)if (filter ==NULL ) goto out_enomem; -if (!perf_evsel__append_filter (trace->syscalls.events.sys_enter,"&&" , filter)) - err =perf_evsel__append_filter (trace->syscalls.events.sys_exit,"&&" , filter); +if (!perf_evsel__append_filter (trace->syscalls.events.sys_enter, +"(%s) && (%s)" , filter)) { + sys_exit = trace->syscalls.events.sys_exit; + err =perf_evsel__append_filter (sys_exit, +"(%s) && (%s)" , filter); + }free (filter); out:
tools/perf/util/evsel.c +2 -2
@@ -1046,14 +1046,14 @@ int perf_evsel__set_filter(struct perf_evsel *evsel, const char *filter) }int perf_evsel__append_filter (struct perf_evsel *evsel, -const char *op,const char *filter) +const char *fmt,const char *filter) {char *new_filter;if (evsel->filter ==NULL )return perf_evsel__set_filter (evsel, filter); -if (asprintf (&new_filter,"(%s) %s (%s)" , evsel->filter, op, filter) >0 ) { +if (asprintf (&new_filter, fmt, evsel->filter, filter) >0 ) {free (evsel->filter); evsel->filter = new_filter;return 0 ;
tools/perf/util/evsel.h +1 -1
@@ -236,7 +236,7 @@ void perf_evsel__set_sample_id(struct perf_evsel *evsel,int perf_evsel__set_filter (struct perf_evsel *evsel,const char *filter);int perf_evsel__append_filter (struct perf_evsel *evsel, -const char *op,const char *filter); +const char *fmt,const char *filter);int perf_evsel__apply_filter (struct perf_evsel *evsel,int ncpus,int nthreads,const char *filter);int perf_evsel__enable (struct perf_evsel *evsel);
tools/perf/util/parse-events.c +2 -2
@@ -1767,7 +1767,7 @@ static int set_filter(struct perf_evsel *evsel, const void *arg)return -1 ; } -if (perf_evsel__append_filter (evsel,"&&" , str) <0 ) { +if (perf_evsel__append_filter (evsel,"(%s) && (%s)" , str) <0 ) {fprintf (stderr,"not enough memory to hold filter string\n" );return -1 ;
@@ -1798,7 +1798,7 @@ static int add_exclude_perf_filter(struct perf_evsel *evsel,snprintf (new_filter,sizeof (new_filter),"common_pid != %d" ,getpid ()); -if (perf_evsel__append_filter (evsel,"&&" , new_filter) <0 ) { +if (perf_evsel__append_filter (evsel,"(%s) && (%s)" , new_filter) <0 ) {fprintf (stderr,"not enough memory to hold filter string\n" );return -1 ;
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 7/27 perf evsel: New tracepoint specific function
In reply to Arnaldo Carvalho de MeloFrom: Mathieu Poirier <[email protected]>
Making function perf_evsel__append_filter() static and introducing a new tracepoint specific function to append filters. That way we eliminate redundant code and avoid formatting mistake.
--- tools/perf/builtin-trace.c | 7 +++---- tools/perf/util/evsel.c | 9 +++++++-- tools/perf/util/evsel.h | 3 +-- tools/perf/util/parse-events.c | 4 ++-- 4 files changed, 13 insertions(+), 10 deletions(-)
tools/perf/builtin-trace.c +3 -4
@@ -2151,11 +2151,10 @@ static int trace__set_ev_qualifier_filter(struct trace *trace)if (filter ==NULL ) goto out_enomem; -if (!perf_evsel__append_filter (trace->syscalls.events.sys_enter, -"(%s) && (%s)" , filter)) { +if (!perf_evsel__append_tp_filter (trace->syscalls.events.sys_enter, + filter)) { sys_exit = trace->syscalls.events.sys_exit; - err =perf_evsel__append_filter (sys_exit, -"(%s) && (%s)" , filter); + err =perf_evsel__append_tp_filter (sys_exit, filter); }free (filter);
tools/perf/util/evsel.c +7 -2
@@ -1045,8 +1045,8 @@ int perf_evsel__set_filter(struct perf_evsel *evsel, const char *filter)return -1 ; } -int perf_evsel__append_filter (struct perf_evsel *evsel, -const char *fmt,const char *filter) +static int perf_evsel__append_filter (struct perf_evsel *evsel, +const char *fmt,const char *filter) {char *new_filter;
@@ -1062,6 +1062,11 @@ int perf_evsel__append_filter(struct perf_evsel *evsel,return -1 ; } +int perf_evsel__append_tp_filter (struct perf_evsel *evsel,const char *filter) +{ +return perf_evsel__append_filter (evsel,"(%s) && (%s)" , filter); +} +int perf_evsel__enable (struct perf_evsel *evsel) {int nthreads =thread_map__nr (evsel->threads);
tools/perf/util/evsel.h +1 -2
@@ -235,8 +235,7 @@ void perf_evsel__set_sample_id(struct perf_evsel *evsel, bool use_sample_identifier);int perf_evsel__set_filter (struct perf_evsel *evsel,const char *filter); -int perf_evsel__append_filter (struct perf_evsel *evsel, -const char *fmt,const char *filter); +int perf_evsel__append_tp_filter (struct perf_evsel *evsel,const char *filter);int perf_evsel__apply_filter (struct perf_evsel *evsel,int ncpus,int nthreads,const char *filter);int perf_evsel__enable (struct perf_evsel *evsel);
tools/perf/util/parse-events.c +2 -2
@@ -1767,7 +1767,7 @@ static int set_filter(struct perf_evsel *evsel, const void *arg)return -1 ; } -if (perf_evsel__append_filter (evsel,"(%s) && (%s)" , str) <0 ) { +if (perf_evsel__append_tp_filter (evsel, str) <0 ) {fprintf (stderr,"not enough memory to hold filter string\n" );return -1 ;
@@ -1798,7 +1798,7 @@ static int add_exclude_perf_filter(struct perf_evsel *evsel,snprintf (new_filter,sizeof (new_filter),"common_pid != %d" ,getpid ()); -if (perf_evsel__append_filter (evsel,"(%s) && (%s)" , new_filter) <0 ) { +if (perf_evsel__append_tp_filter (evsel, new_filter) <0 ) {fprintf (stderr,"not enough memory to hold filter string\n" );return -1 ;
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 8/27 perf evsel: Add support for address filters
In reply to Arnaldo Carvalho de MeloFrom: Mathieu Poirier <[email protected]>
This patch makes it possible to use the current filter framework with address filters. That way address filters for HW tracers such as CoreSight and Intel PT can be communicated to the kernel drivers.
--- tools/perf/util/evsel.c | 5 +++++ tools/perf/util/evsel.h | 2 ++ tools/perf/util/parse-events.c | 39 ++++++++++++++++++++++++++++++++++----- 3 files changed, 41 insertions(+), 5 deletions(-)
tools/perf/util/evsel.c +5 -0
@@ -1067,6 +1067,11 @@ int perf_evsel__append_tp_filter(struct perf_evsel *evsel, const char *filter)return perf_evsel__append_filter (evsel,"(%s) && (%s)" , filter); } +int perf_evsel__append_addr_filter (struct perf_evsel *evsel,const char *filter) +{ +return perf_evsel__append_filter (evsel,"%s,%s" , filter); +} +int perf_evsel__enable (struct perf_evsel *evsel) {int nthreads =thread_map__nr (evsel->threads);
tools/perf/util/evsel.h +2 -0
@@ -236,6 +236,8 @@ void perf_evsel__set_sample_id(struct perf_evsel *evsel,int perf_evsel__set_filter (struct perf_evsel *evsel,const char *filter);int perf_evsel__append_tp_filter (struct perf_evsel *evsel,const char *filter); +int perf_evsel__append_addr_filter (struct perf_evsel *evsel, +const char *filter);int perf_evsel__apply_filter (struct perf_evsel *evsel,int ncpus,int nthreads,const char *filter);int perf_evsel__enable (struct perf_evsel *evsel);
tools/perf/util/parse-events.c +34 -5
@@ -1760,20 +1760,49 @@ foreach_evsel_in_last_glob(struct perf_evlist *evlist,static int set_filter (struct perf_evsel *evsel,const void *arg) {const char *str = arg; +bool found = false; +int nr_addr_filters =0 ; +struct perf_pmu *pmu =NULL ; -if (evsel ==NULL || evsel->attr.type !=PERF_TYPE_TRACEPOINT ) { -fprintf (stderr, -"--filter option should follow a -e tracepoint option\n" ); -return -1 ; +if (evsel ==NULL ) + goto err; + +if (evsel->attr.type ==PERF_TYPE_TRACEPOINT ) { +if (perf_evsel__append_tp_filter (evsel, str) <0 ) { +fprintf (stderr, +"not enough memory to hold filter string\n" ); +return -1 ; + } + +return 0 ; } -if (perf_evsel__append_tp_filter (evsel, str) <0 ) { +while ((pmu =perf_pmu__scan (pmu)) !=NULL ) +if (pmu->type == evsel->attr.type) { + found = true; +break ; + } + +if (found) +perf_pmu__scan_file (pmu,"nr_addr_filters" , +"%d" , &nr_addr_filters); + +if (!nr_addr_filters) + goto err; + +if (perf_evsel__append_addr_filter (evsel, str) <0 ) {fprintf (stderr,"not enough memory to hold filter string\n" );return -1 ; }return 0 ; + +err: +fprintf (stderr, +"--filter option should follow a -e tracepoint or HW tracer option\n" ); + +return -1 ; } int parse_filter(const struct option *opt, const char *str,
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 9/27 perf script: Fix vanished idle symbols
In reply to Arnaldo Carvalho de MeloFrom: Adrian Hunter <[email protected]>
Commit 608c34de0b3d ("perf symbols: Mark if a symbol is idle in the library") causes idle symbols to vanish from perf script output. That is because print functions suppress symbols marked as 'idle'.
However, suppression of 'idle' functions is only used by 'perf top' and 'perf top' does not use the print functions. Consequently that functionality can simply be removed from the print functions.
--- tools/perf/util/evsel_fprintf.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
tools/perf/util/evsel_fprintf.c +2 -5
@@ -122,9 +122,6 @@ int sample__fprintf_callchain(struct perf_sample *sample, int left_alignment,if (!node)break ; -if (node->sym && node->sym->idle) - goto next; - printed +=fprintf (fp,"%-*.*s" , left_alignment, left_alignment," " );if (print_ip)
@@ -158,7 +155,7 @@ int sample__fprintf_callchain(struct perf_sample *sample, int left_alignment,if (!print_oneline) printed +=fprintf (fp,"\n" ); -next: +callchain_cursor_advance (cursor); } }
@@ -181,7 +178,7 @@ int sample__fprintf_sym(struct perf_sample *sample, struct addr_location *al,if (cursor !=NULL ) { printed +=sample__fprintf_callchain (sample, left_alignment, print_opts, cursor, fp); - }else if (!(al->sym && al->sym->idle)) { + }else { printed +=fprintf (fp,"%-*.*s" , left_alignment, left_alignment," " );if (print_ip)
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 10/27 perf record: Rename label 'out_symbol_exit'
In reply to Arnaldo Carvalho de MeloFrom: Adrian Hunter <[email protected]>
In preparation for fixing the error paths, rename label 'out_symbol_exit' to be 'out' because that error path can be used irrespective of whether symbols (or anything else) has been initialized.
--- tools/perf/builtin-record.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
tools/perf/builtin-record.c +5 -5
@@ -1643,7 +1643,7 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused)if (rec->evlist->nr_entries ==0 &&perf_evlist__add_default (rec->evlist) <0 ) {pr_err ("Not enough memory for event selector list\n" ); - goto out_symbol_exit; + goto out; }if (rec->opts.target.tid && !rec->opts.no_inherit_set)
@@ -1663,7 +1663,7 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused)ui__error ("%s" , errbuf); err = -saved_errno; - goto out_symbol_exit; + goto out; } err = -ENOMEM ;
@@ -1672,7 +1672,7 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused) err =auxtrace_record__options (rec->itr, rec->evlist, &rec->opts);if (err) - goto out_symbol_exit; + goto out;/* * We take all buildids when the file contains
@@ -1684,11 +1684,11 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused)if (record_opts__config (&rec->opts)) { err = -EINVAL ; - goto out_symbol_exit; + goto out; } err =__cmd_record (&record, argc, argv); -out_symbol_exit: +out:perf_evlist__delete (rec->evlist);symbol__exit ();auxtrace_record__free (rec->itr);
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 11/27 perf record: Fix error paths
In reply to Arnaldo Carvalho de MeloFrom: Adrian Hunter <[email protected]>
Some error paths do not tidy-up. Fix that.
--- tools/perf/builtin-record.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tools/perf/builtin-record.c +4 -4
@@ -1573,23 +1573,23 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused)if (!rec->itr) { rec->itr =auxtrace_record__init (rec->evlist, &err);if (err) -return err; + goto out; } err =auxtrace_parse_snapshot_options (rec->itr, &rec->opts, rec->opts.auxtrace_snapshot_opts);if (err) -return err; + goto out;if (dry_run) -return 0 ; + goto out; err =bpf__setup_stdout (rec->evlist);if (err) {bpf__strerror_setup_stdout (rec->evlist, err, errbuf,sizeof (errbuf));pr_err ("ERROR: Setup BPF stdout failed: %s\n" , errbuf); -return err; + goto out; } err = -ENOMEM ;
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 12/27 perf symbols: Add dso__last_symbol()
In reply to Arnaldo Carvalho de MeloFrom: Adrian Hunter <[email protected]>
Add a function to find the last symbol in a DSO. This will be used when parsing address filters to calculate a region that includes the entire DSO.
--- tools/perf/util/symbol.c | 15 +++++++++++++++ tools/perf/util/symbol.h | 1 + 2 files changed, 16 insertions(+)
tools/perf/util/symbol.c +15 -0
@@ -345,6 +345,16 @@ static struct symbol *symbols__first(struct rb_root *symbols)return NULL ; } +static struct symbol *symbols__last (struct rb_root *symbols) +{ +struct rb_node *n =rb_last (symbols); + +if (n) + return rb_entry(n, struct symbol, rb_node); + +return NULL ; +} +static struct symbol *symbols__next (struct symbol *sym) {struct rb_node *n =rb_next (&sym->rb_node);
@@ -466,6 +476,11 @@ struct symbol *dso__first_symbol(struct dso *dso, enum map_type type)return symbols__first (&dso->symbols[type]); } +struct symbol *dso__last_symbol (struct dso *dso,enum map_type type) +{ +return symbols__last (&dso->symbols[type]); +} +struct symbol *dso__next_symbol (struct symbol *sym) {return symbols__next (sym);
tools/perf/util/symbol.h +1 -0
@@ -259,6 +259,7 @@ struct symbol *dso__find_symbol_by_name(struct dso *dso, enum map_type type,struct symbol *symbol__next_by_name (struct symbol *sym);struct symbol *dso__first_symbol (struct dso *dso,enum map_type type); +struct symbol *dso__last_symbol (struct dso *dso,enum map_type type);struct symbol *dso__next_symbol (struct symbol *sym);enum dso_type dso__type_fd (int fd);
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 13/27 perf record: Add support for using symbols in address filters
In reply to Arnaldo Carvalho de MeloFrom: Adrian Hunter <[email protected]>
Symbols come from either the DSO or /proc/kallsyms for the kernel. Details of the functionality can be found in Documentation/perf-record.txt.
--- tools/perf/Documentation/perf-record.txt | 55 ++- tools/perf/builtin-record.c | 14 +- tools/perf/util/auxtrace.c | 737 +++++++++++++++++++++++++++++++ tools/perf/util/auxtrace.h | 54 +++ 4 files changed, 857 insertions(+), 3 deletions(-)
tools/perf/Documentation/perf-record.txt +54 -1
@@ -89,9 +89,62 @@ OPTIONS --filter=<filter>:: Event filter. This option should follow a event selector (-e) which - selects tracepoint event(s). Multiple '--filter' options are combined + selects either tracepoint event(s) or a hardware trace PMU + (e.g. Intel PT or CoreSight). + + - tracepoint filters + + In the case of tracepoints, multiple '--filter' options are combined using '&&'. + - address filters + + A hardware trace PMU advertises its ability to accept a number of + address filters by specifying a non-zero value in + /sys/bus/event_source/devices/<pmu>/nr_addr_filters. + + Address filters have the format: + + filter|start|stop|tracestop <start> [/ <size>] [@<file name>] + + Where: + - 'filter': defines a region that will be traced. + - 'start': defines an address at which tracing will begin. + - 'stop': defines an address at which tracing will stop. + - 'tracestop': defines a region in which tracing will stop. + + <file name> is the name of the object file, <start> is the offset to the + code to trace in that file, and <size> is the size of the region to + trace. 'start' and 'stop' filters need not specify a <size>. + + If no object file is specified then the kernel is assumed, in which case + the start address must be a current kernel memory address. + + <start> can also be specified by providing the name of a symbol. If the + symbol name is not unique, it can be disambiguated by inserting #n where + 'n' selects the n'th symbol in address order. Alternately #0, #g or #G + select only a global symbol. <size> can also be specified by providing + the name of a symbol, in which case the size is calculated to the end + of that symbol. For 'filter' and 'tracestop' filters, if <size> is + omitted and <start> is a symbol, then the size is calculated to the end + of that symbol. + + If <size> is omitted and <start> is '*', then the start and size will + be calculated from the first and last symbols, i.e. to trace the whole + file. + + If symbol names (or '*') are provided, they must be surrounded by white + space. + + The filter passed to the kernel is not necessarily the same as entered. + To see the filter that is passed, use the -v option. + + The kernel may not be able to configure a trace region if it is not + within a single mapping. MMAP events (or /proc/<pid>/maps) can be + examined to determine if that is a possibility. + + Multiple filters can be separated with space or comma. + --exclude-perf:: Don't record events issued by perf itself. This option should follow a event selector (-e) which selects tracepoint event(s). It adds a
tools/perf/builtin-record.c +12 -2
@@ -1581,6 +1581,18 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused)if (err) goto out; +/* +* Allow aliases to facilitate the lookup of symbols for address +* filters. Refer to auxtrace_parse_filters(). +*/ + symbol_conf.allow_aliases = true; + +symbol__init (NULL ); + + err =auxtrace_parse_filters (rec->evlist); +if (err) + goto out; +if (dry_run) goto out;
@@ -1594,8 +1606,6 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused) err = -ENOMEM ; -symbol__init (NULL ); -if (symbol_conf.kptr_restrict)pr_warning ( "WARNING: Kernel address maps (/proc/{kallsyms,modules}) are restricted,\n"
tools/perf/util/auxtrace.c +737 -0
755 lines not on this page · raw message
tools/perf/util/auxtrace.h +54 -0
72 lines not on this page · raw message
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 14/27 perf probe: Increase debug level of SDT debug messages
In reply to Arnaldo Carvalho de MeloFrom: Adrian Hunter <[email protected]>
Two SDT debug messages can occur for every DSO which is too noisy. Consequently, increase debug level of SDT messages.
--- tools/perf/util/build-id.c | 4 ++-- tools/perf/util/probe-file.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
tools/perf/util/build-id.c +2 -2
@@ -620,7 +620,7 @@ static int build_id_cache__add_sdt_cache(const char *sbuild_id, ret =probe_cache__scan_sdt (cache, realname);if (ret >=0 ) { -pr_debug ("Found %d SDTs in %s\n" , ret, realname); +pr_debug4 ("Found %d SDTs in %s\n" , ret, realname);if (probe_cache__commit (cache) <0 ) ret =-1 ; }
@@ -691,7 +691,7 @@ int build_id_cache__add_s(const char *sbuild_id, const char *name,/* Update SDT cache : error is just warned */ if (build_id_cache__add_sdt_cache (sbuild_id, realname) <0 ) -pr_debug ("Failed to update/scan SDT cache for %s\n" , realname); +pr_debug4 ("Failed to update/scan SDT cache for %s\n" , realname); out_free:if (!is_kallsyms)
tools/perf/util/probe-file.c +1 -1
@@ -699,7 +699,7 @@ int probe_cache__scan_sdt(struct probe_cache *pcache, const char *pathname)INIT_LIST_HEAD (&sdtlist); ret =get_sdt_note_list (&sdtlist, pathname);if (ret <0 ) { -pr_debug ("Failed to get sdt note: %d\n" , ret); +pr_debug4 ("Failed to get sdt note: %d\n" , ret);return ret; }list_for_each_entry (note, &sdtlist, note_list) {
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 15/27 perf intel-pt: Fix snapshot overlap detection decoder errors
In reply to Arnaldo Carvalho de MeloFrom: Adrian Hunter <[email protected]>
Fix occasional decoder errors decoding trace data collected in snapshot mode.
Snapshot mode can take successive snapshots of trace which might overlap. The decoder checks whether there is an overlap but only looks at the current and previous buffer. However buffers that do not contain synchronization (i.e. PSB) packets cannot be decoded or used for overlap checking. That means the decoder actually needs to check overlaps between the current buffer and the previous buffer that contained usable data. Make that change.
--- tools/perf/util/intel-pt.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
tools/perf/util/intel-pt.c +11 -4
@@ -241,7 +241,7 @@ static int intel_pt_get_trace(struct intel_pt_buffer *b, void *data) } queue = &ptq->pt->queues.queue_array[ptq->queue_nr]; - +next: buffer =auxtrace_buffer__next (queue, buffer);if (!buffer) {if (old_buffer)
@@ -264,9 +264,6 @@ static int intel_pt_get_trace(struct intel_pt_buffer *b, void *data) intel_pt_do_fix_overlap(ptq->pt, old_buffer, buffer))return -ENOMEM ; -if (old_buffer) -auxtrace_buffer__drop_data (old_buffer); -if (buffer->use_data) { b->len = buffer->use_size; b->buf = buffer->use_data;
@@ -276,6 +273,16 @@ static int intel_pt_get_trace(struct intel_pt_buffer *b, void *data) } b->ref_timestamp = buffer->reference; +/* +* If in snapshot mode and the buffer has no usable data, get next +* buffer and again check overlap against old_buffer. +*/ +if (ptq->pt->snapshot_mode && !b->len) + goto next; + +if (old_buffer) +auxtrace_buffer__drop_data (old_buffer); +if (!old_buffer || ptq->pt->sampling_mode || (ptq->pt->snapshot_mode && !buffer->consecutive)) { b->consecutive = false;
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 16/27 perf intel-pt: Add support for recording the max non-turbo ratio
In reply to Arnaldo Carvalho de MeloFrom: Adrian Hunter <[email protected]>
Previously the maximum non-turbo ratio was calculated from TSC assuming a 100 MHz multiplier which is correct for current hardware supporting Intel PT. However more recent kernels also now export the value, so use that in preference to the calculated value.
--- tools/perf/arch/x86/util/intel-pt.c | 6 ++++++ tools/perf/util/intel-pt.c | 14 +++++++++++++- tools/perf/util/intel-pt.h | 1 + 3 files changed, 20 insertions(+), 1 deletion(-)
tools/perf/arch/x86/util/intel-pt.c +6 -0
@@ -302,6 +302,7 @@ static int intel_pt_info_fill(struct auxtrace_record *itr,bool cap_user_time_zero = false, per_cpu_mmaps;u64 tsc_bit, mtc_bit, mtc_freq_bits, cyc_bit, noretcomp_bit;u32 tsc_ctc_ratio_n, tsc_ctc_ratio_d; +unsigned long max_non_turbo_ratio;int err;if (priv_size !=INTEL_PT_AUXTRACE_PRIV_SIZE )
@@ -317,6 +318,10 @@ static int intel_pt_info_fill(struct auxtrace_record *itr,intel_pt_tsc_ctc_ratio (&tsc_ctc_ratio_n, &tsc_ctc_ratio_d); +if (perf_pmu__scan_file (intel_pt_pmu,"max_nonturbo_ratio" , +"%lu" , &max_non_turbo_ratio) !=1 ) + max_non_turbo_ratio =0 ; +if (!session->evlist->nr_mmaps)return -EINVAL ;
@@ -351,6 +356,7 @@ static int intel_pt_info_fill(struct auxtrace_record *itr, auxtrace_info->priv[INTEL_PT_TSC_CTC_N ] = tsc_ctc_ratio_n; auxtrace_info->priv[INTEL_PT_TSC_CTC_D ] = tsc_ctc_ratio_d; auxtrace_info->priv[INTEL_PT_CYC_BIT ] = cyc_bit; + auxtrace_info->priv[INTEL_PT_MAX_NONTURBO_RATIO ] = max_non_turbo_ratio;return 0 ; }
tools/perf/util/intel-pt.c +13 -1
@@ -2023,6 +2023,7 @@ static const char * const intel_pt_info_fmts[] = { [INTEL_PT_TSC_CTC_N] = " TSC:CTC numerator %"PRIu64"\n", [INTEL_PT_TSC_CTC_D] = " TSC:CTC denominator %"PRIu64"\n", [INTEL_PT_CYC_BIT] = " CYC bit %#"PRIx64"\n", + [INTEL_PT_MAX_NONTURBO_RATIO] = " Max non-turbo ratio %"PRIu64"\n", };static void intel_pt_print_info (u64 *arr,int start,int finish)
@@ -2087,6 +2088,15 @@ int intel_pt_process_auxtrace_info(union perf_event *event, INTEL_PT_CYC_BIT); } +if (auxtrace_info->header.size >=sizeof (struct auxtrace_info_event ) + + (sizeof (u64) *INTEL_PT_MAX_NONTURBO_RATIO )) { + pt->max_non_turbo_ratio = + auxtrace_info->priv[INTEL_PT_MAX_NONTURBO_RATIO ]; +intel_pt_print_info (&auxtrace_info->priv[0 ], +INTEL_PT_MAX_NONTURBO_RATIO , +INTEL_PT_MAX_NONTURBO_RATIO ); + } + pt->timeless_decoding =intel_pt_timeless_decoding (pt); pt->have_tsc =intel_pt_have_tsc (pt); pt->sampling_mode = false;
@@ -2156,7 +2166,9 @@ int intel_pt_process_auxtrace_info(union perf_event *event,if (pt->tc.time_mult) {u64 tsc_freq =intel_pt_ns_to_ticks (pt,1000000000 ); - pt->max_non_turbo_ratio = (tsc_freq +50000000 ) /100000000 ; +if (!pt->max_non_turbo_ratio) + pt->max_non_turbo_ratio = + (tsc_freq +50000000 ) /100000000 ;intel_pt_log ("TSC frequency %" PRIu64"\n" , tsc_freq);intel_pt_log ("Maximum non-turbo ratio %u\n" , pt->max_non_turbo_ratio);
tools/perf/util/intel-pt.h +1 -0
@@ -34,6 +34,7 @@ enum {INTEL_PT_TSC_CTC_N ,INTEL_PT_TSC_CTC_D ,INTEL_PT_CYC_BIT , +INTEL_PT_MAX_NONTURBO_RATIO , INTEL_PT_AUXTRACE_PRIV_MAX, };
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 17/27 perf intel-pt: Fix missing error codes processing auxtrace_info
In reply to Arnaldo Carvalho de MeloFrom: Adrian Hunter <[email protected]>
Fix 2 places where the err variable was not being set.
--- tools/perf/util/intel-pt.c | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/util/intel-pt.c +2 -0
@@ -2138,11 +2138,13 @@ int intel_pt_process_auxtrace_info(union perf_event *event, pt->switch_evsel =intel_pt_find_sched_switch (session->evlist);if (!pt->switch_evsel) {pr_err ("%s: missing sched_switch event\n" , __func__); + err = -EINVAL ; goto err_delete_thread; } }else if (pt->have_sched_switch ==2 && !intel_pt_find_switch (session->evlist)) {pr_err ("%s: missing context_switch attribute flag\n" , __func__); + err = -EINVAL ; goto err_delete_thread; }
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 18/27 perf intel-pt: Add a helper function for processing AUXTRACE_INFO
In reply to Arnaldo Carvalho de MeloFrom: Adrian Hunter <[email protected]>
Add a helper function 'intel_pt_has()' to make it easier to determine which members the AUXTRACE_INFO event contains.
--- tools/perf/util/intel-pt.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
tools/perf/util/intel-pt.c +8 -4
@@ -2037,6 +2037,12 @@ static void intel_pt_print_info(u64 *arr, int start, int finish)fprintf (stdout, intel_pt_info_fmts[i], arr[i]); } +static bool intel_pt_has (struct auxtrace_info_event *auxtrace_info,int pos) +{ +return auxtrace_info->header.size >= +sizeof (struct auxtrace_info_event ) + (sizeof (u64) * (pos +1 )); +} +int intel_pt_process_auxtrace_info (union perf_event *event,struct perf_session *session) {
@@ -2077,8 +2083,7 @@ int intel_pt_process_auxtrace_info(union perf_event *event,intel_pt_print_info (&auxtrace_info->priv[0 ],INTEL_PT_PMU_TYPE ,INTEL_PT_PER_CPU_MMAPS ); -if (auxtrace_info->header.size >=sizeof (struct auxtrace_info_event ) + - (sizeof (u64) *INTEL_PT_CYC_BIT )) { +if (intel_pt_has (auxtrace_info,INTEL_PT_CYC_BIT )) { pt->mtc_bit = auxtrace_info->priv[INTEL_PT_MTC_BIT ]; pt->mtc_freq_bits = auxtrace_info->priv[INTEL_PT_MTC_FREQ_BITS ]; pt->tsc_ctc_ratio_n = auxtrace_info->priv[INTEL_PT_TSC_CTC_N ];
@@ -2088,8 +2093,7 @@ int intel_pt_process_auxtrace_info(union perf_event *event, INTEL_PT_CYC_BIT); } -if (auxtrace_info->header.size >=sizeof (struct auxtrace_info_event ) + - (sizeof (u64) *INTEL_PT_MAX_NONTURBO_RATIO )) { +if (intel_pt_has (auxtrace_info,INTEL_PT_MAX_NONTURBO_RATIO )) { pt->max_non_turbo_ratio = auxtrace_info->priv[INTEL_PT_MAX_NONTURBO_RATIO ]; intel_pt_print_info(&auxtrace_info->priv[0],
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 19/27 perf intel-pt: Record address filter in AUXTRACE_INFO event
In reply to Arnaldo Carvalho de MeloFrom: Adrian Hunter <[email protected]>
The address filter is needed to help decode the trace, so store it in the AUXTRACE_INFO event.
--- tools/perf/arch/x86/util/intel-pt.c | 51 ++++++++++++++++++++++++++++++++++--- tools/perf/util/intel-pt.h | 3 +-- 2 files changed, 48 insertions(+), 6 deletions(-)
tools/perf/arch/x86/util/intel-pt.c +47 -4
@@ -62,6 +62,7 @@ struct intel_pt_recording {size_t snapshot_ref_buf_size;int snapshot_ref_cnt;struct intel_pt_snapshot_ref *snapshot_refs; +size_t priv_size; }; static int intel_pt_parse_terms_with_default(struct list_head *formats,
@@ -273,11 +274,37 @@ intel_pt_pmu_default_config(struct perf_pmu *intel_pt_pmu)return attr; } +static const char *intel_pt_find_filter (struct perf_evlist *evlist, +struct perf_pmu *intel_pt_pmu) +{ +struct perf_evsel *evsel; + +evlist__for_each_entry (evlist, evsel) { +if (evsel->attr.type == intel_pt_pmu->type) +return evsel->filter; + } + +return NULL ; +} + +static size_t intel_pt_filter_bytes (const char *filter) +{ +size_t len = filter ?strlen (filter) :0 ; + +return len ?roundup (len +1 ,8 ) :0 ; +} +static size_t -intel_pt_info_priv_size (struct auxtrace_record *itr__maybe_unused , -struct perf_evlist *evlist__maybe_unused ) +intel_pt_info_priv_size (struct auxtrace_record *itr,struct perf_evlist *evlist) { -return INTEL_PT_AUXTRACE_PRIV_SIZE ; +struct intel_pt_recording *ptr = + container_of(itr, struct intel_pt_recording, itr); +const char *filter =intel_pt_find_filter (evlist, ptr->intel_pt_pmu); + + ptr->priv_size = (INTEL_PT_AUXTRACE_PRIV_MAX *sizeof (u64)) + +intel_pt_filter_bytes (filter); + +return ptr->priv_size; }static void intel_pt_tsc_ctc_ratio (u32 *n,u32 *d)
@@ -303,9 +330,12 @@ static int intel_pt_info_fill(struct auxtrace_record *itr,u64 tsc_bit, mtc_bit, mtc_freq_bits, cyc_bit, noretcomp_bit;u32 tsc_ctc_ratio_n, tsc_ctc_ratio_d;unsigned long max_non_turbo_ratio; +size_t filter_str_len; +const char *filter; +u64 *info;int err; -if (priv_size !=INTEL_PT_AUXTRACE_PRIV_SIZE ) +if (priv_size != ptr->priv_size)return -EINVAL ;intel_pt_parse_terms (&intel_pt_pmu->format,"tsc" , &tsc_bit);
@@ -322,6 +352,9 @@ static int intel_pt_info_fill(struct auxtrace_record *itr, "%lu", &max_non_turbo_ratio) != 1) max_non_turbo_ratio =0 ; + filter =intel_pt_find_filter (session->evlist, ptr->intel_pt_pmu); + filter_str_len = filter ?strlen (filter) :0 ; +if (!session->evlist->nr_mmaps)return -EINVAL ;
@@ -357,6 +390,16 @@ static int intel_pt_info_fill(struct auxtrace_record *itr, auxtrace_info->priv[INTEL_PT_TSC_CTC_D ] = tsc_ctc_ratio_d; auxtrace_info->priv[INTEL_PT_CYC_BIT ] = cyc_bit; auxtrace_info->priv[INTEL_PT_MAX_NONTURBO_RATIO ] = max_non_turbo_ratio; + auxtrace_info->priv[INTEL_PT_FILTER_STR_LEN ] = filter_str_len; + + info = &auxtrace_info->priv[INTEL_PT_FILTER_STR_LEN ] +1 ; + +if (filter_str_len) { +size_t len =intel_pt_filter_bytes (filter); + +strncpy ((char *)info, filter, len); + info += len >>3 ; + }return 0 ; }
tools/perf/util/intel-pt.h +1 -2
@@ -35,11 +35,10 @@ enum {INTEL_PT_TSC_CTC_D ,INTEL_PT_CYC_BIT ,INTEL_PT_MAX_NONTURBO_RATIO , +INTEL_PT_FILTER_STR_LEN , INTEL_PT_AUXTRACE_PRIV_MAX, }; -#define INTEL_PT_AUXTRACE_PRIV_SIZE (INTEL_PT_AUXTRACE_PRIV_MAX * sizeof(u64)) -struct auxtrace_record ;struct perf_tool ;union perf_event ;
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 20/27 perf intel-pt: Read address filter from AUXTRACE_INFO event
In reply to Arnaldo Carvalho de MeloFrom: Adrian Hunter <[email protected]>
Read the address filter from the AUXTRACE_INFO event in preparation for using it to assist in decoding.
--- tools/perf/util/intel-pt.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+)
tools/perf/util/intel-pt.c +51 -0
@@ -103,6 +103,8 @@ struct intel_pt {unsigned max_non_turbo_ratio;unsigned long num_events; + +char *filter; };enum switch_state {
@@ -1774,6 +1776,7 @@ static void intel_pt_free(struct perf_session *session)intel_pt_free_events (session); session->auxtrace =NULL ;thread__put (pt->unknown_thread); +zfree (&pt->filter);free (pt); }
@@ -2024,6 +2027,7 @@ static const char * const intel_pt_info_fmts[] = { [INTEL_PT_TSC_CTC_D] = " TSC:CTC denominator %"PRIu64"\n", [INTEL_PT_CYC_BIT] = " CYC bit %#"PRIx64"\n", [INTEL_PT_MAX_NONTURBO_RATIO] = " Max non-turbo ratio %"PRIu64"\n", + [INTEL_PT_FILTER_STR_LEN] = " Filter string len. %"PRIu64"\n", };static void intel_pt_print_info (u64 *arr,int start,int finish)
@@ -2037,6 +2041,14 @@ static void intel_pt_print_info(u64 *arr, int start, int finish)fprintf (stdout, intel_pt_info_fmts[i], arr[i]); } +static void intel_pt_print_info_str (const char *name,const char *str) +{ +if (!dump_trace) +return ; + +fprintf (stdout," %-20s%s\n" , name, str ? str :"" ); +} +static bool intel_pt_has (struct auxtrace_info_event *auxtrace_info,int pos) { return auxtrace_info->header.size >=
@@ -2049,6 +2061,8 @@ int intel_pt_process_auxtrace_info(union perf_event *event,struct auxtrace_info_event *auxtrace_info = &event->auxtrace_info;size_t min_sz =sizeof (u64) *INTEL_PT_PER_CPU_MMAPS ;struct intel_pt *pt; +void *info_end; +u64 *info;int err; if (auxtrace_info->header.size < sizeof(struct auxtrace_info_event) +
@@ -2101,6 +2115,42 @@ int intel_pt_process_auxtrace_info(union perf_event *event, INTEL_PT_MAX_NONTURBO_RATIO); } + info = &auxtrace_info->priv[INTEL_PT_FILTER_STR_LEN ] +1 ; + info_end = (void *)info + auxtrace_info->header.size; + +if (intel_pt_has (auxtrace_info,INTEL_PT_FILTER_STR_LEN )) { +size_t len; + + len = auxtrace_info->priv[INTEL_PT_FILTER_STR_LEN ]; +intel_pt_print_info (&auxtrace_info->priv[0 ], +INTEL_PT_FILTER_STR_LEN , +INTEL_PT_FILTER_STR_LEN ); +if (len) { +const char *filter = (const char *)info; + + len =roundup (len +1 ,8 ); + info += len >>3 ; +if ((void *)info > info_end) { +pr_err ("%s: bad filter string length\n" , __func__); + err = -EINVAL ; + goto err_free_queues; + } + pt->filter =memdup (filter, len); +if (!pt->filter) { + err = -ENOMEM ; + goto err_free_queues; + } +if (session->header.needs_swap) +mem_bswap_64 (pt->filter, len); +if (pt->filter[len -1 ]) { +pr_err ("%s: filter string not null terminated\n" , __func__); + err = -EINVAL ; + goto err_free_queues; + } + } +intel_pt_print_info_str ("Filter string" , pt->filter); + } + pt->timeless_decoding =intel_pt_timeless_decoding (pt); pt->have_tsc =intel_pt_have_tsc (pt); pt->sampling_mode = false;
@@ -2218,6 +2268,7 @@ err_free_queues:auxtrace_queues__free (&pt->queues); session->auxtrace =NULL ; err_free: +zfree (&pt->filter);free (pt);return err; }
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 21/27 perf intel-pt: Enable decoder to handle TIP.PGD with missing IP
In reply to Arnaldo Carvalho de MeloFrom: Adrian Hunter <[email protected]>
When address filters are used, the decoder must detect the end of a filter region (or a branch into a tracestop region) by matching Packet Generation Disabled (TIP.PGD) packets against the object code using the IP given in the packet. However, due to errata SKL014 "Intel PT TIP.PGD May Not Have Target IP Payload", that IP may not be present.
Enable the decoder to handle that by adding a new callback function 'pgd_ip()' which indicates whether the IP is not traced, in which case that is the point where the trace was disabled.
--- .../perf/util/intel-pt-decoder/intel-pt-decoder.c | 30 ++++++++++++++++++++++ .../perf/util/intel-pt-decoder/intel-pt-decoder.h | 1 + 2 files changed, 31 insertions(+)
tools/perf/util/intel-pt-decoder/intel-pt-decoder.c +30 -0
@@ -80,6 +80,7 @@ struct intel_pt_decoder {int (*walk_insn)(struct intel_pt_insn *intel_pt_insn,uint64_t *insn_cnt_ptr,uint64_t *ip,uint64_t to_ip,uint64_t max_insn_cnt,void *data); +bool (*pgd_ip)(uint64_t ip,void *data);void *data;struct intel_pt_state state;const unsigned char *buf;
@@ -186,6 +187,7 @@ struct intel_pt_decoder *intel_pt_decoder_new(struct intel_pt_params *params) decoder->get_trace = params->get_trace; decoder->walk_insn = params->walk_insn; + decoder->pgd_ip = params->pgd_ip; decoder->data = params->data; decoder->return_compression = params->return_compression;
@@ -1008,6 +1010,19 @@ static int intel_pt_walk_tip(struct intel_pt_decoder *decoder)int err; err =intel_pt_walk_insn (decoder, &intel_pt_insn,0 ); +if (err ==INTEL_PT_RETURN && + decoder->pgd_ip && + decoder->pkt_state ==INTEL_PT_STATE_TIP_PGD && + (decoder->state.type &INTEL_PT_BRANCH ) && + decoder->pgd_ip (decoder->state.to_ip, decoder->data)) { +/* Unconditional branch leaving filter region */ + decoder->no_progress =0 ; + decoder->pge = false; + decoder->continuous_period = false; + decoder->pkt_state =INTEL_PT_STATE_IN_SYNC ; + decoder->state.to_ip =0 ; +return 0 ; + }if (err ==INTEL_PT_RETURN )return 0 ;if (err)
@@ -1036,6 +1051,21 @@ static int intel_pt_walk_tip(struct intel_pt_decoder *decoder) }if (intel_pt_insn.branch ==INTEL_PT_BR_CONDITIONAL ) { +uint64_t to_ip = decoder->ip + intel_pt_insn.length + + intel_pt_insn.rel; + +if (decoder->pgd_ip && + decoder->pkt_state ==INTEL_PT_STATE_TIP_PGD && + decoder->pgd_ip (to_ip, decoder->data)) { +/* Conditional branch leaving filter region */ + decoder->pge = false; + decoder->continuous_period = false; + decoder->pkt_state =INTEL_PT_STATE_IN_SYNC ; + decoder->ip = to_ip; + decoder->state.from_ip = decoder->ip; + decoder->state.to_ip =0 ; +return 0 ; + }intel_pt_log_at ("ERROR: Conditional branch when expecting indirect branch" , decoder->ip); decoder->pkt_state =INTEL_PT_STATE_ERR_RESYNC ;
tools/perf/util/intel-pt-decoder/intel-pt-decoder.h +1 -0
@@ -83,6 +83,7 @@ struct intel_pt_params {int (*walk_insn)(struct intel_pt_insn *intel_pt_insn,uint64_t *insn_cnt_ptr,uint64_t *ip,uint64_t to_ip,uint64_t max_insn_cnt,void *data); +bool (*pgd_ip)(uint64_t ip,void *data);void *data;bool return_compression;uint64_t period;
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 22/27 perf intel-pt: Fix decoding when there are address filters
In reply to Arnaldo Carvalho de MeloFrom: Adrian Hunter <[email protected]>
Due to errata SKL014 "Intel PT TIP.PGD May Not Have Target IP Payload", the Intel PT decoder needs to match address filters against TIP.PGD packets. Parse the address filters and implement the decoder's 'pgd_ip()' callback to match the IP against the filter regions.
--- tools/perf/util/intel-pt.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+)
tools/perf/util/intel-pt.c +82 -0
@@ -105,6 +105,7 @@ struct intel_pt {unsigned long num_events;char *filter; +struct addr_filters filts; };enum switch_state {
@@ -550,6 +551,76 @@ out_no_cache:return 0 ; } +static bool intel_pt_match_pgd_ip (struct intel_pt *pt,uint64_t ip, +uint64_t offset,const char *filename) +{ +struct addr_filter *filt; +bool have_filter = false; +bool hit_tracestop = false; +bool hit_filter = false; + +list_for_each_entry (filt, &pt->filts.head, list) { +if (filt->start) + have_filter = true; + +if ((filename && !filt->filename) || + (!filename && filt->filename) || + (filename &&strcmp (filename, filt->filename))) +continue ; + +if (!(offset >= filt->addr && offset < filt->addr + filt->size)) +continue ; + +intel_pt_log ("TIP.PGD ip %#" PRIx64" offset %#" PRIx64" in %s hit filter: %s offset %#" PRIx64" size %#" PRIx64"\n" , + ip, offset, filename ? filename :"[kernel]" , + filt->start ?"filter" :"stop" , + filt->addr, filt->size); + +if (filt->start) + hit_filter = true; +else + hit_tracestop = true; + } + +if (!hit_tracestop && !hit_filter) +intel_pt_log ("TIP.PGD ip %#" PRIx64" offset %#" PRIx64" in %s is not in a filter region\n" , + ip, offset, filename ? filename :"[kernel]" ); + +return hit_tracestop || (have_filter && !hit_filter); +} + +static int __intel_pt_pgd_ip (uint64_t ip,void *data) +{ +struct intel_pt_queue *ptq = data; +struct thread *thread; +struct addr_location al; +u8 cpumode; +u64 offset; + +if (ip >= ptq->pt->kernel_start) +return intel_pt_match_pgd_ip (ptq->pt, ip, ip,NULL ); + + cpumode =PERF_RECORD_MISC_USER ; + + thread = ptq->thread; +if (!thread) +return -EINVAL ; + +thread__find_addr_map (thread, cpumode,MAP__FUNCTION , ip, &al); +if (!al.map || !al.map->dso) +return -EINVAL ; + + offset = al.map->map_ip (al.map, ip); + +return intel_pt_match_pgd_ip (ptq->pt, ip, offset, + al.map->dso->long_name); +} + +static bool intel_pt_pgd_ip (uint64_t ip,void *data) +{ +return __intel_pt_pgd_ip (ip, data) >0 ; +} +static bool intel_pt_get_config (struct intel_pt *pt,struct perf_event_attr *attr,u64 *config) {
@@ -726,6 +797,9 @@ static struct intel_pt_queue *intel_pt_alloc_queue(struct intel_pt *pt, params.tsc_ctc_ratio_n = pt->tsc_ctc_ratio_n; params.tsc_ctc_ratio_d = pt->tsc_ctc_ratio_d; +if (pt->filts.cnt >0 ) + params.pgd_ip = intel_pt_pgd_ip; +if (pt->synth_opts.instructions) {if (pt->synth_opts.period) {switch (pt->synth_opts.period_type) {
@@ -1776,6 +1850,7 @@ static void intel_pt_free(struct perf_session *session)intel_pt_free_events (session); session->auxtrace =NULL ;thread__put (pt->unknown_thread); +addr_filters__exit (&pt->filts);zfree (&pt->filter);free (pt); }
@@ -2073,6 +2148,8 @@ int intel_pt_process_auxtrace_info(union perf_event *event,if (!pt)return -ENOMEM ; +addr_filters__init (&pt->filts); +perf_config (intel_pt_perf_config, pt); err =auxtrace_queues__init (&pt->queues);
@@ -2147,6 +2224,10 @@ int intel_pt_process_auxtrace_info(union perf_event *event, err = -EINVAL ; goto err_free_queues; } + err =addr_filters__parse_bare_filter (&pt->filts, + filter); +if (err) + goto err_free_queues; }intel_pt_print_info_str ("Filter string" , pt->filter); }
@@ -2268,6 +2349,7 @@ err_free_queues:auxtrace_queues__free (&pt->queues); session->auxtrace =NULL ; err_free: +addr_filters__exit (&pt->filts);zfree (&pt->filter);free (pt);return err;
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 23/27 perf probe: Ignore the error of finding inline instance
In reply to Arnaldo Carvalho de MeloFrom: Masami Hiramatsu <[email protected]>
Ignore the error when the perf probe failed to find inline function instances. This can happen when we search a method in C++ debuginfo. If there is completely no instance in target, perf probe can return an error.
E.g. without this fix:
----
$ perf probe -x /usr/lib64/libstdc++.so.6 -vD showmanyc
probe-definition(0): showmanyc
symbol:showmanyc file:(null) line:0 offset:0 return:0 lazy:(null)
0 arguments
symbol:catch file:(null) line:0 offset:0 return:0 lazy:(null)
symbol:throw file:(null) line:0 offset:0 return:0 lazy:(null)
symbol:rethrow file:(null) line:0 offset:0 return:0 lazy:(null)
Open Debuginfo file: /usr/lib/debug/usr/lib64/libstdc++.so.6.0.22.debug
Try to find probe point from debuginfo.
Matched function: showmanyc
An error occurred in debuginfo analysis (-2).
Trying to use symbols.
Failed to find symbol showmanyc in /usr/lib64/libstdc++.so.6.0.22
Error: Failed to add events. Reason: No such file or directory (Code: -2)
----This is because one of showmanyc is defined as inline but no instance found. With this fix, it is succeeded to show as below.
----
$ perf probe -x /usr/lib64/libstdc++.so.6 -D showmanyc p:probe_libstdc++/showmanyc /usr/lib64/libstdc++.so.6.0.22:0xb0e50 p:probe_libstdc++/showmanyc_1 /usr/lib64/libstdc++.so.6.0.22:0xc7c40 p:probe_libstdc++/showmanyc_2 /usr/lib64/libstdc++.so.6.0.22:0xecfa0 p:probe_libstdc++/showmanyc_3 /usr/lib64/libstdc++.so.6.0.22:0x115fc0 p:probe_libstdc++/showmanyc_4 /usr/lib64/libstdc++.so.6.0.22:0x121a90 ----
--- tools/perf/util/probe-finder.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/perf/util/probe-finder.c +3 -2
@@ -988,7 +988,8 @@ static int probe_point_search_cb(Dwarf_Die *sp_die, void *data)if (pp->file &&strtailcmp (pp->file,dwarf_decl_file (sp_die)))return DWARF_CB_OK ; -pr_debug ("Matched function: %s\n" ,dwarf_diename (sp_die)); +pr_debug ("Matched function: %s [%lx]\n" ,dwarf_diename (sp_die), + (unsigned long )dwarf_dieoffset (sp_die)); pf->fname =dwarf_decl_file (sp_die);if (pp->line) {/* Function relative line */ dwarf_decl_line (sp_die, &pf->lno);
@@ -1011,7 +1012,7 @@ static int probe_point_search_cb(Dwarf_Die *sp_die, void *data) param->retval =die_walk_instances (sp_die, probe_point_inline_cb, (void *)pf);/* This could be a non-existed inline definition */ -if (param->retval == -ENOENT &&strisglob (pp->function)) +if (param->retval == -ENOENT ) param->retval =0 ; }
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 24/27 perf probe: Skip if the function address is 0
In reply to Arnaldo Carvalho de MeloFrom: Masami Hiramatsu <[email protected]>
Skip probes if the entry address of the target function is 0. This can happen when we're handling C++ debuginfo files.
E.g. without this fix, below case still fail.
----
$ ./perf probe -x /usr/lib64/libstdc++.so.6 -vD is_open
probe-definition(0): is_open
symbol:is_open file:(null) line:0 offset:0 return:0 lazy:(null)
0 arguments
symbol:catch file:(null) line:0 offset:0 return:0 lazy:(null)
symbol:throw file:(null) line:0 offset:0 return:0 lazy:(null)
symbol:rethrow file:(null) line:0 offset:0 return:0 lazy:(null)
Open Debuginfo file: /usr/lib/debug/usr/lib64/libstdc++.so.6.0.22.debug
Try to find probe point from debuginfo.
Matched function: is_open [295df]
found inline addr: 0x8ca80
Probe point found: is_open+0
found inline addr: 0x8ca70
Probe point found: is_open+0
found inline addr: 0x8ca60
Probe point found: is_open+0
Matched function: is_open [6527f]
Matched function: is_open [9fe8a]
Probe point found: is_open+0
Matched function: is_open [19710b]
found inline addr: 0xecca9
Probe point found: stdio_filebuf+57
found inline addr: 0x0
Probe point found: swap+0
Matched function: is_open [19fc9d]
Probe point found: is_open+0
Found 7 probe_trace_events.
p:probe_libstdc++/is_open /usr/lib64/libstdc++.so.6.0.22:0x8ca80
p:probe_libstdc++/is_open_1 /usr/lib64/libstdc++.so.6.0.22:0x8ca70
p:probe_libstdc++/is_open_2 /usr/lib64/libstdc++.so.6.0.22:0x8ca60
p:probe_libstdc++/is_open_3 /usr/lib64/libstdc++.so.6.0.22:0xb0ad0
p:probe_libstdc++/is_open_4 /usr/lib64/libstdc++.so.6.0.22:0xecca9
Failed to synthesize probe trace event.
Error: Failed to add events. Reason: Invalid argument (Code: -22)
----
This is because some instances have entry_pc == 0 (see 19710b and
19fc9d). With this fix, those are skipped.----
$ ./perf probe -x /usr/lib64/libstdc++.so.6 -D is_open p:probe_libstdc++/is_open /usr/lib64/libstdc++.so.6.0.22:0x8ca80 p:probe_libstdc++/is_open_1 /usr/lib64/libstdc++.so.6.0.22:0x8ca70 p:probe_libstdc++/is_open_2 /usr/lib64/libstdc++.so.6.0.22:0x8ca60 p:probe_libstdc++/is_open_3 /usr/lib64/libstdc++.so.6.0.22:0xb0ad0 p:probe_libstdc++/is_open_4 /usr/lib64/libstdc++.so.6.0.22:0xecca9 ----
--- tools/perf/util/probe-finder.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
tools/perf/util/probe-finder.c +11 -1
@@ -955,6 +955,11 @@ static int probe_point_inline_cb(Dwarf_Die *in_die, void *data) dwarf_diename(in_die));return -ENOENT ; } +if (addr ==0 ) { +pr_debug ("%s has no valid entry address. skipped.\n" , +dwarf_diename (in_die)); +return -ENOENT ; + } pf->addr = addr; pf->addr += pp->offset; pr_debug("found inline addr: 0x%jx\n",
@@ -998,8 +1003,13 @@ static int probe_point_search_cb(Dwarf_Die *sp_die, void *data) }else if (die_is_func_instance (sp_die)) {/* Instances always have the entry address */ dwarf_entrypc (sp_die, &pf->addr); +/* But in some case the entry address is 0 */ +if (pf->addr ==0 ) { +pr_debug ("%s has no entry PC. Skipped\n" , +dwarf_diename (sp_die)); + param->retval =0 ;/* Real function */ -if (pp->lazy_line) + }else if (pp->lazy_line) param->retval =find_probe_point_lazy (sp_die, pf);else {skip_prologue (sp_die, pf);
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 25/27 perf probe: Fix to cut off incompatible chars from group name
In reply to Arnaldo Carvalho de MeloFrom: Masami Hiramatsu <[email protected]>
Cut off the characters which can not use for group name of uprobes when making it based on executable filename.
For example, if the exec name is libstdc++.so, without this fix perf probe generates "probe_libstdc++" as the group name, but it is failed to set because '+' can not be used for group name.
With this fix perf accepts only alphabet, number or '_' for group name, thus perf generates "probe_libstdc" as the group name.
E.g. with this fix, you can see the event name has no "+".
----
$ ./perf probe -x /usr/lib64/libstdc++.so.6 -D is_open p:probe_libstdc/is_open /usr/lib64/libstdc++.so.6.0.22:0x8ca80 p:probe_libstdc/is_open_1 /usr/lib64/libstdc++.so.6.0.22:0x8ca70 p:probe_libstdc/is_open_2 /usr/lib64/libstdc++.so.6.0.22:0x8ca60 p:probe_libstdc/is_open_3 /usr/lib64/libstdc++.so.6.0.22:0xb0ad0 p:probe_libstdc/is_open_4 /usr/lib64/libstdc++.so.6.0.22:0xecca9 ----
Committer note:
Before this fix:
# perf probe -x /usr/lib64/libstdc++.so.6 is_open
Failed to write event: Invalid argument
Error: Failed to add events.
#After the fix:
# perf probe -x /usr/lib64/libstdc++.so.6 is_open
Added new events:
probe_libstdc:is_open (on is_open in /usr/lib64/libstdc++.so.6.0.22)
probe_libstdc:is_open_1 (on is_open in /usr/lib64/libstdc++.so.6.0.22)
probe_libstdc:is_open_2 (on is_open in /usr/lib64/libstdc++.so.6.0.22)
probe_libstdc:is_open_3 (on is_open in /usr/lib64/libstdc++.so.6.0.22)
probe_libstdc:is_open_4 (on is_open in /usr/lib64/libstdc++.so.6.0.22)You can now use it in all perf tools, such as:
perf record -e probe_libstdc:is_open_4 -aR sleep 1
# perf probe -l probe_libstdc:*
probe_libstdc:is_open (on is_open@libstdc++-v3/include/fstream in /usr/lib64/libstdc++.so.6.0.22)
probe_libstdc:is_open_1 (on is_open@libstdc++-v3/include/fstream in /usr/lib64/libstdc++.so.6.0.22)
probe_libstdc:is_open_2 (on is_open@libstdc++-v3/include/fstream in /usr/lib64/libstdc++.so.6.0.22)
probe_libstdc:is_open_3 (on is_open@src/c++98/basic_file.cc in /usr/lib64/libstdc++.so.6.0.22)
probe_libstdc:is_open_4 (on stdio_filebuf:5@include/ext/stdio_filebuf.h in /usr/lib64/libstdc++.so.6.0.22)
#--- tools/perf/util/probe-event.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
tools/perf/util/probe-event.c +7 -3
@@ -213,9 +213,13 @@ static int convert_exec_to_group(const char *exec, char **result) goto out; } - ptr2 =strpbrk (ptr1,"-._" ); -if (ptr2) - *ptr2 ='\0' ; +for (ptr2 = ptr1; ptr2 !='\0' ; ptr2++) { +if (!isalnum (*ptr2) && *ptr2 !='_' ) { + *ptr2 ='\0' ; +break ; + } + } + ret =e_snprintf (buf,64 ,"%s_%s" ,PERFPROBE_GROUP , ptr1);if (ret <0 ) goto out;
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 26/27 perf probe: Match linkage name with mangled name
In reply to Arnaldo Carvalho de MeloFrom: Masami Hiramatsu <[email protected]>
Match linkage name with mangled name if exists. The linkage_name is used for storing mangled name of the object.
Thus, this allows 'perf probe' to find appropriate probe point from mangled symbol as below.
E.g. without this fix:
----
$ perf probe -x /usr/lib64/libstdc++.so.6 \
-D _ZNKSt15basic_fstreamXXIwSt11char_traitsIwEE7is_openEv
Probe point '_ZNKSt15basic_fstreamXXIwSt11char_traitsIwEE7is_openEv'
not found.
Error: Failed to add events.
----With this fix, perf probe can find the correct one.
----
$ perf probe -x /usr/lib64/libstdc++.so.6 \
-D _ZNKSt15basic_fstreamXXIwSt11char_traitsIwEE7is_openEv
p:probe_libstdc/_ZNKSt15basic_fstreamXXIwSt11char_traitsIwEE7is_openEv
/usr/lib64/libstdc++.so.6.0.22:0x8ca60
----Committer notes:
After the fix, setting it for real (no -D/--definition, that amounts to a --dry-run):
# perf probe -x /usr/lib64/libstdc++.so.6 _ZNKSt15basic_fstreamXXIwSt11char_traitsIwEE7is_openEv
Added new event:
probe_libstdc:_ZNKSt15basic_fstreamXXIwSt11char_traitsIwEE7is_openEv (on _ZNKSt15basic_fstreamXXIwSt11char_traitsIwEE7is_openEv in /usr/lib64/libstdc++.so.6.0.22)You can now use it in all perf tools, such as:
perf record -e probe_libstdc:_ZNKSt15basic_fstreamXXIwSt11char_traitsIwEE7is_openEv -aR sleep 1
# perf probe -l probe_libstdc:*
probe_libstdc:_ZNKSt15basic_fstreamXXIwSt11char_traitsIwEE7is_openEv (on is_open@libstdc++-v3/include/fstream in /usr/lib64/libstdc++.so.6.0.22)
#--- tools/perf/util/dwarf-aux.c | 28 ++++++++++++++++++++++++++-- tools/perf/util/dwarf-aux.h | 3 +++ 2 files changed, 29 insertions(+), 2 deletions(-)
tools/perf/util/dwarf-aux.c +26 -2
@@ -130,6 +130,22 @@ int cu_walk_functions_at(Dwarf_Die *cu_die, Dwarf_Addr addr, }/** +* die_get_linkage_name - Get the linkage name of the object +* @dw_die: A DIE of the object +* +* Get the linkage name attiribute of given @dw_die. +* For C++ binary, the linkage name will be the mangled symbol. +*/ +const char *die_get_linkage_name (Dwarf_Die *dw_die) +{ +Dwarf_Attribute attr; + +if (dwarf_attr_integrate (dw_die, DW_AT_linkage_name, &attr) ==NULL ) +return NULL ; +return dwarf_formstring (&attr); +} + +/** * die_compare_name - Compare diename and tname * @dw_die: a DIE * @tname: a string of target name
@@ -145,18 +161,26 @@ bool die_compare_name(Dwarf_Die *dw_die, const char *tname) }/** -* die_match_name - Match diename and glob +* die_match_name - Match diename/linkage name and glob * @dw_die: a DIE * @glob: a string of target glob pattern * * Glob matching the name of @dw_die and @glob. Return false if matching fail. +* This also match linkage name. */ bool die_match_name (Dwarf_Die *dw_die,const char *glob) {const char *name; name =dwarf_diename (dw_die); -return name ?strglobmatch (name, glob) : false; +if (name &&strglobmatch (name, glob)) +return true; +/* fall back to check linkage name */ + name =die_get_linkage_name (dw_die); +if (name &&strglobmatch (name, glob)) +return true; + +return false; }/**
tools/perf/util/dwarf-aux.h +3 -0
@@ -38,6 +38,9 @@ int cu_find_lineinfo(Dwarf_Die *cudie, unsigned long addr,int cu_walk_functions_at (Dwarf_Die *cu_die,Dwarf_Addr addr,int (*callback)(Dwarf_Die *,void *),void *data); +/* Get DW_AT_linkage_name (should be NULL for C binary) */ +const char *die_get_linkage_name (Dwarf_Die *dw_die); +/* Ensure that this DIE is a subprogram and definition (not declaration) */ bool die_is_func_def (Dwarf_Die *dw_die);
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 27/27 perf tests: Add dwarf unwind test for powerpc
In reply to Arnaldo Carvalho de MeloFrom: Ravi Bangoria <[email protected]>
The user stack dump feature was recently added for powerpc. But there was no test case available to test it.
This test works same as on other architectures by preparing a stack frame on the perf test thread and comparing each frame by unwinding it.
$ ./perf test 50
50: Test dwarf unwind : OkUser stack dump for powerpc: https://lkml.org/lkml/2016/4/28/482
--- tools/perf/arch/powerpc/Build | 1 + tools/perf/arch/powerpc/include/arch-tests.h | 13 ++++ tools/perf/arch/powerpc/include/perf_regs.h | 2 + tools/perf/arch/powerpc/tests/Build | 4 ++ tools/perf/arch/powerpc/tests/arch-tests.c | 15 +++++ tools/perf/arch/powerpc/tests/dwarf-unwind.c | 62 ++++++++++++++++++ tools/perf/arch/powerpc/tests/regs_load.S | 94 ++++++++++++++++++++++++++++ tools/perf/tests/Build | 2 +- tools/perf/tests/dwarf-unwind.c | 2 +- 9 files changed, 193 insertions(+), 2 deletions(-) create mode 100644 tools/perf/arch/powerpc/include/arch-tests.h create mode 100644 tools/perf/arch/powerpc/tests/Build create mode 100644 tools/perf/arch/powerpc/tests/arch-tests.c create mode 100644 tools/perf/arch/powerpc/tests/dwarf-unwind.c create mode 100644 tools/perf/arch/powerpc/tests/regs_load.S
tools/perf/arch/powerpc/Build +1 -0
@@ -1 +1,2 @@ libperf-y += util/ +libperf-y += tests/
tools/perf/arch/powerpc/include/arch-tests.h new file +13 -0
@@ -0,0 +1,13 @@ +#ifndef ARCH_TESTS_H +#define ARCH_TESTS_H + +#ifdef HAVE_DWARF_UNWIND_SUPPORT +struct thread ; +struct perf_sample ; +int test__arch_unwind_sample (struct perf_sample *sample, +struct thread *thread); +#endif + +extern struct test arch_tests[]; + +#endif
tools/perf/arch/powerpc/include/perf_regs.h +2 -0
@@ -5,6 +5,8 @@#include <linux/types.h> #include <asm/perf_regs.h> +void perf_regs_load (u64 *regs); +#define PERF_REGS_MASK ((1ULL << PERF_REG_POWERPC_MAX) - 1)#define PERF_REGS_MAX PERF_REG_POWERPC_MAX#ifdef __powerpc64__
tools/perf/arch/powerpc/tests/Build new file +4 -0
@@ -0,0 +1,4 @@ +libperf-$(CONFIG_DWARF_UNWIND) += regs_load.o +libperf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o + +libperf-y += arch-tests.o
tools/perf/arch/powerpc/tests/arch-tests.c new file +15 -0
@@ -0,0 +1,15 @@ +#include <string.h> +#include "tests/tests.h" +#include "arch-tests.h" + +struct test arch_tests[] = { +#ifdef HAVE_DWARF_UNWIND_SUPPORT + { + .desc = "Test dwarf unwind", + .func = test__dwarf_unwind, + }, +#endif + { + .func = NULL, + }, +};
tools/perf/arch/powerpc/tests/dwarf-unwind.c new file +62 -0
62 lines not on this page · raw message
tools/perf/arch/powerpc/tests/regs_load.S new file +94 -0
94 lines not on this page · raw message
tools/perf/tests/Build +1 -1
@@ -71,7 +71,7 @@ $(OUTPUT)tests/llvm-src-relocation.c: tests/bpf-script-test-relocation.c tests/B $(Q)sed -e 's/"/\\"/g' -e 's/\(.*\)/"\1\\n"/g' $< >> $@ $(Q)echo ';' >> $@ -ifeq ($(ARCH),$(filter $(ARCH),x86 arm arm64)) +ifeq ($(ARCH),$(filter $(ARCH),x86 arm arm64 powerpc)) perf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o endif
tools/perf/tests/dwarf-unwind.c +1 -1
@@ -11,7 +11,7 @@#include "thread.h" #include "callchain.h" -#if defined (__x86_64__) || defined (__i386__) +#if defined (__x86_64__) || defined (__i386__) || defined (__powerpc__)#include "arch-tests.h" #endif
Signature · 1 line
2.7.4
Quoted 286 lines · Arnaldo Carvalho de Melo
Hi Ingo,
Please consider pulling, more to come soon,
- Arnaldo
Build and test results at the end of this message.
The following changes since commit
6b652de2b27c0a4020ce0e8f277e782b6af76096:Merge tag 'perf-core-for-mingo-20160922' of
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linuxinto perf/core (2016-09-23 07:21:38 +0200)are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.gittags/perf-core-for-mingo-20160929for you to fetch changes up to
d18019a53a07e009899ff6b8dc5ec30f249360d9:perf tests: Add dwarf unwind test for powerpc (2016-09-29 11:18:21 -0300)
----------------------------------------------------------------
perf/core improvements and fixes:User visible:
-------------New features:
- Add support for using symbols in address filters with Intel PT and ARM CoreSight (hardware assisted tracing facilities) (Adrian Hunter, Mathieu Poirier)
Fixes:
- Fix MMAP event synthesis for pre-existing threads when no hugetlbfs mount is in place (Adrian Hunter)
- Don't ignore kernel idle symbols in 'perf script' (Adrian Hunter)
- Assorted Intel PT fixes (Adrian Hunter)
Improvements:
- Fix handling of C++ symbols in 'perf probe' (Masami Hiramatsu)
- Beautify sched_[gs]et_attr return value in 'perf trace' (Arnaldo Carvalho de Melo)
Infrastructure:
---------------New features:
- Add dwarf unwind 'perf test' for powerpc (Ravi Bangoria)
Fixes:
- Fix error paths in 'perf record' (Adrian Hunter)
Documentation:
- Update documentation info about quipper, a C++ parser for converting to/from perf.data/chromium profiling format (Simon Que)
Build Fixes:
Fix building in 32 bit platform with libbabeltrace (Wang Nan)
Signed-off-by Arnaldo Carvalho de Melo <[email protected]>----------------------------------------------------------------
Adrian Hunter (16):
perf record: Fix documentation 'event_sources' -> 'event_source' perf tools: Fix MMAP event synthesis broken byMAP_HUGETLBchange perf script: Fix vanished idle symbols
perf record: Rename label 'out_symbol_exit'
perf record: Fix error paths
perf symbols: Adddso__last_symbol()
perf record: Add support for using symbols in address filters perf probe: Increase debug level of SDT debug messages perf intel-pt: Fix snapshot overlap detection decoder errors perf intel-pt: Add support for recording the max non-turbo ratio perf intel-pt: Fix missing error codes processingauxtrace_infoperf intel-pt: Add a helper function for processingAUXTRACE_INFOperf intel-pt: Record address filter inAUXTRACE_INFOevent perf intel-pt: Read address filter fromAUXTRACE_INFOevent perf intel-pt: Enable decoder to handle TIP.PGD with missing IP perf intel-pt: Fix decoding when there are address filtersArnaldo Carvalho de Melo (1):
perf trace: Beautify sched_[gs]et_attr return valueMasami Hiramatsu (4):
perf probe: Ignore the error of finding inline instance perf probe: Skip if the function address is 0
perf probe: Fix to cut off incompatible chars from group name perf probe: Match linkage name with mangled nameMathieu Poirier (3):
perf tools: Makeperf_evsel__append_filter()generic perf evsel: New tracepoint specific function perf evsel: Add support for address filtersRavi Bangoria (1):
perf tests: Add dwarf unwind test for powerpcSimon Que (1):
perf tools: Update documentation info about quipperWang Nan (1):
perf data: Fix building in 32 bit platform with libbabeltracetools/perf/Documentation/perf-record.txt | 61 +- tools/perf/Documentation/perf.data-file-format.txt | 6 +- tools/perf/arch/powerpc/Build | 1 + tools/perf/arch/powerpc/include/arch-tests.h | 13 + tools/perf/arch/powerpc/include/perf_regs.h | 2 + tools/perf/arch/powerpc/tests/Build | 4 + tools/perf/arch/powerpc/tests/arch-tests.c | 15 + tools/perf/arch/powerpc/tests/dwarf-unwind.c | 62 ++ tools/perf/arch/powerpc/tests/regs_load.S | 94 +++ tools/perf/arch/x86/util/intel-pt.c | 57 +- tools/perf/builtin-record.c | 32 +- tools/perf/builtin-trace.c | 10 +- tools/perf/tests/Build | 2 +- tools/perf/tests/dwarf-unwind.c | 2 +- tools/perf/util/auxtrace.c | 737 +++++++++++++++++++++ tools/perf/util/auxtrace.h | 54 ++ tools/perf/util/build-id.c | 4 +- tools/perf/util/data-convert-bt.c | 2 +- tools/perf/util/dwarf-aux.c | 28 +- tools/perf/util/dwarf-aux.h | 3 + tools/perf/util/event.c | 3 +- tools/perf/util/evsel.c | 16 +- tools/perf/util/evsel.h | 5 +- tools/perf/util/evsel_fprintf.c | 7 +- .../perf/util/intel-pt-decoder/intel-pt-decoder.c | 30 + .../perf/util/intel-pt-decoder/intel-pt-decoder.h | 1 + tools/perf/util/intel-pt.c | 172 ++++- tools/perf/util/intel-pt.h | 4 +- tools/perf/util/parse-events.c | 41 +- tools/perf/util/probe-event.c | 10 +- tools/perf/util/probe-file.c | 2 +- tools/perf/util/probe-finder.c | 17 +- tools/perf/util/symbol.c | 15 + tools/perf/util/symbol.h | 1 + 34 files changed, 1451 insertions(+), 62 deletions(-) create mode 100644 tools/perf/arch/powerpc/include/arch-tests.h create mode 100644 tools/perf/arch/powerpc/tests/Build create mode 100644 tools/perf/arch/powerpc/tests/arch-tests.c create mode 100644 tools/perf/arch/powerpc/tests/dwarf-unwind.c create mode 100644 tools/perf/arch/powerpc/tests/regs_load.S# time dm 1 alpine:3.4: Ok 2 android-ndk:r12b-arm: Ok 3 archlinux:latest: Ok 4 centos:5: Ok 5 centos:6: Ok 6 centos:7: Ok 7 debian:7: Ok 8 debian:8: Ok 9 debian:experimental: Ok 10 fedora:20: Ok 11 fedora:21: Ok 12 fedora:22: Ok 13 fedora:23: Ok 14 fedora:24: Ok 15 fedora:24-x-ARC-uClibc: Ok 16 fedora:rawhide: Ok 17 mageia:5: Ok 18 opensuse:13.2: Ok 19 opensuse:42.1: Ok 20 opensuse:tumbleweed: Ok 21 ubuntu:12.04.5: Ok 22 ubuntu:14.04: Ok 23 ubuntu:14.04.4: Ok 24 ubuntu:15.10: Ok 25 ubuntu:16.04: Ok 26 ubuntu:16.04-x-arm: Ok 27 ubuntu:16.04-x-arm64: Ok 28 ubuntu:16.04-x-powerpc: Ok 29 ubuntu:16.04-x-powerpc64: Ok 30 ubuntu:16.04-x-powerpc64el: Ok 31 ubuntu:16.04-x-s390: Ok 32 ubuntu:16.10: Ok 33 2246.21real 37m26.862s
user 0m2.148s
sys 0m2.256s
## 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 events tests : Ok 6: Validate PERF_RECORD_* events & perf_sample fields : Ok 7: Test perf pmu format parsing : Ok 8: Test dso data read : Ok 9: Test dso data cache : Ok 10: Test dso data reopen : Ok 11: roundtrip evsel->name check : Ok 12: Check parsing of sched tracepoints fields : Ok 13: Generate and check syscalls:sys_enter_openat event fields: Ok 14: struct perf_event_attr setup : Ok 15: Test matching and linking multiple hists : Ok 16: Try 'import perf' in python, checking link problems : Ok 17: Test breakpoint overflow signal handler : Ok 18: Test breakpoint overflow sampling : Ok 19: Test number of exit event of a simple workload : Ok 20: Test software clock events have valid period values : Ok 21: Test object code reading : Ok 22: Test sample parsing : Ok 23: Test using a dummy software event to keep tracking : Ok 24: Test parsing with no sample_id_all bit set : Ok 25: Test filtering hist entries : Ok 26: Test mmap thread lookup : Ok 27: Test thread mg sharing : Ok 28: Test output sorting of hist entries : Ok 29: Test cumulation of child hist entries : Ok 30: Test tracking 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: Test kmod_path__parse function : Ok 34: Test thread map : Ok 35: Test LLVM searching and compiling : 35.1: Basic BPF llvm compiling test : Ok 35.2: Test kbuild searching : Ok 35.3: Compile source for BPF prologue generation test : Ok 35.4: Compile source for BPF relocation test : Ok 36: Test topology in session : Ok 37: Test BPF filter : 37.1: Test basic BPF filtering : Ok 37.2: Test BPF prologue generation : Ok 37.3: Test BPF relocation checker : Ok 38: Test thread map synthesize : Ok 39: Test cpu map synthesize : Ok 40: Test stat config synthesize : Ok 41: Test stat synthesize : Ok 42: Test stat round synthesize : Ok 43: Test attr update synthesize : Ok 44: Test events times : Ok 45: Test backward reading from ring buffer : Ok 46: Test cpu map print : Ok 47: Test SDT event probing : Ok 48: Test is_printable_array function : Ok 49: Test bitmap print : Ok 50: x86 rdpmc test : Ok 51: Test converting perf time to TSC : Ok 52: Test dwarf unwind : Ok 53: Test x86 instruction decoder - new instructions : Ok 54: Test intel cqm nmi context read : Skip #$ make -C tools/perf build-test make: Entering directory '/home/acme/git/linux/tools/perf' tarpkg: ./tests/perf-targz-src-pkg . make_debug_O: make DEBUG=1 make_no_libnuma_O: make NO_LIBNUMA=1 make_no_slang_O: make NO_SLANG=1 make_no_libaudit_O: make NO_LIBAUDIT=1 make_no_libbpf_O: make NO_LIBBPF=1 make_install_prefix_slash_O: make install prefix=/tmp/krava/ make_tags_O: make tags make_doc_O: make doc make_no_libunwind_O: make NO_LIBUNWIND=1 make_install_bin_O: make install-bin make_no_libbionic_O: make NO_LIBBIONIC=1 make_with_babeltrace_O: make LIBBABELTRACE=1 make_no_demangle_O: make NO_DEMANGLE=1 make_perf_o_O: make perf.o make_no_auxtrace_O: make NO_AUXTRACE=1 make_no_scripts_O: make NO_LIBPYTHON=1 NO_LIBPERL=1 make_pure_O: make make_util_map_o_O: make util/map.o make_no_libdw_dwarf_unwind_O: make NO_LIBDW_DWARF_UNWIND=1 make_no_newt_O: make NO_NEWT=1 make_no_libpython_O: make NO_LIBPYTHON=1 make_util_pmu_bison_o_O: make util/pmu-bison.o make_help_O: make help make_install_prefix_O: make install prefix=/tmp/krava make_static_O: make LDFLAGS=-static make_no_ui_O: make NO_NEWT=1 NO_SLANG=1 NO_GTK2=1 make_no_backtrace_O: make NO_BACKTRACE=1 make_clean_all_O: make clean all
Quoted 8 lines
make_install_O: make install
make_no_libelf_O: make NO_LIBELF=1
make_no_libperl_O: make NO_LIBPERL=1
make_no_gtk2_O: make NO_GTK2=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
OK
make: Leaving directory '/home/acme/git/linux/tools/perf'
$Pulled, thanks a lot Arnaldo!
Ingo