30 Dec, 2020

2 commits

  • [ Upstream commit b2ce5dbc15819ea4bef47dbd368239cb1e965158 ]

    Commit e1c92a7fbbc5 ("perf tests: Add another metric parsing test") add
    another test for metric parsing. The test goes through all metrics
    compiled for arch within pmu events and try to parse them.

    Right now this test is failing in powerpc machine.

    Result in power9 platform:

    [command]# ./perf test 10
    10: PMU events :
    10.1: PMU event table sanity : Ok
    10.2: PMU event map aliases : Ok
    10.3: Parsing of PMU event table metrics : Skip (some metrics failed)
    10.4: Parsing of PMU event table metrics with fake PMUs : FAILED!

    Issue is we are passing different runtime parameter value in
    "expr__find_other" and "expr__parse" function which is called from
    function `metric_parse_fake`. And because of this parsing of hv-24x7
    metrics is failing.

    [command]# ./perf test 10 -vv
    .....
    hv_24x7/pm_mcs01_128b_rd_disp_port01,chip=1/ not found
    expr__parse failed
    test child finished with -1
    ---- end ----
    PMU events subtest 4: FAILED!

    This patch fix this issue and change runtime parameter value to '0' in
    expr__parse function.

    Result in power9 platform after this patch:

    [command]# ./perf test 10
    10: PMU events :
    10.1: PMU event table sanity : Ok
    10.2: PMU event map aliases : Ok
    10.3: Parsing of PMU event table metrics : Skip (some metrics failed)
    10.4: Parsing of PMU event table metrics with fake PMUs : Ok

    Fixes: e1c92a7fbbc5 ("perf tests: Add another metric parsing test")
    Signed-off-by: Kajol Jain
    Acked-by: Ian Rogers
    Acked-by: Jiri Olsa
    Cc: Madhavan Srinivasan
    Cc: Ravi Bangoria
    Link: http://lore.kernel.org/lkml/20201119152411.46041-1-kjain@linux.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin

    Kajol Jain
     
  • [ Upstream commit 9b0a7836359443227c9af101f7aea8412e739458 ]

    I found that the UNHALTED_CORE_CYCLES event is only available in the
    Intel machines and it makes other vendors/archs fail on the test. As
    libpfm4 can parse the generic events like cycles, let's use them.

    Fixes: 40b74c30ffb9 ("perf test: Add expand cgroup event test")
    Signed-off-by: Namhyung Kim
    Acked-by: Ian Rogers
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: Jiri Olsa
    Cc: Mark Rutland
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lore.kernel.org/lkml/20201027072855.655449-1-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin

    Namhyung Kim
     

13 Nov, 2020

