Re: [GIT PULL 00/52] New Tool: perf c2c

From: Kim Phillips
Date: Thu Oct 20 2016 - 19:02:47 EST


On Thu, 20 Oct 2016 12:03:44 -0300
Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> wrote:

> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-c2c-for-mingo-20161020

Running this as a normal user may not be the best thing to do, but I'm
pretty sure the TUI c2c report shouldn't sigsegv:

-----

$ tools/perf/perf c2c record -e ldlat-loads lat_mem_rd 16 4096
WARNING: Kernel address maps (/proc/{kallsyms,modules}) are restricted,
check /proc/sys/kernel/kptr_restrict.

Samples in kernel functions may not be resolved if a suitable vmlinux
file is not found in the buildid cache or in the vmlinux path.

Samples in kernel modules won't be resolved at all.

If some relocation was applied (e.g. kexec) symbols may be misresolved
even with a suitable vmlinux or kallsyms file.

Couldn't record kernel reference relocation symbol
Symbol resolution may be skewed if relocation was used (e.g. kexec).
Check /proc/kallsyms permission or run as root.
"stride=4096
0.00391 1.224
0.00586 1.220
0.00781 1.229
0.01172 1.230
0.01562 1.222
0.02344 1.225
0.03125 1.234
0.04688 3.659
0.06250 3.673
0.09375 3.683
0.12500 3.693
0.18750 5.803
0.25000 7.223
0.37500 12.460
0.50000 13.308
0.75000 13.759
1.00000 13.712
1.50000 12.916
2.00000 12.508
3.00000 12.245
4.00000 12.474
6.00000 27.549
8.00000 65.141
12.00000 79.808
16.00000 84.384

[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.008 MB perf.data ]

$ tools/perf/perf c2c report --stdio
=================================================
Trace Event Information
=================================================
Total records : 0
Locked Load/Store Operations : 0
Load Operations : 0
Loads - uncacheable : 0
Loads - IO : 0
Loads - Miss : 0
Loads - no mapping : 0
Load Fill Buffer Hit : 0
Load L1D hit : 0
Load L2D hit : 0
Load LLC hit : 0
Load Local HITM : 0
Load Remote HITM : 0
Load Remote HIT : 0
Load Local DRAM : 0
Load Remote DRAM : 0
Load MESI State Exclusive : 0
Load MESI State Shared : 0
Load LLC Misses : 0
LLC Misses to Local DRAM : -nan%
LLC Misses to Remote DRAM : -nan%
LLC Misses to Remote cache (HIT) : -nan%
LLC Misses to Remote cache (HITM) : -nan%
Store Operations : 0
Store - uncacheable : 0
Store - no mapping : 0
Store L1D Hit : 0
Store L1D Miss : 0
No Page Map Rejects : 0
Unable to parse data source : 0

=================================================
Global Shared Cache Line Event Information
=================================================
Total Shared Cache Lines : 0
Load HITs on shared lines : 0
Fill Buffer Hits on shared lines : 0
L1D hits on shared lines : 0
L2D hits on shared lines : 0
LLC hits on shared lines : 0
Locked Access on shared lines : 0
Store HITs on shared lines : 0
Store L1D hits on shared lines : 0
Total Merged records : 0

=================================================
c2c details
=================================================
Events : cpu/mem-loads,ldlat=30/P:u
Cachelines sort on : Remote HITMs
Cacheline data grouping : offset,pid,tid,iaddr

=================================================
Shared Data Cache Line Table
=================================================
#
# Total Rmt ----- LLC Load Hitm ----- ---- Store Reference ---- --- Load Dram ---- LLC T
# Index Cacheline records Hitm Total Lcl Rmt Total L1Hit L1Miss Lcl Rmt Ld Miss L
# ..... .................. ....... ....... ....... ....... ....... ....... ....... ....... ........ ........ ....... ...
#

=================================================
Shared Cache Line Distribution Pareto
=================================================
#

$ tools/perf/perf c2c report
perf: Segmentation fault
-------- backtrace --------
tools/perf/perf[0x56504b]
/lib/x86_64-linux-gnu/libc.so.6(+0x354a0)[0x7facb45794a0]
tools/perf/perf(cmd_c2c+0x13bc)[0x45b2fc]
tools/perf/perf[0x48df61]
tools/perf/perf(main+0x6f6)[0x4249b6]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7facb4564830]
tools/perf/perf(_start+0x29)[0x424aa9]
[0x0]

$ gdb tools/perf/perf
...
(gdb) run c2c report
...
Program received signal SIGSEGV, Segmentation fault.
c2c_browser__update_nr_entries (hb=<optimized out>, hb=<optimized out>) at builtin-c2c.c:2142
2142 nr_entries++;
(gdb) bt
#0 c2c_browser__update_nr_entries (hb=<optimized out>, hb=<optimized out>) at builtin-c2c.c:2142
#1 perf_c2c__hists_browse (hists=0x8b2d90 <c2c+240>) at builtin-c2c.c:2287
#2 perf_c2c_display (session=0x205b1a0) at builtin-c2c.c:2316
#3 perf_c2c__report (argv=<optimized out>, argc=<optimized out>) at builtin-c2c.c:2621
#4 cmd_c2c (argc=<optimized out>, argv=<optimized out>, prefix=<optimized out>) at builtin-c2c.c:2748
#5 0x000000000048df61 in run_builtin (p=p@entry=0x8be168 <commands+72>, argc=argc@entry=2, argv=argv@entry=0x7fffffffddb0)
at perf.c:358
#6 0x00000000004249b6 in handle_internal_command (argv=0x7fffffffddb0, argc=2) at perf.c:420
#7 run_argv (argv=0x7fffffffdb40, argcp=0x7fffffffdb4c) at perf.c:466
#8 main (argc=2, argv=0x7fffffffddb0) at perf.c:610
(gdb)

All the above work fine when run under sudo.

Here are some other details, in case they matter:

$ uname -r
4.7.9+
$ dmesg | grep Perf
[ 0.112348] Performance Events: PEBS fmt3+, 32-deep LBR, Skylake events, full-width counters, Intel PMU driver.
$ make -C tools/perf clean >& /dev/null ; make -C tools/perf |& grep -i warn
Warning: x86_64's syscall_64.tbl differs from kernel
Warning: tools/include/uapi/linux/bpf.h differs from kernel
Warning: tools/arch/x86/lib/memcpy_64.S differs from kernel
Warning: tools/arch/x86/lib/memset_64.S differs from kernel
Warning: tools/arch/arm/include/uapi/asm/kvm.h differs from kernel
Warning: tools/include/uapi/asm-generic/mman-common.h differs from kernel
$ tools/perf/perf config -l
buildid.dir=/dev/null
$ tools/perf/perf mem record -e list
ldlat-loads : available
ldlat-stores : available
$

Thanks,

Kim