Web lists-archives.com

Re: [PATCH 01/11] perf tests parse-events: Add intel_pt parse test

On Wed, 16 May 2018 11:48:58 -0300
Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> wrote:

> From: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
> To avoid regressions such as the one fixed by 4a35a9027f64 ("Revert
> "perf pmu: Fix pmu events parsing rule""), where '-e intel_pt//u' got
> broken, with this new entry in this 'perf tests' subtest, we would have
> caught it before pushing upstream.
> Acked-by: Jiri Olsa <jolsa@xxxxxxxxxx>
> Cc: Adrian Hunter <adrian.hunter@xxxxxxxxx>
> Cc: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>
> Cc: Andi Kleen <ak@xxxxxxxxxxxxxxx>
> Cc: David Ahern <dsahern@xxxxxxxxx>
> Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
> Cc: Kan Liang <kan.liang@xxxxxxxxxxxxxxx>
> Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> Cc: Wang Nan <wangnan0@xxxxxxxxxx>
> Link: https://lkml.kernel.org/n/tip-kw62fys9bwdgsp722so2ln1l@xxxxxxxxxxxxxx
> Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
> ---

This causes a SEGV on Arm, and an Intel box without Intel-PT h/w:

(gdb) run test -F -v 6
Starting program: /home/kimphi01/git/linux-perf-acme/tools/perf/perf test -F -v 6
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
 6: Parse event definition strings             :
--- start ---
running test 0 'syscalls:sys_enter_openat'
Using CPUID GenuineIntel-6-3C
running test 51 'L1-dcache-misses/name=cachepmu/'
running test 52 'intel_pt//u'

Program received signal SIGSEGV, Segmentation fault.
__GI___vasprintf_chk (result_ptr=0x8, flags=1, format=<optimized out>, args=args@entry=0x7fffffffbf30)
    at vasprintf_chk.c:88
88	vasprintf_chk.c: No such file or directory.
(gdb) bt
#0  __GI___vasprintf_chk (result_ptr=0x8, flags=1, format=<optimized out>, args=args@entry=0x7fffffffbf30)
    at vasprintf_chk.c:88
#1  0x00007ffff6456e6f in __asprintf_chk (result_ptr=result_ptr@entry=0x8, flags=flags@entry=1, 
    format=format@entry=0x555555992e80 "Cannot find PMU `%s'. Missing kernel support?") at asprintf_chk.c:32
#2  0x0000555555766836 in asprintf (__fmt=0x555555992e80 "Cannot find PMU `%s'. Missing kernel support?", __ptr=0x8)
    at /usr/include/x86_64-linux-gnu/bits/stdio2.h:178
#3  parse_events_add_pmu (parse_state=parse_state@entry=0x7fffffffdda0, list=list@entry=0x555555e137d0, 
    name=0x5555563e84e0 "intel_pt", head_config=0x0, auto_merge_stats=auto_merge_stats@entry=false, 
    use_alias=use_alias@entry=false) at util/parse-events.c:1236
#4  0x00005555557aaaae in parse_events_parse (_parse_state=_parse_state@entry=0x7fffffffdda0, scanner=0x555555d38c40)
    at util/parse-events.y:235
#5  0x0000555555761ccf in parse_events__scanner (start_token=258, parse_state=0x7fffffffdda0, str=<optimized out>)
    at util/parse-events.c:1796
#6  parse_events (evlist=evlist@entry=0x555555d381f0, str=<optimized out>, err=err@entry=0x0)
    at util/parse-events.c:1836
#7  0x000055555571eb65 in test_event (e=0x555555bf4f80 <test.events+1248>, e=0x555555bf4f80 <test.events+1248>)
    at tests/parse-events.c:1695
#8  test_events (events=0x555555bf4aa0 <test.events>, cnt=53) at tests/parse-events.c:1717
#9  test__parse_events (test=<optimized out>, subtest=<optimized out>) at tests/parse-events.c:1837
#10 0x0000555555716a11 in run_test (subtest=-1, test=0x555555bfca78 <generic_tests+280>) at tests/builtin-test.c:348
#11 test_and_print (t=t@entry=0x555555bfca78 <generic_tests+280>, force_skip=force_skip@entry=false, 
    subtest=subtest@entry=-1) at tests/builtin-test.c:378
#12 0x0000555555717e2f in __cmd_test (skiplist=0x0, argv=0x7fffffffe5c0, argc=1) at tests/builtin-test.c:570
#13 cmd_test (argc=1, argv=0x7fffffffe5c0) at tests/builtin-test.c:709
#14 0x0000555555738b41 in run_builtin (p=0x555555bfd848 <commands+552>, argc=4, argv=0x7fffffffe5c0) at perf.c:303
#15 0x0000555555738e3e in handle_internal_command (argc=4, argv=0x7fffffffe5c0) at perf.c:355
#16 0x00005555556b3901 in run_argv (argcp=<synthetic pointer>, argv=<synthetic pointer>) at perf.c:399
#17 main (argc=<optimized out>, argv=0x7fffffffe5c0) at perf.c:543