2 commits

  • Since the commit 943b69ac1884 ("perf parse-events: Set exclude_guest=1
    for user-space counting"), 'exclude_guest=1' is set for user-space
    counting; and the branch sample's modifier has been altered, the sample
    event name has been changed from "branches:u:" to "branches:uH:", which
    gives out info for "user-space and host counting".

    But the cs-etm testing's regular expression cannot match the updated
    branch sample event and leads to test failure.

    This patch updates the branch sample pattern by using a more flexible
    expression '.*' to match branch sample's modifiers, so that allows the
    testing to work as expected.

    Fixes: 943b69ac1884 ("perf parse-events: Set exclude_guest=1 for user-space counting")
    Signed-off-by: Leo Yan
    Reviewed-by: Mathieu Poirier
    Cc: Alexander Shishkin
    Cc: Jin Yao
    Cc: Jiri Olsa
    Cc: Mark Rutland
    Cc: Mike Leach
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Suzuki Poulouse
    Cc: coresight ml
    Cc: stable@kernel.org
    Link: http://lore.kernel.org/lkml/20201110063417.14467-2-leo.yan@linaro.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Leo Yan
     
  • Fix a typo: s/devce_name/device_name.

    Fixes: fe0aed19b266 ("perf test: Introduce script for Arm CoreSight testing")
    Signed-off-by: Leo Yan
    Reviewed-by: Mathieu Poirier
    Cc: Alexander Shishkin
    Cc: Jin Yao
    Cc: Jiri Olsa
    Cc: Mark Rutland
    Cc: Mike Leach
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Suzuki Poulouse
    Cc: coresight ml
    Cc: stable@kernel.org
    Link: http://lore.kernel.org/lkml/20201110063417.14467-1-leo.yan@linaro.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Leo Yan
     

03 Nov, 2020

1 commit

  • The GCC specific __attribute__((optimize)) attribute does not what is
    commonly expected and is explicitly recommended against using in
    production code by the GCC people.

    Unlike what is often expected, it doesn't add to the optimization flags,
    but it fully replaces them, loosing any and all optimization flags
    provided by the compiler commandline.

    The only guaranteed upon means of inhibiting tail-calls is by placing a
    volatile asm with side-effects after the call such that the tail-call simply
    cannot be done.

    Given the original commit wasn't specific on which calls were the problem, this
    removal might re-introduce the problem, which can then be re-analyzed and cured
    properly.

    Signed-off-by: Peter Zijlstra
    Acked-by: Ard Biesheuvel
    Acked-by: Miguel Ojeda
    Cc: Alexei Starovoitov
    Cc: Arnd Bergmann
    Cc: Arvind Sankar
    Cc: Daniel Borkmann
    Cc: Geert Uytterhoeven
    Cc: Ian Rogers
    Cc: Josh Poimboeuf
    Cc: Kees Kook
    Cc: Martin Liška
    Cc: Nick Desaulniers
    Cc: Randy Dunlap
    Cc: Thomas Gleixner
    Link: http://lore.kernel.org/lkml/20201028081123.GT2628@hirez.programming.kicks-ass.net
    Signed-off-by: Arnaldo Carvalho de Melo

    Peter Zijlstra
     

14 Oct, 2020

5 commits

  • Peter suggested that using the exclusive mode in perf could avoid some
    problems with bad scheduling of groups. Exclusive is implemented in the
    kernel, but wasn't exposed by the perf tool, so hard to use without
    custom low level API users.

    Add support for marking groups or events with :e for exclusive in the
    perf tool. The implementation is basically the same as the existing
    pinned attribute.

    Committer testing:

    # perf test "parse event"
    6: Parse event definition strings : Ok
    # perf test -v "parse event" |& grep :u*e
    running test 56 'instructions:uep'
    running test 57 '{cycles,cache-misses,branch-misses}:e'
    #
    #
    # grep "model name" -m1 /proc/cpuinfo
    model name : AMD Ryzen 9 3900X 12-Core Processor
    #
    # perf stat -a -e '{cycles,cache-misses,branch-misses}:e' sleep 1

    Performance counter stats for 'system wide':

    cycles (0.00%)
    cache-misses (0.00%)
    branch-misses (0.00%)

    1.001269893 seconds time elapsed

    Some events weren't counted. Try disabling the NMI watchdog:
    echo 0 > /proc/sys/kernel/nmi_watchdog
    perf stat ...
    echo 1 > /proc/sys/kernel/nmi_watchdog
    # echo 0 > /proc/sys/kernel/nmi_watchdog
    # perf stat -a -e '{cycles,cache-misses,branch-misses}:e' sleep 1

    Performance counter stats for 'system wide':

    1,298,663,141 cycles
    30,962,215 cache-misses
    5,325,150 branch-misses

    1.001474934 seconds time elapsed

    #
    # The output for asking for precise events on AMD needs to improve, it
    # supposedly works only for system wide or per CPU
    #
    # perf stat -a -e '{cycles,cache-misses,branch-misses}:uep' sleep 1
    Error:
    The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (cycles).
    /bin/dmesg | grep -i perf may provide additional information.

    # perf stat -a -e '{cycles,cache-misses,branch-misses}:ue' sleep 1

    Performance counter stats for 'system wide':

    746,363,126 cycles
    16,881,611 cache-misses
    2,871,259 branch-misses

    1.001636066 seconds time elapsed

    #

    Signed-off-by: Andi Kleen
    Acked-by: Jiri Olsa
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Andi Kleen
    Cc: Peter Zijlstra
    Link: http://lore.kernel.org/lkml/20201014144255.22699-1-andi@firstfloor.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Andi Kleen
     
  • Add a test for the build id cache that adds a binary with sha1 and md5
    build ids and verifies it's added properly.

    The test updates build id cache with 'perf record' and 'perf buildid-cache -a'.

    Committer testing:

    # perf test "build id"
    82: build id cache operations : Ok
    #
    # perf test -v "build id"
    82: build id cache operations :
    --- start ---
    test child forked, pid 447218
    test binaries: /tmp/perf.ex.SHA1.B8I /tmp/perf.ex.MD5.7Nv
    Adding d1abc1eb7568358cf23c959566f23462461834d1 /tmp/perf.ex.SHA1.B8I: Ok
    build id: d1abc1eb7568358cf23c959566f23462461834d1
    link: /tmp/perf.debug.sS2/.build-id/d1/abc1eb7568358cf23c959566f23462461834d1
    file: /tmp/perf.debug.sS2/.build-id/d1/../../tmp/perf.ex.SHA1.B8I/d1abc1eb7568358cf23c959566f23462461834d1/elf
    OK for /tmp/perf.ex.SHA1.B8I
    Adding a50e350e97c43b4708d09bcd85ebfff7 /tmp/perf.ex.MD5.7Nv: Ok
    build id: a50e350e97c43b4708d09bcd85ebfff7
    link: /tmp/perf.debug.IuW/.build-id/a5/0e350e97c43b4708d09bcd85ebfff7
    file: /tmp/perf.debug.IuW/.build-id/a5/../../tmp/perf.ex.MD5.7Nv/a50e350e97c43b4708d09bcd85ebfff7/elf
    OK for /tmp/perf.ex.MD5.7Nv
    [ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 0.034 MB /tmp/perf.data.xrH ]
    build id: d1abc1eb7568358cf23c959566f23462461834d1
    link: /tmp/perf.debug.eGR/.build-id/d1/abc1eb7568358cf23c959566f23462461834d1
    file: /tmp/perf.debug.eGR/.build-id/d1/../../tmp/perf.ex.SHA1.B8I/d1abc1eb7568358cf23c959566f23462461834d1/elf
    OK for /tmp/perf.ex.SHA1.B8I
    [ perf record: Woken up 2 times to write data ]
    [ perf record: Captured and wrote 0.034 MB /tmp/perf.data.cbE ]
    build id: a50e350e97c43b4708d09bcd85ebfff7
    link: /tmp/perf.debug.82t/.build-id/a5/0e350e97c43b4708d09bcd85ebfff7
    file: /tmp/perf.debug.82t/.build-id/a5/../../tmp/perf.ex.MD5.7Nv/a50e350e97c43b4708d09bcd85ebfff7/elf
    OK for /tmp/perf.ex.MD5.7Nv
    test child finished with 0
    ---- end ----
    build id cache operations: Ok
    #

    Signed-off-by: Jiri Olsa
    Acked-by: Ian Rogers
    Tested-by: Arnaldo Carvalho de Melo
    Link: https://lore.kernel.org/r/20201013192441.1299447-10-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • Passing build_id object to build_id__sprintf function, so it can operate
    with the proper size of build id.

    This will create proper md5 build id readable names,
    like following:

    a50e350e97c43b4708d09bcd85ebfff7

    instead of:

    a50e350e97c43b4708d09bcd85ebfff700000000

    Signed-off-by: Jiri Olsa
    Acked-by: Ian Rogers
    Link: https://lore.kernel.org/r/20201013192441.1299447-5-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • Pass a build_id object to filename__read_build_id function, so it can
    populate the size of the build_id object.

    Changing filename__read_build_id() code for both ELF/non-ELF code.

    Signed-off-by: Jiri Olsa
    Acked-by: Ian Rogers
    Link: https://lore.kernel.org/r/20201013192441.1299447-3-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • To help figure out where it is getting the binding.

    Cc: Adrian Hunter
    Cc: Ian Rogers
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

28 Sep, 2020

2 commits

  • Ensure 'st' is initialized before an error branch is taken.
    Fixes test "67: Parse and process metrics" with LLVM msan:

    ==6757==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x5570edae947d in rblist__exit tools/perf/util/rblist.c:114:2
    #1 0x5570edb1c6e8 in runtime_stat__exit tools/perf/util/stat-shadow.c:141:2
    #2 0x5570ed92cfae in __compute_metric tools/perf/tests/parse-metric.c:187:2
    #3 0x5570ed92cb74 in compute_metric tools/perf/tests/parse-metric.c:196:9
    #4 0x5570ed92c6d8 in test_recursion_fail tools/perf/tests/parse-metric.c:318:2
    #5 0x5570ed92b8c8 in test__parse_metric tools/perf/tests/parse-metric.c:356:2
    #6 0x5570ed8de8c1 in run_test tools/perf/tests/builtin-test.c:410:9
    #7 0x5570ed8ddadf in test_and_print tools/perf/tests/builtin-test.c:440:9
    #8 0x5570ed8dca04 in __cmd_test tools/perf/tests/builtin-test.c:661:4
    #9 0x5570ed8dbc07 in cmd_test tools/perf/tests/builtin-test.c:807:9
    #10 0x5570ed7326cc in run_builtin tools/perf/perf.c:313:11
    #11 0x5570ed731639 in handle_internal_command tools/perf/perf.c:365:8
    #12 0x5570ed7323cd in run_argv tools/perf/perf.c:409:2
    #13 0x5570ed731076 in main tools/perf/perf.c:539:3

    Fixes: commit f5a56570a3f2 ("perf test: Fix memory leaks in parse-metric test")
    Signed-off-by: Ian Rogers
    Reviewed-by: Nick Desaulniers
    Cc: Alexander Shishkin
    Cc: Jiri Olsa
    Cc: Mark Rutland
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: clang-built-linux@googlegroups.com
    Link: http://lore.kernel.org/lkml/20200923210655.4143682-1-irogers@google.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Ian Rogers
     
  • It'll expand given events for cgroups A, B and C.

    $ perf test -v expansion
    69: Event expansion for cgroups :
    --- start ---
    test child forked, pid 983140
    metric expr 1 / IPC for CPI
    metric expr instructions / cycles for IPC
    found event instructions
    found event cycles
    adding {instructions,cycles}:W
    copying metric event for cgroup 'A': instructions (idx=0)
    copying metric event for cgroup 'B': instructions (idx=0)
    copying metric event for cgroup 'C': instructions (idx=0)
    test child finished with 0
    ---- end ----
    Event expansion for cgroups: Ok

    Signed-off-by: Namhyung Kim
    Acked-by: Jiri Olsa
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: Ian Rogers
    Cc: John Garry
    Cc: Mark Rutland
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lore.kernel.org/lkml/20200924124455.336326-6-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     

18 Sep, 2020

2 commits


15 Sep, 2020

5 commits

  • The following leaks were detected by ASAN:

    Indirect leak of 360 byte(s) in 9 object(s) allocated from:
    #0 0x7fecc305180e in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10780e)
    #1 0x560578f6dce5 in perf_pmu__new_format util/pmu.c:1333
    #2 0x560578f752fc in perf_pmu_parse util/pmu.y:59
    #3 0x560578f6a8b7 in perf_pmu__format_parse util/pmu.c:73
    #4 0x560578e07045 in test__pmu tests/pmu.c:155
    #5 0x560578de109b in run_test tests/builtin-test.c:410
    #6 0x560578de109b in test_and_print tests/builtin-test.c:440
    #7 0x560578de401a in __cmd_test tests/builtin-test.c:661
    #8 0x560578de401a in cmd_test tests/builtin-test.c:807
    #9 0x560578e49354 in run_builtin /home/namhyung/project/linux/tools/perf/perf.c:312
    #10 0x560578ce71a8 in handle_internal_command /home/namhyung/project/linux/tools/perf/perf.c:364
    #11 0x560578ce71a8 in run_argv /home/namhyung/project/linux/tools/perf/perf.c:408
    #12 0x560578ce71a8 in main /home/namhyung/project/linux/tools/perf/perf.c:538
    #13 0x7fecc2b7acc9 in __libc_start_main ../csu/libc-start.c:308

    Fixes: cff7f956ec4a1 ("perf tests: Move pmu tests into separate object")
    Signed-off-by: Namhyung Kim
    Acked-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: Ian Rogers
    Cc: Mark Rutland
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lore.kernel.org/lkml/20200915031819.386559-12-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • It didn't release resources when there's an error so the
    test_recursion_fail() will leak some memory.

    Fixes: 0a507af9c681a ("perf tests: Add parse metric test for ipc metric")
    Signed-off-by: Namhyung Kim
    Acked-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: Ian Rogers
    Cc: Mark Rutland
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lore.kernel.org/lkml/20200915031819.386559-7-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • The aliases were never released causing the following leaks:

    Indirect leak of 1224 byte(s) in 9 object(s) allocated from:
    #0 0x7feefb830628 in malloc (/lib/x86_64-linux-gnu/libasan.so.5+0x107628)
    #1 0x56332c8f1b62 in __perf_pmu__new_alias util/pmu.c:322
    #2 0x56332c8f401f in pmu_add_cpu_aliases_map util/pmu.c:778
    #3 0x56332c792ce9 in __test__pmu_event_aliases tests/pmu-events.c:295
    #4 0x56332c792ce9 in test_aliases tests/pmu-events.c:367
    #5 0x56332c76a09b in run_test tests/builtin-test.c:410
    #6 0x56332c76a09b in test_and_print tests/builtin-test.c:440
    #7 0x56332c76ce69 in __cmd_test tests/builtin-test.c:695
    #8 0x56332c76ce69 in cmd_test tests/builtin-test.c:807
    #9 0x56332c7d2214 in run_builtin /home/namhyung/project/linux/tools/perf/perf.c:312
    #10 0x56332c6701a8 in handle_internal_command /home/namhyung/project/linux/tools/perf/perf.c:364
    #11 0x56332c6701a8 in run_argv /home/namhyung/project/linux/tools/perf/perf.c:408
    #12 0x56332c6701a8 in main /home/namhyung/project/linux/tools/perf/perf.c:538
    #13 0x7feefb359cc9 in __libc_start_main ../csu/libc-start.c:308

    Fixes: 956a78356c24c ("perf test: Test pmu-events aliases")
    Signed-off-by: Namhyung Kim
    Reviewed-by: John Garry
    Acked-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: Ian Rogers
    Cc: Mark Rutland
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lore.kernel.org/lkml/20200915031819.386559-11-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • Add test that a sibling with leader sampling doesn't have its period
    cleared.

    Signed-off-by: Ian Rogers
    Acked-by: Jiri Olsa
    Cc: Adrian Hunter
    Cc: Alexander Shishkin
    Cc: Alexei Starovoitov
    Cc: Andi Kleen
    Cc: Andrii Nakryiko
    Cc: Athira Jajeev
    Cc: Daniel Borkmann
    Cc: John Fastabend
    Cc: KP Singh
    Cc: Mark Rutland
    Cc: Martin KaFai Lau
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Song Liu
    Cc: Stephane Eranian
    Cc: Yonghong Song
    Cc: bpf@vger.kernel.org
    Cc: netdev@vger.kernel.org
    Link: http://lore.kernel.org/lkml/20200912025655.1337192-5-irogers@google.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Ian Rogers
     
  • When compiling with DEBUG=1 on Fedora 32 I'm getting crash for 'perf
    test signal':

    Program received signal SIGSEGV, Segmentation fault.
    0x0000000000c68548 in __test_function ()
    (gdb) bt
    #0 0x0000000000c68548 in __test_function ()
    #1 0x00000000004d62e9 in test_function () at tests/bp_signal.c:61
    #2 0x00000000004d689a in test__bp_signal (test=0xa8e280 DW_AT_producer : (indirect string, offset: 0x254a): GNU C99 10.2.1 20200723 (Red Hat 10.2.1-1) -mtune=generic -march=x86-64 -ggdb3 -std=gnu99 -fno-omit-frame-pointer -funwind-tables -fstack-protector-all
    ^^^^^
    ^^^^^
    ^^^^^
    $

    Before:

    $ perf test signal
    20: Breakpoint overflow signal handler : FAILED!
    $

    After:

    $ perf test signal
    20: Breakpoint overflow signal handler : Ok
    $

    Fixes: 8fd34e1cce18 ("perf test: Improve bp_signal")
    Signed-off-by: Jiri Olsa
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Alexander Shishkin
    Cc: Michael Petlan
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Wang Nan
    Link: http://lore.kernel.org/lkml/20200911130005.1842138-1-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     

10 Sep, 2020

2 commits

  • There's no longer need to call test_attr__open() from
    sys_perf_event_open(), because both 'perf record' and 'perf stat' call
    evsel__open_cpu(), so we can call it directly from there and not polute
    the perf-sys.h header.

    Committer testing:

    Before and after:

    # perf test attr
    17: Setup struct perf_event_attr : Ok
    49: Synthesize attr update : Ok
    # perf test -v attr
    17: Setup struct perf_event_attr :
    --- start ---
    test child forked, pid 2170868
    running '/home/acme/libexec/perf-core/tests/attr/test-record-branch-filter-any_ret'
    unsupp '/home/acme/libexec/perf-core/tests/attr/test-record-branch-filter-any_ret'
    running '/home/acme/libexec/perf-core/tests/attr/test-record-C0'
    running '/home/acme/libexec/perf-core/tests/attr/test-record-graph-fp'
    running '/home/acme/libexec/perf-core/tests/attr/test-record-period'
    running '/home/acme/libexec/perf-core/tests/attr/test-record-group-sampling'
    running '/home/acme/libexec/perf-core/tests/attr/test-record-freq'
    running '/home/acme/libexec/perf-core/tests/attr/test-stat-detailed-3'
    running '/home/acme/libexec/perf-core/tests/attr/test-record-branch-filter-k'
    unsupp '/home/acme/libexec/perf-core/tests/attr/test-record-branch-filter-k'
    running '/home/acme/libexec/perf-core/tests/attr/test-stat-group1'
    running '/home/acme/libexec/perf-core/tests/attr/test-record-branch-filter-u'
    unsupp '/home/acme/libexec/perf-core/tests/attr/test-record-branch-filter-u'
    running '/home/acme/libexec/perf-core/tests/attr/test-stat-basic'
    running '/home/acme/libexec/perf-core/tests/attr/test-record-branch-filter-any_call'
    unsupp '/home/acme/libexec/perf-core/tests/attr/test-record-branch-filter-any_call'
    running '/home/acme/libexec/perf-core/tests/attr/test-stat-default'
    running '/home/acme/libexec/perf-core/tests/attr/test-record-graph-dwarf'
    running '/home/acme/libexec/perf-core/tests/attr/test-record-no-buffering'
    running '/home/acme/libexec/perf-core/tests/attr/test-record-raw'
    running '/home/acme/libexec/perf-core/tests/attr/test-stat-detailed-2'
    running '/home/acme/libexec/perf-core/tests/attr/test-record-count'
    running '/home/acme/libexec/perf-core/tests/attr/test-record-data'
    running '/home/acme/libexec/perf-core/tests/attr/test-record-branch-filter-any'
    unsupp '/home/acme/libexec/perf-core/tests/attr/test-record-branch-filter-any'
    running '/home/acme/libexec/perf-core/tests/attr/test-stat-group'
    running '/home/acme/libexec/perf-core/tests/attr/test-record-branch-any'
    unsupp '/home/acme/libexec/perf-core/tests/attr/test-record-branch-any'
    running '/home/acme/libexec/perf-core/tests/attr/test-record-graph-default'
    running '/home/acme/libexec/perf-core/tests/attr/test-record-no-samples'
    running '/home/acme/libexec/perf-core/tests/attr/test-stat-C0'
    running '/home/acme/libexec/perf-core/tests/attr/test-record-no-inherit'
    running '/home/acme/libexec/perf-core/tests/attr/test-record-branch-filter-ind_call'
    unsupp '/home/acme/libexec/perf-core/tests/attr/test-record-branch-filter-ind_call'
    running '/home/acme/libexec/perf-core/tests/attr/test-record-basic'
    running '/home/acme/libexec/perf-core/tests/attr/test-record-group1'
    running '/home/acme/libexec/perf-core/tests/attr/test-record-pfm-period'
    unsupp '/home/acme/libexec/perf-core/tests/attr/test-record-pfm-period'
    running '/home/acme/libexec/perf-core/tests/attr/test-stat-detailed-1'
    running '/home/acme/libexec/perf-core/tests/attr/test-stat-no-inherit'
    running '/home/acme/libexec/perf-core/tests/attr/test-record-branch-filter-hv'
    unsupp '/home/acme/libexec/perf-core/tests/attr/test-record-branch-filter-hv'
    running '/home/acme/libexec/perf-core/tests/attr/test-record-group'
    test child finished with 0
    ---- end ----
    Setup struct perf_event_attr: Ok
    49: Synthesize attr update :
    --- start ---
    test child forked, pid 2171004
    test child finished with 0
    ---- end ----
    Synthesize attr update: Ok
    #

    Signed-off-by: Jiri Olsa
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Alexander Shishkin
    Cc: Ian Rogers
    Cc: Jiri Olsa
    Cc: Michael Petlan
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lore.kernel.org/lkml/20200827193201.GB127372@krava
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • We need a simple method to test Perf with ARM CoreSight drivers, this
    could be used for smoke testing when new patch is coming for perf or
    CoreSight drivers, and we also can use the test to confirm if the
    CoreSight has been enabled successfully on new platforms.

    This patch introduces the shell script test_arm_coresight.sh which is
    under the 'pert test' framework. This script provides three testing
    scenarios:

    Test scenario 1: traverse all possible paths between source and sink

    For traversing possible paths, simply to say, the testing rationale is
    source oriented testing, it traverses every source (now only refers to
    ETM device) and test its all possible sinks. To search the complete
    paths from one specific source to its sinks, this patch relies on the
    sysfs '/sys/bus/coresight/devices/devX/out:Y' for depth-first search
    (DFS) for iteration connected device nodes, if the output device is
    detected as a sink device (the script will exclude TPIU device which can
    not be supported for perf PMU), then it will test trace data recording
    and decoding for it.

    The script runs three output testings for every trace data:

    - Test branch samples dumping with 'perf script' command;

    - Test branch samples reporting with 'perf report' command;

    - Use option '--itrace=i1000i' to insert synthesized instructions events
    and the script will check if perf can output the percentage value
    successfully based on the instruction samples.

    Test scenario 2: system-wide test

    For system-wide testing, it passes option '-a' to perf tool to enable
    tracing on all CPUs, so it's hard to say which program will be traced.
    But perf tool itself contributes much overload in this case, so it will
    parse trace data and check if process 'perf' can be detected or not.

    Test scenario 3: snapshot mode test.

    For snapshot mode testing, it uses 'dd' command to launch a long running
    program, so this can give chance to send signal -USR2; it will check the
    captured trace data contains 'dd' related thread info or not.

    If any test fails, it will report failure and directly exit with error.
    This test will be only applied on a platform with PMU event 'cs_etm//',
    otherwise will skip the testing.

    Below is detailed usage for it:

    # cd $linux/tools/perf -> This is important so can use shell script
    # perf test list
    [...]
    70: probe libc's inet_pton & backtrace it with ping
    71: Check Arm CoreSight trace data recording and synthesized samples
    72: Check open filename arg using perf trace + vfs_getname
    73: Zstd perf.data compression/decompression
    74: Add vfs_getname probe to get syscall args filenames
    75: Use vfs_getname probe to get syscall args filenames

    # perf test 71
    71: Check Arm CoreSight trace data recording and branch samples: Ok

    Signed-off-by: Leo Yan
    Reviewed-by: Mathieu Poirier
    Reviewed-by: Suzuki Poulouse
    Cc: Alexander Shishkin
    Cc: Jiri Olsa
    Cc: Mark Rutland
    Cc: Mathieu Poirier
    Cc: Mike Leach
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lore.kernel.org/lkml/20200907130154.9601-1-leo.yan@linaro.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Leo Yan
     

09 Sep, 2020

1 commit


05 Sep, 2020

1 commit

  • This adds a precompiled file in PE binary format, with split debug file,
    and tries to read its build_id and .gnu_debuglink sections, as well as
    looking up the main symbol from the debug file. This should succeed if
    libbfd is supported.

    Committer testing:

    $ perf test "PE file support"
    68: PE file support : Ok
    $

    Signed-off-by: Remi Bernon
    Tested-by: Arnaldo Carvalho de Melo
    Acked-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Jacek Caban
    Cc: Mark Rutland
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lore.kernel.org/lkml/20200821165238.1340315-3-rbernon@codeweavers.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Remi Bernon
     

01 Sep, 2020

2 commits

  • Linux 5.9 introduced perf test case "Parse and process metrics" and
    on s390 this test case always dumps core:

    [root@t35lp67 perf]# ./perf test -vvvv -F 67
    67: Parse and process metrics :
    --- start ---
    metric expr inst_retired.any / cpu_clk_unhalted.thread for IPC
    parsing metric: inst_retired.any / cpu_clk_unhalted.thread
    Segmentation fault (core dumped)
    [root@t35lp67 perf]#

    I debugged this core dump and gdb shows this call chain:

    (gdb) where
    #0 0x000003ffabc3192a in __strnlen_c_1 () from /lib64/libc.so.6
    #1 0x000003ffabc293de in strcasestr () from /lib64/libc.so.6
    #2 0x0000000001102ba2 in match_metric(list=0x1e6ea20 "inst_retired.any",
    n=)
    at util/metricgroup.c:368
    #3 find_metric (map=, map=,
    metric=0x1e6ea20 "inst_retired.any")
    at util/metricgroup.c:765
    #4 __resolve_metric (ids=0x0, map=, metric_list=0x0,
    metric_no_group=, m=)
    at util/metricgroup.c:844
    #5 resolve_metric (ids=0x0, map=0x0, metric_list=0x0,
    metric_no_group=)
    at util/metricgroup.c:881
    #6 metricgroup__add_metric (metric=,
    metric_no_group=metric_no_group@entry=false, events=,
    events@entry=0x3ffd84fb878, metric_list=0x0,
    metric_list@entry=0x3ffd84fb868, map=0x0)
    at util/metricgroup.c:943
    #7 0x00000000011034ae in metricgroup__add_metric_list (map=0x13f9828 ,
    metric_list=0x3ffd84fb868, events=0x3ffd84fb878,
    metric_no_group=, list=)
    at util/metricgroup.c:988
    #8 parse_groups (perf_evlist=perf_evlist@entry=0x1e70260,
    str=str@entry=0x12f34b2 "IPC", metric_no_group=,
    metric_no_merge=,
    fake_pmu=fake_pmu@entry=0x1462f18 ,
    metric_events=0x3ffd84fba58, map=0x1)
    at util/metricgroup.c:1040
    #9 0x0000000001103eb2 in metricgroup__parse_groups_test(
    evlist=evlist@entry=0x1e70260, map=map@entry=0x13f9828 ,
    str=str@entry=0x12f34b2 "IPC",
    metric_no_group=metric_no_group@entry=false,
    metric_no_merge=metric_no_merge@entry=false,
    metric_events=0x3ffd84fba58)
    at util/metricgroup.c:1082
    #10 0x00000000010c84d8 in __compute_metric (ratio2=0x0, name2=0x0,
    ratio1=, name1=0x12f34b2 "IPC",
    vals=0x3ffd84fbad8, name=0x12f34b2 "IPC")
    at tests/parse-metric.c:159
    #11 compute_metric (ratio=, vals=0x3ffd84fbad8,
    name=0x12f34b2 "IPC")
    at tests/parse-metric.c:189
    #12 test_ipc () at tests/parse-metric.c:208
    .....
    ..... omitted many more lines

    This test case was added with
    commit 218ca91df477 ("perf tests: Add parse metric test for frontend metric").

    When I compile with make DEBUG=y it works fine and I do not get a core dump.

    It turned out that the above listed function call chain worked on a struct
    pmu_event array which requires a trailing element with zeroes which was
    missing. The marco map_for_each_event() loops over that array tests for members
    metric_expr/metric_name/metric_group being non-NULL. Adding this element fixes
    the issue.

    Output after:

    [root@t35lp46 perf]# ./perf test 67
    67: Parse and process metrics : Ok
    [root@t35lp46 perf]#

    Committer notes:

    As Ian remarks, this is not s390 specific:

    This also shows up with address sanitizer on all architectures
    (perhaps change the patch title) and perhaps add a "Fixes: "
    tag.

    =================================================================
    ==4718==ERROR: AddressSanitizer: global-buffer-overflow on address
    0x55c93b4d59e8 at pc 0x55c93a1541e2 bp 0x7ffd24327c60 sp
    0x7ffd24327c58
    READ of size 8 at 0x55c93b4d59e8 thread T0
    #0 0x55c93a1541e1 in find_metric tools/perf/util/metricgroup.c:764:2
    #1 0x55c93a153e6c in __resolve_metric tools/perf/util/metricgroup.c:844:9
    #2 0x55c93a152f18 in resolve_metric tools/perf/util/metricgroup.c:881:9
    #3 0x55c93a1528db in metricgroup__add_metric
    tools/perf/util/metricgroup.c:943:9
    #4 0x55c93a151996 in metricgroup__add_metric_list
    tools/perf/util/metricgroup.c:988:9
    #5 0x55c93a1511b9 in parse_groups tools/perf/util/metricgroup.c:1040:8
    #6 0x55c93a1513e1 in metricgroup__parse_groups_test
    tools/perf/util/metricgroup.c:1082:9
    #7 0x55c93a0108ae in __compute_metric tools/perf/tests/parse-metric.c:159:8
    #8 0x55c93a010744 in compute_metric tools/perf/tests/parse-metric.c:189:9
    #9 0x55c93a00f5ee in test_ipc tools/perf/tests/parse-metric.c:208:2
    #10 0x55c93a00f1e8 in test__parse_metric
    tools/perf/tests/parse-metric.c:345:2
    #11 0x55c939fd7202 in run_test tools/perf/tests/builtin-test.c:410:9
    #12 0x55c939fd6736 in test_and_print tools/perf/tests/builtin-test.c:440:9
    #13 0x55c939fd58c3 in __cmd_test tools/perf/tests/builtin-test.c:661:4
    #14 0x55c939fd4e02 in cmd_test tools/perf/tests/builtin-test.c:807:9
    #15 0x55c939e4763d in run_builtin tools/perf/perf.c:313:11
    #16 0x55c939e46475 in handle_internal_command tools/perf/perf.c:365:8
    #17 0x55c939e4737e in run_argv tools/perf/perf.c:409:2
    #18 0x55c939e45f7e in main tools/perf/perf.c:539:3

    0x55c93b4d59e8 is located 0 bytes to the right of global variable
    'pme_test' defined in 'tools/perf/tests/parse-metric.c:17:25'
    (0x55c93b4d54a0) of size 1352
    SUMMARY: AddressSanitizer: global-buffer-overflow
    tools/perf/util/metricgroup.c:764:2 in find_metric
    Shadow bytes around the buggy address:
    0x0ab9a7692ae0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    0x0ab9a7692af0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    0x0ab9a7692b00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    0x0ab9a7692b10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    0x0ab9a7692b20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    =>0x0ab9a7692b30: 00 00 00 00 00 00 00 00 00 00 00 00 00[f9]f9 f9
    0x0ab9a7692b40: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9
    0x0ab9a7692b50: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9
    0x0ab9a7692b60: f9 f9 f9 f9 f9 f9 f9 f9 00 00 00 00 00 00 00 00
    0x0ab9a7692b70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    0x0ab9a7692b80: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9
    Shadow byte legend (one shadow byte represents 8 application bytes):
    Addressable: 00
    Partially addressable: 01 02 03 04 05 06 07
    Heap left redzone: fa
    Freed heap region: fd
    Stack left redzone: f1
    Stack mid redzone: f2
    Stack right redzone: f3
    Stack after return: f5
    Stack use after scope: f8
    Global redzone: f9
    Global init order: f6
    Poisoned by user: f7
    Container overflow: fc
    Array cookie: ac
    Intra object redzone: bb
    ASan internal: fe
    Left alloca redzone: ca
    Right alloca redzone: cb
    Shadow gap: cc

    I'm also adding the missing "Fixes" tag and setting just .name to NULL,
    as doing it that way is more compact (the compiler will zero out
    everything else) and the table iterators look for .name being NULL as
    the sentinel marking the end of the table.

    Fixes: 0a507af9c681ac2a ("perf tests: Add parse metric test for ipc metric")
    Signed-off-by: Thomas Richter
    Reviewed-by: Sumanth Korikkar
    Acked-by: Ian Rogers
    Cc: Heiko Carstens
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Sven Schnelle
    Cc: Vasily Gorbik
    Link: http://lore.kernel.org/lkml/20200825071211.16959-1-tmricht@linux.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Thomas Richter
     
  • Currently if we run 'perf record -e cycles:u', exclude_guest=0.

    But it doesn't make sense in most cases that we request for
    user-space counting but we also get the guest report.

    Of course, we also need to consider 'perf kvm' usage case that
    authorized perf users on the host may only want to count guest user
    space events. For example,

    # perf kvm --guest record -e cycles:u

    When we have 'exclude_guest=1' for 'perf kvm' usage, we may get nothing
    from guest events.

    To keep perf semantics consistent and clear, this patch sets
    exclude_guest=1 for user-space counting but except for 'perf kvm' usage.

    Before:

    perf record -e cycles:u ./div
    perf evlist -v
    cycles:u: ..., exclude_kernel: 1, exclude_hv: 1, ...

    After:
    perf record -e cycles:u ./div
    perf evlist -v
    cycles:u: ..., exclude_kernel: 1, exclude_hv: 1, exclude_guest: 1, ...

    Before:
    perf kvm --guest record -e cycles:u -vvv

    perf_event_attr:

    size 120
    { sample_period, sample_freq } 4000
    sample_type IP|TID|TIME|ID|CPU|PERIOD
    read_format ID
    disabled 1
    inherit 1
    exclude_kernel 1
    exclude_hv 1
    freq 1
    sample_id_all 1

    After:

    perf kvm --guest record -e cycles:u -vvv

    perf_event_attr:
    size 120
    { sample_period, sample_freq } 4000
    sample_type IP|TID|TIME|ID|CPU|PERIOD
    read_format ID
    disabled 1
    inherit 1
    exclude_kernel 1
    exclude_hv 1
    freq 1
    sample_id_all 1

    For Before/After, exclude_guest are both 0 for perf kvm usage.

    perf test 6

    6: Parse event definition strings : Ok

    Signed-off-by: Jin Yao
    Tested-by: Like Xu
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: Jin Yao
    Cc: Jiri Olsa
    Cc: Kan Liang
    Cc: Peter Zijlstra
    Link: http://lore.kernel.org/lkml/20200814012120.16647-1-yao.jin@linux.intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Jin Yao
     

21 Aug, 2020

1 commit

  • BPF basic filtering test fails on s390x (when vmlinux debuginfo is
    utilized instead of /proc/kallsyms)

    Info:
    - bpf_probe_load installs the bpf code at do_epoll_wait.
    - For s390x, do_epoll_wait resolves to 3 functions including inlines.
    found inline addr: 0x43769e
    Probe point found: __s390_sys_epoll_wait+6
    found inline addr: 0x437290
    Probe point found: do_epoll_wait+0
    found inline addr: 0x4375d6
    Probe point found: __se_sys_epoll_wait+6
    - add_bpf_event creates evsel for every probe in a BPF object. This
    results in 3 evsels.

    Solution:
    - Expected result = 50% of the samples to be collected from epoll_wait *
    number of entries present in the evlist.

    Committer testing:

    # perf test 42
    42: BPF filter :
    42.1: Basic BPF filtering : Ok
    42.2: BPF pinning : Ok
    42.3: BPF prologue generation : Ok
    42.4: BPF relocation checker : Ok
    #

    Signed-off-by: Sumanth Korikkar
    Reviewed-by: Thomas Richter
    Tested-by: Arnaldo Carvalho de Melo
    Cc: bpf@vger.kernel.org
    Cc: Heiko Carstens
    Cc: Jiri Olsa
    Cc: Sven Schnelle
    LPU-Reference: 20200817072754.58344-1-sumanthk@linux.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Sumanth Korikkar
     

13 Aug, 2020

1 commit

  • Sometimes when adding a kprobe by perf, it results in multiple probe
    points, such as the following:

    # ./perf probe -l
    probe:vfs_getname (on getname_flags:73@fs/namei.c with pathname)
    probe:vfs_getname_1 (on getname_flags:73@fs/namei.c with pathname)
    probe:vfs_getname_2 (on getname_flags:73@fs/namei.c with pathname)
    # cat /sys/kernel/debug/tracing/kprobe_events
    p:probe/vfs_getname _text+5501804 pathname=+0(+0(%gpr31)):string
    p:probe/vfs_getname_1 _text+5505388 pathname=+0(+0(%gpr31)):string
    p:probe/vfs_getname_2 _text+5508396 pathname=+0(+0(%gpr31)):string

    In this test, we need to record all of them and expect any of them in
    the perf-script output, since it's not clear which one will be used for
    the desired syscall:

    # perf stat -e probe:vfs_getname\* -- touch /tmp/nic

    Performance counter stats for 'touch /tmp/nic':

    31 probe:vfs_getname_2
    0 probe:vfs_getname_1
    1 probe:vfs_getname
    0.001421826 seconds time elapsed

    0.001506000 seconds user
    0.000000000 seconds sys

    If the test relies only on probe:vfs_getname, it might easily miss the
    relevant data.

    Signed-off-by: Michael Petlan
    Cc: Jiri Olsa
    LPU-Reference: 20200722135845.29958-1-mpetlan@redhat.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Michael Petlan
     

03 Aug, 2020

1 commit


31 Jul, 2020

1 commit

  • Commit 5aa98879efe7 ("s390/cpum_sf: prohibit callchain data collection")
    prohibits call graph sampling for hardware events on s390. The
    information recorded is out of context and does not match.

    On s390 this commit now breaks test case 68 Zstd perf.data
    compression/decompression.

    Therefore omit call graph sampling on s390 in this test.

    Output before:
    [root@t35lp46 perf]# ./perf test -Fv 68
    68: Zstd perf.data compression/decompression :
    --- start ---
    Collecting compressed record file:
    Error:
    cycles: PMU Hardware doesn't support sampling/overflow-interrupts.
    Try 'perf stat'
    ---- end ----
    Zstd perf.data compression/decompression: FAILED!
    [root@t35lp46 perf]#

    Output after:
    [root@t35lp46 perf]# ./perf test -Fv 68
    68: Zstd perf.data compression/decompression :
    --- start ---
    Collecting compressed record file:
    500+0 records in
    500+0 records out
    256000 bytes (256 kB, 250 KiB) copied, 0.00615638 s, 41.6 MB/s
    [ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 0.004 MB /tmp/perf.data.X3M,
    compressed (original 0.002 MB, ratio is 3.609) ]
    Checking compressed events stats:
    # compressed : Zstd, level = 1, ratio = 4
    COMPRESSED events: 1
    2ELIFREPh---- end ----
    Zstd perf.data compression/decompression: Ok
    [root@t35lp46 perf]#

    Signed-off-by: Thomas Richter
    Reviewed-by: Sumanth Korikkar
    Cc: Heiko Carstens
    Cc: Sven Schnelle
    Cc: Vasily Gorbik
    Link: http://lore.kernel.org/lkml/20200729135314.91281-1-tmricht@linux.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Thomas Richter
     

30 Jul, 2020

8 commits

  • Adding test for metric group plus compute_metric_group function to get
    metrics values within the group.

    Committer notes:

    Fixed this;

    tests/parse-metric.c:327:7: error: missing field 'val' initializer [-Werror,-Wmissing-field-initializers]
    { 0 },
    ^

    Signed-off-by: Jiri Olsa
    Reviewed-by: Kajol Jain
    Acked-by: Ian Rogers
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: John Garry
    Cc: Michael Petlan
    Cc: Namhyung Kim
    Cc: Paul Clarke
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lore.kernel.org/lkml/20200719181320.785305-18-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • So far compute_single function relies on the fact, that there's only
    single metric defined within evlist in all tests. In following patch we
    will add test for metric group, so we need to be able to compute metric
    by given name.

    Adding the name argument to compute_single and iterating evlist and
    evsel's expression to find the given metric.

    Signed-off-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: Ian Rogers
    Cc: John Garry
    Cc: Kajol Jain
    Cc: Michael Petlan
    Cc: Namhyung Kim
    Cc: Paul Clarke
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lore.kernel.org/lkml/20200719181320.785305-17-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • Keeping the stack of nested metrics via 'struct expr_id' objects
    and checking if we are in recursion via already processed metric.

    The stack is implemented as static array within the struct egroup
    with 100 entries, which should be enough nesting depth for any
    metric we have or plan to have at the moment.

    Adding test that simulates the recursion and checks we can
    detect it.

    Committer notes:

    Bumped RECURSION_ID_MAX to 1000 as per Jiri's reply to Paul Clark on the
    patch series e-mail discussion.

    Fixed these:

    tests/parse-metric.c:308:7: error: missing field 'val' initializer [-Werror,-Wmissing-field-initializers]
    { 0 },
    ^

    util/metricgroup.c:924:28: error: missing field 'parent' initializer [-Werror,-Wmissing-field-initializers]
    struct expr_ids ids = { 0 };
    ^
    util/metricgroup.c:924:26: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
    struct expr_ids ids = { 0 };
    ^
    {}
    util/metricgroup.c:924:26: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
    struct expr_ids ids = { 0 };
    ^
    {}
    util/metricgroup.c:924:28: error: missing field 'cnt' initializer [-Werror,-Wmissing-field-initializers]
    struct expr_ids ids = { 0 };
    ^

    Signed-off-by: Jiri Olsa
    Reviewed-by: Kajol Jain
    Acked-by: Ian Rogers
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: John Garry
    Cc: Michael Petlan
    Cc: Namhyung Kim
    Cc: Paul Clarke
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lore.kernel.org/lkml/20200719181320.785305-16-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • Adding test that compute DCache_L2 metrics with other related metrics in it.

    Committer notes:

    Fixed up this:

    tests/parse-metric.c:285:7: error: missing field 'val' initializer [-Werror,-Wmissing-field-initializers]
    { 0 },
    ^

    Signed-off-by: Jiri Olsa
    Reviewed-by: Kajol Jain
    Acked-by: Ian Rogers
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: John Garry
    Cc: Michael Petlan
    Cc: Namhyung Kim
    Cc: Paul Clarke
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lore.kernel.org/lkml/20200719181320.785305-15-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • Adding test that compute metric with other metrics in it.

    cache_miss_cycles = metric:dcache_miss_cpi + metric:icache_miss_cycles

    Committer notes:

    Fixed up initializer to cope with:

    tests/parse-metric.c:242:7: error: missing field 'val' initializer [-Werror,-Wmissing-field-initializers]
    { 0 },

    Signed-off-by: Jiri Olsa
    Reviewed-by: Kajol Jain
    Acked-by: Ian Rogers
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: John Garry
    Cc: Michael Petlan
    Cc: Namhyung Kim
    Cc: Paul Clarke
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lore.kernel.org/lkml/20200719181320.785305-14-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • Test that a command line option doesn't override the period set on a
    libpfm4 event.

    Without libpfm4 test passes as unsupported.

    Signed-off-by: Ian Rogers
    Cc: Adrian Hunter
    Cc: Alexander Shishkin
    Cc: Alexei Starovoitov
    Cc: Andi Kleen
    Cc: Andrii Nakryiko
    Cc: Athira Jajeev
    Cc: Daniel Borkmann
    Cc: Jiri Olsa
    Cc: John Fastabend
    Cc: KP Singh
    Cc: Mark Rutland
    Cc: Martin KaFai Lau
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Song Liu
    Cc: Stephane Eranian
    Cc: Yonghong Song
    Cc: bpf@vger.kernel.org
    Cc: netdev@vger.kernel.org
    Link: http://lore.kernel.org/lkml/20200728085734.609930-4-irogers@google.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Ian Rogers
     
  • Jin Yao reported issue with possible conflict between raw events and
    term values in pmu event syntax.

    Currently following syntax is resolved as raw event with 0xead value:

    uncore_imc_free_running/read/

    instead of using 'read' term from uncore_imc_free_running pmu, because
    'read' is correct raw event syntax with 0xead value.

    To solve this issue we do following:

    - check existing terms during rXXXX syntax processing
    and make them priority in case of conflict

    - allow pmu/r0x1234/ syntax to be able to specify conflicting
    raw event (implemented in previous patch)

    Also add automated tests for this and perf_pmu__parse_cleanup call to
    parse_events_terms, so the test gets properly cleaned up.

    Fixes: 3a6c51e4d66c ("perf parser: Add support to specify rXXX event with pmu")
    Reported-by: Jin Yao
    Signed-off-by: Jiri Olsa
    Tested-by: Jin Yao
    Acked-by: Ian Rogers
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: Michael Petlan
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Thomas Richter
    Link: http://lore.kernel.org/lkml/20200726075244.1191481-2-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • Add support to specify raw event with 'r0' syntax within pmu term
    syntax like:

    -e cpu/r0xdead/

    It will be used to specify raw events in cases where they conflict with
    real pmu terms, like 'read', which is valid raw event syntax, but also a
    possible pmu term name as reported by Jin Yao.

    Reported-by: Jin Yao
    Signed-off-by: Jiri Olsa
    Acked-by: Ian Rogers
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: Michael Petlan
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Thomas Richter
    Link: http://lore.kernel.org/lkml/20200725121959.1181869-1-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     

21 Jul, 2020

2 commits

  • Store flags per struct pollfd *entries object in a bitmap of int size.

    Implement fdarray_flag__nonfilterable flag to skip object from counting
    by fdarray__filter().

    Fixed fdarray test issue reported by kernel test robot.

    Reported-by: kernel test robot
    Signed-off-by: Alexey Budankov
    Acked-by: Jiri Olsa
    Acked-by: Namhyung Kim
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: Peter Zijlstra
    Link: http://lore.kernel.org/lkml/6b7d43ff-0801-d5dd-4e90-fcd86b17c1c8@linux.intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Alexey Budankov
     
  • Avoid moving of fds by fdarray__filter() so fds indices returned by
    fdarray__add() can be used for access and processing of objects at
    struct pollfd *entries.

    Signed-off-by: Alexey Budankov
    Acked-by: Jiri Olsa
    Acked-by: Namhyung Kim
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: Peter Zijlstra
    Link: http://lore.kernel.org/lkml/676844f8-55d3-c628-23db-aa163a81519e@linux.intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Alexey Budankov
     

17 Jul, 2020

1 commit

  • Add 'struct expr_id_data' to keep an expr value instead of just a simple
    double pointer, so we can store more data for ID in the following
    changes.

    Signed-off-by: Jiri Olsa
    Acked-by: Ian Rogers
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: John Garry
    Cc: Kajol Jain
    Cc: Michael Petlan
    Cc: Namhyung Kim
    Cc: Paul Clarke
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lore.kernel.org/lkml/20200712132634.138901-3-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa