14 Dec, 2020

1 commit


17 Nov, 2020

1 commit

  • This fix is for a failure that occurred in the DWARF unwind perf test.

    Stack unwinders may probe memory when looking for frames.

    Memory sanitizer will poison and track uninitialized memory on the
    stack, and on the heap if the value is copied to the heap.

    This can lead to false memory sanitizer failures for the use of an
    uninitialized value.

    Avoid this problem by removing the poison on the copied stack.

    The full msan failure with track origins looks like:

    ==2168==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x559ceb10755b in handle_cfi elfutils/libdwfl/frame_unwind.c:648:8
    #1 0x559ceb105448 in __libdwfl_frame_unwind elfutils/libdwfl/frame_unwind.c:741:4
    #2 0x559ceb0ece90 in dwfl_thread_getframes elfutils/libdwfl/dwfl_frame.c:435:7
    #3 0x559ceb0ec6b7 in get_one_thread_frames_cb elfutils/libdwfl/dwfl_frame.c:379:10
    #4 0x559ceb0ec6b7 in get_one_thread_cb elfutils/libdwfl/dwfl_frame.c:308:17
    #5 0x559ceb0ec6b7 in dwfl_getthreads elfutils/libdwfl/dwfl_frame.c:283:17
    #6 0x559ceb0ec6b7 in getthread elfutils/libdwfl/dwfl_frame.c:354:14
    #7 0x559ceb0ec6b7 in dwfl_getthread_frames elfutils/libdwfl/dwfl_frame.c:388:10
    #8 0x559ceaff6ae6 in unwind__get_entries tools/perf/util/unwind-libdw.c:236:8
    #9 0x559ceabc9dbc in test_dwarf_unwind__thread tools/perf/tests/dwarf-unwind.c:111:8
    #10 0x559ceabca5cf in test_dwarf_unwind__compare tools/perf/tests/dwarf-unwind.c:138:26
    #11 0x7f812a6865b0 in bsearch (libc.so.6+0x4e5b0)
    #12 0x559ceabca871 in test_dwarf_unwind__krava_3 tools/perf/tests/dwarf-unwind.c:162:2
    #13 0x559ceabca926 in test_dwarf_unwind__krava_2 tools/perf/tests/dwarf-unwind.c:169:9
    #14 0x559ceabca946 in test_dwarf_unwind__krava_1 tools/perf/tests/dwarf-unwind.c:174:9
    #15 0x559ceabcae12 in test__dwarf_unwind tools/perf/tests/dwarf-unwind.c:211:8
    #16 0x559ceabbc4ab in run_test tools/perf/tests/builtin-test.c:418:9
    #17 0x559ceabbc4ab in test_and_print tools/perf/tests/builtin-test.c:448:9
    #18 0x559ceabbac70 in __cmd_test tools/perf/tests/builtin-test.c:669:4
    #19 0x559ceabbac70 in cmd_test tools/perf/tests/builtin-test.c:815:9
    #20 0x559cea960e30 in run_builtin tools/perf/perf.c:313:11
    #21 0x559cea95fbce in handle_internal_command tools/perf/perf.c:365:8
    #22 0x559cea95fbce in run_argv tools/perf/perf.c:409:2
    #23 0x559cea95fbce in main tools/perf/perf.c:539:3

    Uninitialized value was stored to memory at
    #0 0x559ceb106acf in __libdwfl_frame_reg_set elfutils/libdwfl/frame_unwind.c:77:22
    #1 0x559ceb106acf in handle_cfi elfutils/libdwfl/frame_unwind.c:627:13
    #2 0x559ceb105448 in __libdwfl_frame_unwind elfutils/libdwfl/frame_unwind.c:741:4
    #3 0x559ceb0ece90 in dwfl_thread_getframes elfutils/libdwfl/dwfl_frame.c:435:7
    #4 0x559ceb0ec6b7 in get_one_thread_frames_cb elfutils/libdwfl/dwfl_frame.c:379:10
    #5 0x559ceb0ec6b7 in get_one_thread_cb elfutils/libdwfl/dwfl_frame.c:308:17
    #6 0x559ceb0ec6b7 in dwfl_getthreads elfutils/libdwfl/dwfl_frame.c:283:17
    #7 0x559ceb0ec6b7 in getthread elfutils/libdwfl/dwfl_frame.c:354:14
    #8 0x559ceb0ec6b7 in dwfl_getthread_frames elfutils/libdwfl/dwfl_frame.c:388:10
    #9 0x559ceaff6ae6 in unwind__get_entries tools/perf/util/unwind-libdw.c:236:8
    #10 0x559ceabc9dbc in test_dwarf_unwind__thread tools/perf/tests/dwarf-unwind.c:111:8
    #11 0x559ceabca5cf in test_dwarf_unwind__compare tools/perf/tests/dwarf-unwind.c:138:26
    #12 0x7f812a6865b0 in bsearch (libc.so.6+0x4e5b0)
    #13 0x559ceabca871 in test_dwarf_unwind__krava_3 tools/perf/tests/dwarf-unwind.c:162:2
    #14 0x559ceabca926 in test_dwarf_unwind__krava_2 tools/perf/tests/dwarf-unwind.c:169:9
    #15 0x559ceabca946 in test_dwarf_unwind__krava_1 tools/perf/tests/dwarf-unwind.c:174:9
    #16 0x559ceabcae12 in test__dwarf_unwind tools/perf/tests/dwarf-unwind.c:211:8
    #17 0x559ceabbc4ab in run_test tools/perf/tests/builtin-test.c:418:9
    #18 0x559ceabbc4ab in test_and_print tools/perf/tests/builtin-test.c:448:9
    #19 0x559ceabbac70 in __cmd_test tools/perf/tests/builtin-test.c:669:4
    #20 0x559ceabbac70 in cmd_test tools/perf/tests/builtin-test.c:815:9
    #21 0x559cea960e30 in run_builtin tools/perf/perf.c:313:11
    #22 0x559cea95fbce in handle_internal_command tools/perf/perf.c:365:8
    #23 0x559cea95fbce in run_argv tools/perf/perf.c:409:2
    #24 0x559cea95fbce in main tools/perf/perf.c:539:3

    Uninitialized value was stored to memory at
    #0 0x559ceb106a54 in handle_cfi elfutils/libdwfl/frame_unwind.c:613:9
    #1 0x559ceb105448 in __libdwfl_frame_unwind elfutils/libdwfl/frame_unwind.c:741:4
    #2 0x559ceb0ece90 in dwfl_thread_getframes elfutils/libdwfl/dwfl_frame.c:435:7
    #3 0x559ceb0ec6b7 in get_one_thread_frames_cb elfutils/libdwfl/dwfl_frame.c:379:10
    #4 0x559ceb0ec6b7 in get_one_thread_cb elfutils/libdwfl/dwfl_frame.c:308:17
    #5 0x559ceb0ec6b7 in dwfl_getthreads elfutils/libdwfl/dwfl_frame.c:283:17
    #6 0x559ceb0ec6b7 in getthread elfutils/libdwfl/dwfl_frame.c:354:14
    #7 0x559ceb0ec6b7 in dwfl_getthread_frames elfutils/libdwfl/dwfl_frame.c:388:10
    #8 0x559ceaff6ae6 in unwind__get_entries tools/perf/util/unwind-libdw.c:236:8
    #9 0x559ceabc9dbc in test_dwarf_unwind__thread tools/perf/tests/dwarf-unwind.c:111:8
    #10 0x559ceabca5cf in test_dwarf_unwind__compare tools/perf/tests/dwarf-unwind.c:138:26
    #11 0x7f812a6865b0 in bsearch (libc.so.6+0x4e5b0)
    #12 0x559ceabca871 in test_dwarf_unwind__krava_3 tools/perf/tests/dwarf-unwind.c:162:2
    #13 0x559ceabca926 in test_dwarf_unwind__krava_2 tools/perf/tests/dwarf-unwind.c:169:9
    #14 0x559ceabca946 in test_dwarf_unwind__krava_1 tools/perf/tests/dwarf-unwind.c:174:9
    #15 0x559ceabcae12 in test__dwarf_unwind tools/perf/tests/dwarf-unwind.c:211:8
    #16 0x559ceabbc4ab in run_test tools/perf/tests/builtin-test.c:418:9
    #17 0x559ceabbc4ab in test_and_print tools/perf/tests/builtin-test.c:448:9
    #18 0x559ceabbac70 in __cmd_test tools/perf/tests/builtin-test.c:669:4
    #19 0x559ceabbac70 in cmd_test tools/perf/tests/builtin-test.c:815:9
    #20 0x559cea960e30 in run_builtin tools/perf/perf.c:313:11
    #21 0x559cea95fbce in handle_internal_command tools/perf/perf.c:365:8
    #22 0x559cea95fbce in run_argv tools/perf/perf.c:409:2
    #23 0x559cea95fbce in main tools/perf/perf.c:539:3

    Uninitialized value was stored to memory at
    #0 0x559ceaff8800 in memory_read tools/perf/util/unwind-libdw.c:156:10
    #1 0x559ceb10f053 in expr_eval elfutils/libdwfl/frame_unwind.c:501:13
    #2 0x559ceb1060cc in handle_cfi elfutils/libdwfl/frame_unwind.c:603:18
    #3 0x559ceb105448 in __libdwfl_frame_unwind elfutils/libdwfl/frame_unwind.c:741:4
    #4 0x559ceb0ece90 in dwfl_thread_getframes elfutils/libdwfl/dwfl_frame.c:435:7
    #5 0x559ceb0ec6b7 in get_one_thread_frames_cb elfutils/libdwfl/dwfl_frame.c:379:10
    #6 0x559ceb0ec6b7 in get_one_thread_cb elfutils/libdwfl/dwfl_frame.c:308:17
    #7 0x559ceb0ec6b7 in dwfl_getthreads elfutils/libdwfl/dwfl_frame.c:283:17
    #8 0x559ceb0ec6b7 in getthread elfutils/libdwfl/dwfl_frame.c:354:14
    #9 0x559ceb0ec6b7 in dwfl_getthread_frames elfutils/libdwfl/dwfl_frame.c:388:10
    #10 0x559ceaff6ae6 in unwind__get_entries tools/perf/util/unwind-libdw.c:236:8
    #11 0x559ceabc9dbc in test_dwarf_unwind__thread tools/perf/tests/dwarf-unwind.c:111:8
    #12 0x559ceabca5cf in test_dwarf_unwind__compare tools/perf/tests/dwarf-unwind.c:138:26
    #13 0x7f812a6865b0 in bsearch (libc.so.6+0x4e5b0)
    #14 0x559ceabca871 in test_dwarf_unwind__krava_3 tools/perf/tests/dwarf-unwind.c:162:2
    #15 0x559ceabca926 in test_dwarf_unwind__krava_2 tools/perf/tests/dwarf-unwind.c:169:9
    #16 0x559ceabca946 in test_dwarf_unwind__krava_1 tools/perf/tests/dwarf-unwind.c:174:9
    #17 0x559ceabcae12 in test__dwarf_unwind tools/perf/tests/dwarf-unwind.c:211:8
    #18 0x559ceabbc4ab in run_test tools/perf/tests/builtin-test.c:418:9
    #19 0x559ceabbc4ab in test_and_print tools/perf/tests/builtin-test.c:448:9
    #20 0x559ceabbac70 in __cmd_test tools/perf/tests/builtin-test.c:669:4
    #21 0x559ceabbac70 in cmd_test tools/perf/tests/builtin-test.c:815:9
    #22 0x559cea960e30 in run_builtin tools/perf/perf.c:313:11
    #23 0x559cea95fbce in handle_internal_command tools/perf/perf.c:365:8
    #24 0x559cea95fbce in run_argv tools/perf/perf.c:409:2
    #25 0x559cea95fbce in main tools/perf/perf.c:539:3

    Uninitialized value was stored to memory at
    #0 0x559cea9027d9 in __msan_memcpy llvm/llvm-project/compiler-rt/lib/msan/msan_interceptors.cpp:1558:3
    #1 0x559cea9d2185 in sample_ustack tools/perf/arch/x86/tests/dwarf-unwind.c:41:2
    #2 0x559cea9d202c in test__arch_unwind_sample tools/perf/arch/x86/tests/dwarf-unwind.c:72:9
    #3 0x559ceabc9cbd in test_dwarf_unwind__thread tools/perf/tests/dwarf-unwind.c:106:6
    #4 0x559ceabca5cf in test_dwarf_unwind__compare tools/perf/tests/dwarf-unwind.c:138:26
    #5 0x7f812a6865b0 in bsearch (libc.so.6+0x4e5b0)
    #6 0x559ceabca871 in test_dwarf_unwind__krava_3 tools/perf/tests/dwarf-unwind.c:162:2
    #7 0x559ceabca926 in test_dwarf_unwind__krava_2 tools/perf/tests/dwarf-unwind.c:169:9
    #8 0x559ceabca946 in test_dwarf_unwind__krava_1 tools/perf/tests/dwarf-unwind.c:174:9
    #9 0x559ceabcae12 in test__dwarf_unwind tools/perf/tests/dwarf-unwind.c:211:8
    #10 0x559ceabbc4ab in run_test tools/perf/tests/builtin-test.c:418:9
    #11 0x559ceabbc4ab in test_and_print tools/perf/tests/builtin-test.c:448:9
    #12 0x559ceabbac70 in __cmd_test tools/perf/tests/builtin-test.c:669:4
    #13 0x559ceabbac70 in cmd_test tools/perf/tests/builtin-test.c:815:9
    #14 0x559cea960e30 in run_builtin tools/perf/perf.c:313:11
    #15 0x559cea95fbce in handle_internal_command tools/perf/perf.c:365:8
    #16 0x559cea95fbce in run_argv tools/perf/perf.c:409:2
    #17 0x559cea95fbce in main tools/perf/perf.c:539:3

    Uninitialized value was created by an allocation of 'bf' in the stack frame of function 'perf_event__synthesize_mmap_events'
    #0 0x559ceafc5f60 in perf_event__synthesize_mmap_events tools/perf/util/synthetic-events.c:445

    SUMMARY: MemorySanitizer: use-of-uninitialized-value elfutils/libdwfl/frame_unwind.c:648:8 in handle_cfi
    Signed-off-by: Ian Rogers
    Cc: Alexander Shishkin
    Cc: clang-built-linux@googlegroups.com
    Cc: Jiri Olsa
    Cc: Mark Rutland
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Sandeep Dasgupta
    Cc: Stephane Eranian
    Link: http://lore.kernel.org/lkml/20201113182053.754625-1-irogers@google.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Ian Rogers
     

03 Nov, 2020

1 commit

  • To pick the changes from:

    ecb8ac8b1f146915 ("mm/madvise: introduce process_madvise() syscall: an external memory hinting API")

    That addresses these perf build warning:

    Warning: Kernel ABI header at 'tools/include/uapi/asm-generic/unistd.h' differs from latest version at 'include/uapi/asm-generic/unistd.h'
    diff -u tools/include/uapi/asm-generic/unistd.h include/uapi/asm-generic/unistd.h
    Warning: Kernel ABI header at 'tools/perf/arch/x86/entry/syscalls/syscall_64.tbl' differs from latest version at 'arch/x86/entry/syscalls/syscall_64.tbl'
    diff -u tools/perf/arch/x86/entry/syscalls/syscall_64.tbl arch/x86/entry/syscalls/syscall_64.tbl

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

    Arnaldo Carvalho de Melo
     

18 Oct, 2020

1 commit

  • …x/kernel/git/acme/linux

    Pull perf tools updates from Arnaldo Carvalho de Melo:

    - cgroup improvements for 'perf stat', allowing for compact
    specification of events and cgroups in the command line.

    - Support per thread topdown metrics in 'perf stat'.

    - Support sample-read topdown metric group in 'perf record'

    - Show start of latency in addition to its start in 'perf sched
    latency'.

    - Add min, max to 'perf script' futex-contention output, in addition to
    avg.

    - Allow usage of 'perf_event_attr->exclusive' attribute via the new
    ':e' event modifier.

    - Add 'snapshot' command to 'perf record --control', using it with
    Intel PT.

    - Support FIFO file names as alternative options to 'perf record
    --control'.

    - Introduce branch history "streams", to compare 'perf record' runs
    with 'perf diff' based on branch records and report hot streams.

    - Support PE executable symbol tables using libbfd, to profile, for
    instance, wine binaries.

    - Add filter support for option 'perf ftrace -F/--funcs'.

    - Allow configuring the 'disassembler_style' 'perf annotate' knob via
    'perf config'

    - Update CascadelakeX and SkylakeX JSON vendor events files.

    - Add support for parsing perchip/percore JSON vendor events.

    - Add power9 hv_24x7 core level metric events.

    - Add L2 prefetch, ITLB instruction fetch hits JSON events for AMD
    zen1.

    - Enable Family 19h users by matching Zen2 AMD vendor events.

    - Use debuginfod in 'perf probe' when required debug files not found
    locally.

    - Display negative tid in non-sample events in 'perf script'.

    - Make GTK2 support opt-in

    - Add build test with GTK+

    - Add missing -lzstd to the fast path feature detection

    - Add scripts to auto generate 'mmap', 'mremap' string<->id tables for
    use in 'perf trace'.

    - Show python test script in verbose mode.

    - Fix uncore metric expressions

    - Msan uninitialized use fixes.

    - Use condition variables in 'perf bench numa'

    - Autodetect python3 binary in systems without python2.

    - Support md5 build ids in addition to sha1.

    - Add build id 'perf test' regression test.

    - Fix printable strings in python3 scripts.

    - Fix off by ones in 'perf trace' in arches using libaudit.

    - Fix JSON event code for events referencing std arch events.

    - Introduce 'perf test' shell script for Arm CoreSight testing.

    - Add rdtsc() for Arm64 for used in the PERF_RECORD_TIME_CONV metadata
    event and in 'perf test tsc'.

    - 'perf c2c' improvements: Add "RMT Load Hit" metric, "Total Stores",
    fixes and documentation update.

    - Fix usage of reloc_sym in 'perf probe' when using both kallsyms and
    debuginfo files.

    - Do not print 'Metric Groups:' unnecessarily in 'perf list'

    - Refcounting fixes in the event parsing code.

    - Add expand cgroup event 'perf test' entry.

    - Fix out of bounds CPU map access when handling armv8_pmu events in
    'perf stat'.

    - Add build-id injection 'perf bench' benchmark.

    - Enter namespace when reading build-id in 'perf inject'.

    - Do not load map/dso when injecting build-id speeding up the 'perf
    inject' process.

    - Add --buildid-all option to avoid processing all samples, just the
    mmap metadata events.

    - Add feature test to check if libbfd has buildid support

    - Add 'perf test' entry for PE binary format support.

    - Fix typos in power8 PMU vendor events JSON files.

    - Hide libtraceevent non API functions.

    * tag 'perf-tools-for-v5.10-2020-10-15' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux: (113 commits)
    perf c2c: Update documentation for metrics reorganization
    perf c2c: Add metrics "RMT Load Hit"
    perf c2c: Correct LLC load hit metrics
    perf c2c: Change header for LLC local hit
    perf c2c: Use more explicit headers for HITM
    perf c2c: Change header from "LLC Load Hitm" to "Load Hitm"
    perf c2c: Organize metrics based on memory hierarchy
    perf c2c: Display "Total Stores" as a standalone metrics
    perf c2c: Display the total numbers continuously
    perf bench: Use condition variables in numa.
    perf jevents: Fix event code for events referencing std arch events
    perf diff: Support hot streams comparison
    perf streams: Report hot streams
    perf streams: Calculate the sum of total streams hits
    perf streams: Link stream pair
    perf streams: Compare two streams
    perf streams: Get the evsel_streams by evsel_idx
    perf streams: Introduce branch history "streams"
    perf intel-pt: Improve PT documentation slightly
    perf tools: Add support for exclusive groups/events
    ...

    Linus Torvalds
     

13 Oct, 2020

1 commit

  • Pull compat mount cleanups from Al Viro:
    "The last remnants of mount(2) compat buried by Christoph.

    Buried into NFS, that is.

    Generally I'm less enthusiastic about "let's use in_compat_syscall()
    deep in call chain" kind of approach than Christoph seems to be, but
    in this case it's warranted - that had been an NFS-specific wart,
    hopefully not to be repeated in any other filesystems (read: any new
    filesystem introducing non-text mount options will get NAKed even if
    it doesn't mess the layout up).

    IOW, not worth trying to grow an infrastructure that would avoid that
    use of in_compat_syscall()..."

    * 'compat.mount' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    fs: remove compat_sys_mount
    fs,nfs: lift compat nfs4 mount data handling into the nfs code
    nfs: simplify nfs4_parse_monolithic

    Linus Torvalds
     

03 Oct, 2020

3 commits


23 Sep, 2020

3 commits

  • compat_sys_mount is identical to the regular sys_mount now, so remove it
    and use the native version everywhere.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Al Viro

    Christoph Hellwig
     
  • The system register CNTVCT_EL0 can be used to retrieve the counter from
    user space. Add rdtsc() for Arm64.

    Signed-off-by: Leo Yan
    Cc: Adrian Hunter
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: Gustavo A. R. Silva
    Cc: Ian Rogers
    Cc: Jiri Olsa
    Cc: John Garry
    Cc: Kemeng Shi
    Cc: Mark Rutland
    Cc: Mathieu Poirier
    Cc: Namhyung Kim
    Cc: Nick Gasson
    Cc: Peter Zijlstra
    Cc: Remi Bernon
    Cc: Stephane Eranian
    Cc: Steve Maclean
    Cc: Will Deacon
    Cc: Zou Wei
    Cc: linux-arm-kernel@lists.infradead.org
    Link: http://lore.kernel.org/lkml/20200914115311.2201-3-leo.yan@linaro.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Leo Yan
     
  • Functions perf_read_tsc_conversion() and perf_event__synth_time_conv()
    should work as common functions rather than x86 specific, so move these
    two functions out from arch/x86 folder and place them into util/tsc.c.

    Since the function perf_event__synth_time_conv() will be linked in
    util/tsc.c, remove its weak version.

    Committer testing:

    Before/after:

    # perf test tsc
    70: Convert perf time to TSC : Ok
    #
    # perf test -v tsc
    70: Convert perf time to TSC :
    --- start ---
    test child forked, pid 8520
    mmap size 528384B
    1st event perf time 592110439891 tsc 2317172044331
    rdtsc time 592110441915 tsc 2317172052010
    2nd event perf time 592110442336 tsc 2317172053605
    test child finished with 0
    ---- end ----
    Convert perf time to TSC: Ok
    #

    Signed-off-by: Leo Yan
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Adrian Hunter
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: Gustavo A. R. Silva
    Cc: Ian Rogers
    Cc: Jiri Olsa
    Cc: John Garry
    Cc: Kemeng Shi
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: Mark Rutland
    Cc: Mathieu Poirier
    Cc: Namhyung Kim
    Cc: Nick Gasson
    Cc: Peter Zijlstra
    Cc: Remi Bernon
    Cc: Stephane Eranian
    Cc: Steve Maclean
    Cc: Will Deacon
    Cc: Zou Wei
    Link: http://lore.kernel.org/lkml/20200914115311.2201-2-leo.yan@linaro.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Leo Yan
     

18 Sep, 2020

2 commits

  • With the hardware TopDown metrics feature, sample-read feature should be
    supported for a topdown group, e.g., sample a non-topdown event and read
    a topdown metric group. But the current perf record code errors out.

    For a topdown metric group, the slots event must be the leader of the
    group, but the leader slots event doesn't support sampling.

    To support sample-read the topdown metric group, use the 2nd event of
    the group as the "leader" for the purposes of sampling.

    Only the platform with Topdown metic feature supports sample-read the
    topdown group. Add arch_topdown_sample_read() to indicate whether the
    topdown group supports sample-read.

    Signed-off-by: Kan Liang
    Acked-by: Jiri Olsa
    Acked-by: Namhyung Kim
    Cc: Andi Kleen
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lore.kernel.org/lkml/20200911144808.27603-3-kan.liang@linux.intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Kan Liang
     
  • The group.h/c only include TopDown group related functions. The name
    "group" is too generic and inaccurate. Use the name "topdown" to replace
    it.

    Move topdown related functions to a dedicated file, topdown.c.

    Signed-off-by: Kan Liang
    Acked-by: Jiri Olsa
    Acked-by: Namhyung Kim
    Cc: Andi Kleen
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lore.kernel.org/lkml/20200911144808.27603-2-kan.liang@linux.intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Kan Liang
     

10 Sep, 2020

1 commit

  • This patch adds passing of pmu_event as a parameter in function
    'arch_get_runtimeparam' which can be used to get details like if the
    event is percore/perchip.

    Signed-off-by: Kajol Jain
    Acked-by: Ian Rogers
    Acked-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: Jin Yao
    Cc: John Garry
    Cc: Madhavan Srinivasan
    Cc: Mark Rutland
    Cc: Namhyung Kim
    Cc: Paul Clarke
    Cc: Peter Zijlstra
    Cc: Ravi Bangoria
    Link: http://lore.kernel.org/lkml/20200907064133.75090-5-kjain@linux.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Kajol Jain
     

05 Sep, 2020

1 commit

  • When we use the 'intel' disassembler style we get 'ret' instead of
    'retq', so add that as an alias.

    # perf annotate --disassembler-style=intel --stdio2 acpi_processor_ffh_cstate_enter > before

    Apply this patch and then:

    # perf annotate --disassembler-style=intel --stdio2 acpi_processor_ffh_cstate_enter > after
    # diff -u before after
    --- before 2020-09-04 14:10:47.768414634 -0300
    +++ after 2020-09-04 14:10:59.116681039 -0300
    @@ -33,7 +33,7 @@
    test al,0x8
    ↓ je 97
    and DWORD PTR gs:[rip+0x7e548509],0x7fffffff
    - 97: ret
    + 97: ← ret
    mov rax,QWORD PTR gs:0x17bc0
    lock or BYTE PTR [rax+0x2],0x20
    mov rax,QWORD PTR [rax]
    #

    Cc: Adrian Hunter
    Cc: Andi Kleen
    Cc: David Ahern
    Cc: Ian Rogers
    Cc: Jin Yao
    Cc: Jiri Olsa
    Cc: Martin Liška
    Cc: Matt P. Dziubinski
    Cc: Namhyung Kim
    Cc: Ravi Bangoria
    Cc: Thomas Richter
    Cc: Wang Nan
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

15 Aug, 2020

1 commit

  • Since commit 61a47c1ad3a4dc ("sysctl: Remove the sysctl system call"),
    sys_sysctl is actually unavailable: any input can only return an error.

    We have been warning about people using the sysctl system call for years
    and believe there are no more users. Even if there are users of this
    interface if they have not complained or fixed their code by now they
    probably are not going to, so there is no point in warning them any
    longer.

    So completely remove sys_sysctl on all architectures.

    [nixiaoming@huawei.com: s390: fix build error for sys_call_table_emu]
    Link: http://lkml.kernel.org/r/20200618141426.16884-1-nixiaoming@huawei.com

    Signed-off-by: Xiaoming Ni
    Signed-off-by: Andrew Morton
    Acked-by: Will Deacon [arm/arm64]
    Acked-by: "Eric W. Biederman"
    Cc: Aleksa Sarai
    Cc: Alexander Shishkin
    Cc: Al Viro
    Cc: Andi Kleen
    Cc: Andrew Morton
    Cc: Andy Lutomirski
    Cc: Arnaldo Carvalho de Melo
    Cc: Arnd Bergmann
    Cc: Benjamin Herrenschmidt
    Cc: Bin Meng
    Cc: Borislav Petkov
    Cc: Brian Gerst
    Cc: Catalin Marinas
    Cc: chenzefeng
    Cc: Christian Borntraeger
    Cc: Christian Brauner
    Cc: Chris Zankel
    Cc: David Howells
    Cc: David S. Miller
    Cc: Diego Elio Pettenò
    Cc: Dmitry Vyukov
    Cc: Dominik Brodowski
    Cc: Fenghua Yu
    Cc: Geert Uytterhoeven
    Cc: Heiko Carstens
    Cc: Helge Deller
    Cc: "H. Peter Anvin"
    Cc: Ingo Molnar
    Cc: Iurii Zaikin
    Cc: Ivan Kokshaysky
    Cc: James Bottomley
    Cc: Jens Axboe
    Cc: Jiri Olsa
    Cc: Kars de Jong
    Cc: Kees Cook
    Cc: Krzysztof Kozlowski
    Cc: Luis Chamberlain
    Cc: Marco Elver
    Cc: Mark Rutland
    Cc: Martin K. Petersen
    Cc: Masahiro Yamada
    Cc: Matt Turner
    Cc: Max Filippov
    Cc: Michael Ellerman
    Cc: Michal Simek
    Cc: Miklos Szeredi
    Cc: Minchan Kim
    Cc: Namhyung Kim
    Cc: Naveen N. Rao
    Cc: Nick Piggin
    Cc: Oleg Nesterov
    Cc: Olof Johansson
    Cc: Paul Burton
    Cc: "Paul E. McKenney"
    Cc: Paul Mackerras
    Cc: Peter Zijlstra (Intel)
    Cc: Randy Dunlap
    Cc: Ravi Bangoria
    Cc: Richard Henderson
    Cc: Rich Felker
    Cc: Russell King
    Cc: Sami Tolvanen
    Cc: Sargun Dhillon
    Cc: Stephen Rothwell
    Cc: Sudeep Holla
    Cc: Sven Schnelle
    Cc: Thiago Jung Bauermann
    Cc: Thomas Bogendoerfer
    Cc: Thomas Gleixner
    Cc: Tony Luck
    Cc: Vasily Gorbik
    Cc: Vlastimil Babka
    Cc: Yoshinori Sato
    Cc: Zhou Yanjie
    Link: http://lkml.kernel.org/r/20200616030734.87257-1-nixiaoming@huawei.com
    Signed-off-by: Linus Torvalds

    Xiaoming Ni
     

11 Aug, 2020

1 commit

  • Pull perf tools updates from Arnaldo Carvalho de Melo:
    "New features:

    - Introduce controlling how 'perf stat' and 'perf record' works via a
    control file descriptor, allowing starting with events configured
    but disabled until commands are received via the control file
    descriptor. This allows, for instance for tools such as Intel VTune
    to make further use of perf as its Linux platform driver.

    - Improve 'perf record' to to register in a perf.data file header the
    clockid used to help later correlate things like syslog files and
    perf events recorded.

    - Add basic syscall and find_next_bit benchmarks to 'perf bench'.

    - Allow using computed metrics in calculating other metrics. For
    instance:

    {
    .metric_expr = "l2_rqsts.demand_data_rd_hit + l2_rqsts.pf_hit + l2_rqsts.rfo_hit",
    .metric_name = "DCache_L2_All_Hits",
    },
    {
    .metric_expr = "max(l2_rqsts.all_demand_data_rd - l2_rqsts.demand_data_rd_hit, 0) + l2_rqsts.pf_miss + l2_rqsts.rfo_miss",
    .metric_name = "DCache_L2_All_Miss",
    },
    {
    .metric_expr = "dcache_l2_all_hits + dcache_l2_all_miss",
    .metric_name = "DCache_L2_All",
    }

    - Add suport for 'd_ratio', '>' and ' enumerators to be 64 bits
    perf data: Add support to store time of day in CTF data conversion
    perf tools: Move clockid_res_ns under clock struct
    perf header: Store clock references for -k/--clockid option
    perf tools: Add clockid_name function
    perf clockid: Move parse_clockid() to new clockid object
    tools lib traceevent: Handle possible strdup() error in tep_add_plugin_path() API
    libtraceevent: Fixed description of tep_add_plugin_path() API
    libtraceevent: Fixed type in PRINT_FMT_STING
    libtraceevent: Fixed broken indentation in parse_ip4_print_args()
    libtraceevent: Improve error handling of tep_plugin_add_option() API
    ...

    Linus Torvalds
     

08 Aug, 2020

1 commit

  • Pull powerpc updates from Michael Ellerman:

    - Add support for (optionally) using queued spinlocks & rwlocks.

    - Support for a new faster system call ABI using the scv instruction on
    Power9 or later.

    - Drop support for the PROT_SAO mmap/mprotect flag as it will be
    unsupported on Power10 and future processors, leaving us with no way
    to implement the functionality it requests. This risks breaking
    userspace, though we believe it is unused in practice.

    - A bug fix for, and then the removal of, our custom stack expansion
    checking. We now allow stack expansion up to the rlimit, like other
    architectures.

    - Remove the remnants of our (previously disabled) topology update
    code, which tried to react to NUMA layout changes on virtualised
    systems, but was prone to crashes and other problems.

    - Add PMU support for Power10 CPUs.

    - A change to our signal trampoline so that we don't unbalance the link
    stack (branch return predictor) in the signal delivery path.

    - Lots of other cleanups, refactorings, smaller features and so on as
    usual.

    Thanks to: Abhishek Goel, Alastair D'Silva, Alexander A. Klimov, Alexey
    Kardashevskiy, Alistair Popple, Andrew Donnellan, Aneesh Kumar K.V, Anju
    T Sudhakar, Anton Blanchard, Arnd Bergmann, Athira Rajeev, Balamuruhan
    S, Bharata B Rao, Bill Wendling, Bin Meng, Cédric Le Goater, Chris
    Packham, Christophe Leroy, Christoph Hellwig, Daniel Axtens, Dan
    Williams, David Lamparter, Desnes A. Nunes do Rosario, Erhard F., Finn
    Thain, Frederic Barrat, Ganesh Goudar, Gautham R. Shenoy, Geoff Levand,
    Greg Kurz, Gustavo A. R. Silva, Hari Bathini, Harish, Imre Kaloz, Joel
    Stanley, Joe Perches, John Crispin, Jordan Niethe, Kajol Jain, Kamalesh
    Babulal, Kees Cook, Laurent Dufour, Leonardo Bras, Li RongQing, Madhavan
    Srinivasan, Mahesh Salgaonkar, Mark Cave-Ayland, Michal Suchanek, Milton
    Miller, Mimi Zohar, Murilo Opsfelder Araujo, Nathan Chancellor, Nathan
    Lynch, Naveen N. Rao, Nayna Jain, Nicholas Piggin, Oliver O'Halloran,
    Palmer Dabbelt, Pedro Miraglia Franco de Carvalho, Philippe Bergheaud,
    Pingfan Liu, Pratik Rajesh Sampat, Qian Cai, Qinglang Miao, Randy
    Dunlap, Ravi Bangoria, Sachin Sant, Sam Bobroff, Sandipan Das, Santosh
    Sivaraj, Satheesh Rajendran, Shirisha Ganta, Sourabh Jain, Srikar
    Dronamraju, Stan Johnson, Stephen Rothwell, Thadeu Lima de Souza
    Cascardo, Thiago Jung Bauermann, Tom Lane, Vaibhav Jain, Vladis Dronov,
    Wei Yongjun, Wen Xiong, YueHaibing.

    * tag 'powerpc-5.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (337 commits)
    selftests/powerpc: Fix pkey syscall redefinitions
    powerpc: Fix circular dependency between percpu.h and mmu.h
    powerpc/powernv/sriov: Fix use of uninitialised variable
    selftests/powerpc: Skip vmx/vsx/tar/etc tests on older CPUs
    powerpc/40x: Fix assembler warning about r0
    powerpc/papr_scm: Add support for fetching nvdimm 'fuel-gauge' metric
    powerpc/papr_scm: Fetch nvdimm performance stats from PHYP
    cpuidle: pseries: Fixup exit latency for CEDE(0)
    cpuidle: pseries: Add function to parse extended CEDE records
    cpuidle: pseries: Set the latency-hint before entering CEDE
    selftests/powerpc: Fix online CPU selection
    powerpc/perf: Consolidate perf_callchain_user_[64|32]()
    powerpc/pseries/hotplug-cpu: Remove double free in error path
    powerpc/pseries/mobility: Add pr_debug() for device tree changes
    powerpc/pseries/mobility: Set pr_fmt()
    powerpc/cacheinfo: Warn if cache object chain becomes unordered
    powerpc/cacheinfo: Improve diagnostics about malformed cache lists
    powerpc/cacheinfo: Use name@unit instead of full DT path in debug messages
    powerpc/cacheinfo: Set pr_fmt()
    powerpc: fix function annotations to avoid section mismatch warnings with gcc-10
    ...

    Linus Torvalds
     

07 Aug, 2020

2 commits

  • Added support for supported regs which are new in power10 ( MMCR3,
    SIER2, SIER3 ) to sample_reg_mask in the tool side to use with `-I?`
    option. Also added PVR check to send extended mask for power10 at kernel
    while capturing extended regs in each sample.

    Signed-off-by: Athira Jajeev
    Reviewed-by: Kajol Jain
    Reviewed-by: Ravi Bangoria
    Tested-by: Ravi Bangoria
    Cc: Jiri Olsa
    Cc: Madhavan Srinivasan
    Cc: Michael Ellerman
    Cc: Michael Neuling
    Cc: Ravi Bangoria
    Cc: linuxppc-dev@lists.ozlabs.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Athira Rajeev
     
  • Add extended regs to sample_reg_mask in the tool side to use with `-I?`
    option. Perf tools side uses extended mask to display the platform
    supported register names (with -I? option) to the user and also send
    this mask to the kernel to capture the extended registers in each
    sample. Hence decide the mask value based on the processor version.

    Currently definitions for `mfspr`, `SPRN_PVR` are part of
    `arch/powerpc/util/header.c`. Move this to a header file so that these
    definitions can be re-used in other source files as well.

    Signed-off-by: Anju T Sudhakar
    Reviewed-by: Kajol Jain
    Reviewed-by: Madhavan Srinivasan
    Reviewed--by: Ravi Bangoria
    Tested-by: Ravi Bangoria
    Cc: Jiri Olsa
    Cc: Michael Ellerman
    Cc: Michael Neuling
    Cc: Ravi Bangoria
    Cc: linuxppc-dev@lists.ozlabs.org
    [Decide extended mask at run time based on platform]
    Signed-off-by: Athira Jajeev
    Signed-off-by: Arnaldo Carvalho de Melo

    Anju T Sudhakar
     

06 Aug, 2020

2 commits

  • To pick the changes from:

    55db9c0e8534 ("net: remove compat_sys_{get,set}sockopt")
    9b4feb630e8e ("arch: wire-up close_range()")

    That automagically add the 'close_range' syscall to tools such as 'perf
    trace'.

    Before:

    # perf trace -e close_range
    event syntax error: 'close_range'
    \___ parser error
    Run 'perf list' for a list of valid events

    Usage: perf trace [] []
    or: perf trace [] -- []
    or: perf trace record [] []
    or: perf trace record [] -- []

    -e, --event event/syscall selector. use 'perf list' to list available events
    #

    After, system wide strace like tracing for this syscall:

    # perf trace -e close_range
    ^C#

    No calls, I need some test proggie :-)

    Cc: Adrian Hunter
    Cc: Christian Brauner
    Cc: Christoph Hellwig
    Cc: David S. Miller
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • To sync headers, for instance, in this case tools/perf was ahead of
    upstream till Linus merged tip/perf/core to get the
    PERF_RECORD_TEXT_POKE changes:

    Warning: Kernel ABI header at 'tools/include/uapi/linux/perf_event.h' differs from latest version at 'include/uapi/linux/perf_event.h'
    diff -u tools/include/uapi/linux/perf_event.h include/uapi/linux/perf_event.h

    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

02 Aug, 2020

1 commit


31 Jul, 2020

1 commit

  • When recording with cache-misses and arm_spe_x event, I found that it
    will just fail without showing any error info if i put cache-misses
    after 'arm_spe_x' event.

    [root@localhost 0620]# perf record -e cache-misses \
    -e arm_spe_0/ts_enable=1,pct_enable=1,pa_enable=1,load_filter=1,jitter=1,store_filter=1,min_latency=0/ sleep 1
    [ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 0.067 MB perf.data ]
    [root@localhost 0620]#
    [root@localhost 0620]# perf record -e arm_spe_0/ts_enable=1,pct_enable=1,pa_enable=1,load_filter=1,jitter=1,store_filter=1,min_latency=0/ \
    -e cache-misses sleep 1
    [root@localhost 0620]#

    The current code can only work if the only event to be traced is an
    'arm_spe_x', or if it is the last event to be specified. Otherwise the
    last event type will be checked against all the arm_spe_pmus[i]->types,
    none will match and an out of bound 'i' index will be used in
    arm_spe_recording_init().

    We don't support concurrent multiple arm_spe_x events currently, that
    is checked in arm_spe_recording_options(), and it will show the relevant
    info. So add the check and record of the first found 'arm_spe_pmu' to
    fix this issue here.

    Fixes: ffd3d18c20b8 ("perf tools: Add ARM Statistical Profiling Extensions (SPE) support")
    Signed-off-by: Wei Li
    Reviewed-by: Mathieu Poirier
    Tested-by-by: Leo Yan
    Cc: Alexander Shishkin
    Cc: Hanjun Guo
    Cc: Jiri Olsa
    Cc: Kim Phillips
    Cc: Mark Rutland
    Cc: Mike Leach
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Suzuki Poulouse
    Cc: linux-arm-kernel@lists.infradead.org
    Link: http://lore.kernel.org/lkml/20200724071111.35593-2-liwei391@huawei.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Wei Li
     

30 Jul, 2020

2 commits

  • - auxtrace_record__init() is called only once, so there is no point in
    using a static variable to cache the results of
    find_all_arm_spe_pmus(), make it local and free the results after use.

    - Another reason is, even though SPE is micro-architecture dependent,
    but so far it only supports "statistical-profiling-extension-v1" and
    we have no chance to use multiple SPE's PMU events in Perf command.

    So remove the useless check code to make it clear.

    Signed-off-by: Wei Li
    Reviewed-by: Mathieu Poirier
    Cc: Alexander Shishkin
    Cc: Hanjun Guo
    Cc: Jiri Olsa
    Cc: Kim Phillips
    Cc: Leo Yan
    Cc: Mark Rutland
    Cc: Mike Leach
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Suzuki Poulouse
    Cc: linux-arm-kernel@lists.infradead.org
    Link: http://lore.kernel.org/lkml/20200724071111.35593-3-liwei391@huawei.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Wei Li
     
  • When recording with cache-misses and arm_spe_x event, I found that it
    will just fail without showing any error info if i put cache-misses
    after 'arm_spe_x' event.

    [root@localhost 0620]# perf record -e cache-misses \
    -e arm_spe_0/ts_enable=1,pct_enable=1,pa_enable=1,load_filter=1,jitter=1,store_filter=1,min_latency=0/ sleep 1
    [ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 0.067 MB perf.data ]
    [root@localhost 0620]#
    [root@localhost 0620]# perf record -e arm_spe_0/ts_enable=1,pct_enable=1,pa_enable=1,load_filter=1,jitter=1,store_filter=1,min_latency=0/ \
    -e cache-misses sleep 1
    [root@localhost 0620]#

    The current code can only work if the only event to be traced is an
    'arm_spe_x', or if it is the last event to be specified. Otherwise the
    last event type will be checked against all the arm_spe_pmus[i]->types,
    none will match and an out of bound 'i' index will be used in
    arm_spe_recording_init().

    We don't support concurrent multiple arm_spe_x events currently, that
    is checked in arm_spe_recording_options(), and it will show the relevant
    info. So add the check and record of the first found 'arm_spe_pmu' to
    fix this issue here.

    Fixes: ffd3d18c20b8 ("perf tools: Add ARM Statistical Profiling Extensions (SPE) support")
    Signed-off-by: Wei Li
    Reviewed-by: Mathieu Poirier
    Tested-by-by: Leo Yan
    Cc: Alexander Shishkin
    Cc: Hanjun Guo
    Cc: Jiri Olsa
    Cc: Kim Phillips
    Cc: Mark Rutland
    Cc: Mike Leach
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Suzuki Poulouse
    Cc: linux-arm-kernel@lists.infradead.org
    Link: http://lore.kernel.org/lkml/20200724071111.35593-2-liwei391@huawei.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Wei Li
     

23 Jul, 2020

1 commit

  • On PAPR+ the hcall() on 0x1B0 is called H_DISABLE_AND_GET, but got
    defined as H_DISABLE_AND_GETC instead.

    This define was introduced with a typo in commit
    ("[PATCH] powerpc: Extends HCALL interface for InfiniBand usage"), and was
    later used without having the typo noticed.

    Signed-off-by: Leonardo Bras
    Acked-by: Paul Mackerras
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/20200707004812.190765-1-leobras.c@gmail.com

    Leonardo Bras
     

20 Jul, 2020

1 commit

  • Now that the ->compat_{get,set}sockopt proto_ops methods are gone
    there is no good reason left to keep the compat syscalls separate.

    This fixes the odd use of unsigned int for the compat_setsockopt
    optlen and the missing sock_use_custom_sol_socket.

    It would also easily allow running the eBPF hooks for the compat
    syscalls, but such a large change in behavior does not belong into
    a consolidation patch like this one.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: David S. Miller

    Christoph Hellwig
     

10 Jul, 2020

1 commit

  • Select text poke events when available and the kernel is being traced.
    Process text poke events to invalidate entries in Intel PT's instruction
    cache.

    Example:

    The example requires kernel config:
    CONFIG_PROC_SYSCTL=y
    CONFIG_SCHED_DEBUG=y
    CONFIG_SCHEDSTATS=y

    Before:

    # perf record -o perf.data.before --kcore -a -e intel_pt//k -m,64M &
    # cat /proc/sys/kernel/sched_schedstats
    0
    # echo 1 > /proc/sys/kernel/sched_schedstats
    # cat /proc/sys/kernel/sched_schedstats
    1
    # echo 0 > /proc/sys/kernel/sched_schedstats
    # cat /proc/sys/kernel/sched_schedstats
    0
    # kill %1
    [ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 3.341 MB perf.data.before ]
    [1]+ Terminated perf record -o perf.data.before --kcore -a -e intel_pt//k -m,64M
    # perf script -i perf.data.before --itrace=e >/dev/null
    Warning:
    474 instruction trace errors

    After:

    # perf record -o perf.data.after --kcore -a -e intel_pt//k -m,64M &
    # cat /proc/sys/kernel/sched_schedstats
    0
    # echo 1 > /proc/sys/kernel/sched_schedstats
    # cat /proc/sys/kernel/sched_schedstats
    1
    # echo 0 > /proc/sys/kernel/sched_schedstats
    # cat /proc/sys/kernel/sched_schedstats
    0
    # kill %1
    [ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 2.646 MB perf.data.after ]
    [1]+ Terminated perf record -o perf.data.after --kcore -a -e intel_pt//k -m,64M
    # perf script -i perf.data.after --itrace=e >/dev/null

    Example:

    The example requires kernel config:
    # CONFIG_FUNCTION_TRACER is not set

    Before:
    # perf record --kcore -m,64M -o t1 -a -e intel_pt//k &
    # perf probe __schedule
    Added new event:
    probe:__schedule (on __schedule)

    You can now use it in all perf tools, such as:

    perf record -e probe:__schedule -aR sleep 1

    # perf record -e probe:__schedule -aR sleep 1
    [ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 0.026 MB perf.data (68 samples) ]
    # perf probe -d probe:__schedule
    Removed event: probe:__schedule
    # kill %1
    [ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 41.268 MB t1 ]
    [1]+ Terminated perf record --kcore -m,64M -o t1 -a -e intel_pt//k
    # perf script -i t1 --itrace=e >/dev/null
    Warning:
    207 instruction trace errors

    After:
    # perf record --kcore -m,64M -o t1 -a -e intel_pt//k &
    # perf probe __schedule
    Added new event:
    probe:__schedule (on __schedule)

    You can now use it in all perf tools, such as:

    perf record -e probe:__schedule -aR sleep 1

    # perf record -e probe:__schedule -aR sleep 1
    [ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 0.028 MB perf.data (107 samples) ]
    # perf probe -d probe:__schedule
    Removed event: probe:__schedule
    # kill %1
    [ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 39.978 MB t1 ]
    [1]+ Terminated perf record --kcore -m,64M -o t1 -a -e intel_pt//k
    # perf script -i t1 --itrace=e >/dev/null
    # perf script -i t1 --no-itrace -D | grep 'POKE\|KSYMBOL'
    6 565303693547 0x291f18 [0x50]: PERF_RECORD_KSYMBOL addr ffffffffc027a000 len 4096 type 2 flags 0x0 name kprobe_insn_page
    6 565303697010 0x291f68 [0x40]: PERF_RECORD_TEXT_POKE addr 0xffffffffc027a000 old len 0 new len 6
    6 565303838278 0x291fa8 [0x50]: PERF_RECORD_KSYMBOL addr ffffffffc027c000 len 4096 type 2 flags 0x0 name kprobe_optinsn_page
    6 565303848286 0x291ff8 [0xa0]: PERF_RECORD_TEXT_POKE addr 0xffffffffc027c000 old len 0 new len 106
    6 565369336743 0x292af8 [0x40]: PERF_RECORD_TEXT_POKE addr 0xffffffff88ab8890 old len 5 new len 5
    7 566434327704 0x217c208 [0x40]: PERF_RECORD_TEXT_POKE addr 0xffffffff88ab8890 old len 5 new len 5
    6 566456313475 0x293198 [0xa0]: PERF_RECORD_TEXT_POKE addr 0xffffffffc027c000 old len 106 new len 0
    6 566456314935 0x293238 [0x40]: PERF_RECORD_TEXT_POKE addr 0xffffffffc027a000 old len 6 new len 0

    Example:

    The example requires kernel config:
    CONFIG_FUNCTION_TRACER=y

    Before:
    # perf record --kcore -m,64M -o t1 -a -e intel_pt//k &
    # perf probe __kmalloc
    Added new event:
    probe:__kmalloc (on __kmalloc)

    You can now use it in all perf tools, such as:

    perf record -e probe:__kmalloc -aR sleep 1

    # perf record -e probe:__kmalloc -aR sleep 1
    [ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 0.022 MB perf.data (6 samples) ]
    # perf probe -d probe:__kmalloc
    Removed event: probe:__kmalloc
    # kill %1
    [ perf record: Woken up 2 times to write data ]
    [ perf record: Captured and wrote 43.850 MB t1 ]
    [1]+ Terminated perf record --kcore -m,64M -o t1 -a -e intel_pt//k
    # perf script -i t1 --itrace=e >/dev/null
    Warning:
    8 instruction trace errors

    After:
    # perf record --kcore -m,64M -o t1 -a -e intel_pt//k &
    # perf probe __kmalloc
    Added new event:
    probe:__kmalloc (on __kmalloc)

    You can now use it in all perf tools, such as:

    perf record -e probe:__kmalloc -aR sleep 1

    # perf record -e probe:__kmalloc -aR sleep 1
    [ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 0.037 MB perf.data (206 samples) ]
    # perf probe -d probe:__kmalloc
    Removed event: probe:__kmalloc
    # kill %1
    [ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 41.442 MB t1 ]
    [1]+ Terminated perf record --kcore -m,64M -o t1 -a -e intel_pt//k
    # perf script -i t1 --itrace=e >/dev/null
    # perf script -i t1 --no-itrace -D | grep 'POKE\|KSYMBOL'
    5 312216133258 0x8bafe0 [0x50]: PERF_RECORD_KSYMBOL addr ffffffffc0360000 len 415 type 2 flags 0x0 name ftrace_trampoline
    5 312216133494 0x8bb030 [0x1d8]: PERF_RECORD_TEXT_POKE addr 0xffffffffc0360000 old len 0 new len 415
    5 312216229563 0x8bb208 [0x40]: PERF_RECORD_TEXT_POKE addr 0xffffffffac6016f5 old len 5 new len 5
    5 312216239063 0x8bb248 [0x40]: PERF_RECORD_TEXT_POKE addr 0xffffffffac601803 old len 5 new len 5
    5 312216727230 0x8bb288 [0x40]: PERF_RECORD_TEXT_POKE addr 0xffffffffabbea190 old len 5 new len 5
    5 312216739322 0x8bb2c8 [0x40]: PERF_RECORD_TEXT_POKE addr 0xffffffffac6016f5 old len 5 new len 5
    5 312216748321 0x8bb308 [0x40]: PERF_RECORD_TEXT_POKE addr 0xffffffffac601803 old len 5 new len 5
    7 313287163462 0x2817430 [0x40]: PERF_RECORD_TEXT_POKE addr 0xffffffffac6016f5 old len 5 new len 5
    7 313287174890 0x2817470 [0x40]: PERF_RECORD_TEXT_POKE addr 0xffffffffac601803 old len 5 new len 5
    7 313287818979 0x28174b0 [0x40]: PERF_RECORD_TEXT_POKE addr 0xffffffffabbea190 old len 5 new len 5
    7 313287829357 0x28174f0 [0x40]: PERF_RECORD_TEXT_POKE addr 0xffffffffac6016f5 old len 5 new len 5
    7 313287841246 0x2817530 [0x40]: PERF_RECORD_TEXT_POKE addr 0xffffffffac601803 old len 5 new len 5

    Signed-off-by: Adrian Hunter
    Cc: Alexander Shishkin
    Cc: Borislav Petkov
    Cc: H. Peter Anvin
    Cc: Jiri Olsa
    Cc: Leo Yan
    Cc: Mark Rutland
    Cc: Masami Hiramatsu
    Cc: Mathieu Poirier
    Cc: Peter Zijlstra
    Cc: Steven Rostedt (VMware)
    Cc: x86@kernel.org
    Link: http://lore.kernel.org/lkml/20200512121922.8997-14-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     

09 Jul, 2020

1 commit


06 Jul, 2020

1 commit

  • When recording PEBS-via-PT, the kernel will not accept the intel_pt
    event with register sampling e.g.

    # perf record --kcore -c 10000 -e '{intel_pt/branch=0/,branch-loads/aux-output/ppp}' -I -- ls -l
    Error:
    intel_pt/branch=0/: PMU Hardware doesn't support sampling/overflow-interrupts. Try 'perf stat'

    Fix by suppressing register sampling on the intel_pt evsel.

    Committer notes:

    Adrian informed that this is only available from Tremont onwards, so on
    older processors the error continues the same as before.

    Fixes: 9e64cefe4335b ("perf intel-pt: Process options for PEBS event synthesis")
    Signed-off-by: Adrian Hunter
    Cc: Jiri Olsa
    Cc: Luwei Kang
    Link: http://lore.kernel.org/lkml/20200630133935.11150-2-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     

23 Jun, 2020

1 commit

  • Adjust the handling of the session sink selection to allow no sink to be
    selected on the command line. This then forwards the sink selection to
    the CoreSight infrastructure which will attempt to select a sink based
    on the default sink select priorities.

    Signed-off-by: Mike Leach
    Tested-by: Leo Yan
    Cc: Mathieu Poirier
    Cc: Peter Zijlstra
    Cc: Suzuki Poulouse
    Cc: coresight@lists.linaro.org
    Cc: linux-arm-kernel@lists.infradead.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Mike Leach
     

09 Jun, 2020

1 commit

  • Update the copies of files affected by:

    c8ffd8bcdd28 ("vfs: add faccessat2 syscall")

    To address this perf build warning:

    Warning: Kernel ABI header at 'tools/include/uapi/linux/fcntl.h' differs from latest version at 'include/uapi/linux/fcntl.h'
    diff -u tools/include/uapi/linux/fcntl.h include/uapi/linux/fcntl.h
    Warning: Kernel ABI header at 'tools/include/uapi/asm-generic/unistd.h' differs from latest version at 'include/uapi/asm-generic/unistd.h'
    diff -u tools/include/uapi/asm-generic/unistd.h include/uapi/asm-generic/unistd.h
    Warning: Kernel ABI header at 'tools/perf/arch/x86/entry/syscalls/syscall_64.tbl' differs from latest version at 'arch/x86/entry/syscalls/syscall_64.tbl'
    diff -u tools/perf/arch/x86/entry/syscalls/syscall_64.tbl arch/x86/entry/syscalls/syscall_64.tbl

    Which results in 'perf trace' gaining support for the 'faccessat2'
    syscall, now one can use:

    # perf trace -e faccessat2

    And have system wide tracing of this syscall. And this also will include
    it;

    # perf trace -e faccess*

    Together with the other variants.

    How it affects building/usage (on an x86_64 system):

    $ cp /tmp/build/perf/arch/x86/include/generated/asm/syscalls_64.c /tmp/syscalls_64.c.before
    $
    [root@five ~]# perf trace -e faccessat2
    event syntax error: 'faccessat2'
    \___ parser error
    Run 'perf list' for a list of valid events

    Usage: perf trace [] []
    or: perf trace [] -- []
    or: perf trace record [] []
    or: perf trace record [] -- []

    -e, --event event/syscall selector. use 'perf list' to list available events
    [root@five ~]#
    $ cp arch/x86/entry/syscalls/syscall_64.tbl tools/perf/arch/x86/entry/syscalls/syscall_64.tbl
    $ git diff
    diff --git a/tools/perf/arch/x86/entry/syscalls/syscall_64.tbl b/tools/perf/arch/x86/entry/syscalls/syscall_64.tbl
    index 37b844f839bc..78847b32e137 100644
    --- a/tools/perf/arch/x86/entry/syscalls/syscall_64.tbl
    +++ b/tools/perf/arch/x86/entry/syscalls/syscall_64.tbl
    @@ -359,6 +359,7 @@
    435 common clone3 sys_clone3
    437 common openat2 sys_openat2
    438 common pidfd_getfd sys_pidfd_getfd
    +439 common faccessat2 sys_faccessat2

    #
    # x32-specific system call numbers start at 512 to avoid cache impact
    $

    $ make -C tools/perf O=/tmp/build/perf/ install-bin

    CC /tmp/build/perf/util/syscalltbl.o
    LD /tmp/build/perf/util/perf-in.o
    LD /tmp/build/perf/perf-in.o
    LINK /tmp/build/perf/perf

    [root@five ~]# perf trace -e faccessat2
    ^C[root@five ~]#

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

    Arnaldo Carvalho de Melo
     

01 Jun, 2020

2 commits

  • This is currently working due to extra include paths in the build.

    Before:

    $ cd tools/perf/arch/arm64/util
    $ ls -la ../../util/unwind-libdw.h
    ls: cannot access '../../util/unwind-libdw.h': No such file or directory

    After:

    $ ls -la ../../../util/unwind-libdw.h
    -rw-r----- 1 irogers irogers 553 Apr 17 14:31 ../../../util/unwind-libdw.h

    Signed-off-by: Ian Rogers
    Acked-by: Namhyung Kim
    Cc: Alexander Shishkin
    Cc: Jiri Olsa
    Cc: Mark Rutland
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lore.kernel.org/lkml/20200529225232.207532-1-irogers@google.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Ian Rogers
     
  • Avoid a false positive caused by assembly code in arch/x86.

    In tests, zero the perf_event to avoid uninitialized memory uses.

    Warnings were caught using clang with -fsanitize=memory.

    Signed-off-by: Ian Rogers
    Cc: Alexander Shishkin
    Cc: Alexei Starovoitov
    Cc: Jakub Kicinski
    Cc: Jiri Olsa
    Cc: Mark Rutland
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Quentin Monnet
    Cc: Stephane Eranian
    Cc: clang-built-linux@googlegroups.com
    Link: http://lore.kernel.org/lkml/20200530082015.39162-4-irogers@google.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Ian Rogers
     

28 May, 2020

5 commits

  • Stop the message displaying when user space is not being traced.

    Example:

    Prerequisites:

    sudo setcap "cap_sys_rawio,cap_sys_admin,cap_sys_ptrace,cap_syslog,cap_ipc_lock=ep" ~/bin/perf
    sudo chmod +r /proc/kcore

    Before:

    $ perf record --no-switch-events --kcore -a -e intel_pt//k -- sleep 0.001
    Warning:
    Intel Processor Trace decoding will not be possible except for kernel tracing!
    [ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 0.838 MB perf.data ]

    After:

    $ perf record --no-switch-events --kcore -a -e intel_pt//k -- sleep 0.001
    [ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 1.068 MB perf.data ]

    $ sudo chmod go-r /proc/kcore
    $ sudo setcap -r ~/bin/perf

    Signed-off-by: Adrian Hunter
    Cc: Andi Kleen
    Cc: Jiri Olsa
    Cc: Mathieu Poirier
    Link: http://lore.kernel.org/lkml/20200528120859.21604-2-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     
  • Context switch events are added automatically by Intel PT and Coresight.

    Make it possible to suppress them. That is useful for tracing the
    scheduler without the disturbance that the switch event processing
    creates.

    Example:

    Prerequisites:

    $ which perf
    ~/bin/perf
    $ sudo setcap "cap_sys_rawio,cap_sys_admin,cap_sys_ptrace,cap_syslog,cap_ipc_lock=ep" ~/bin/perf
    $ sudo chmod +r /proc/kcore

    Before:

    $ perf record --no-switch-events --kcore -a -e intel_pt//k -- sleep 0.001
    [ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 0.938 MB perf.data ]
    $ perf script -D | grep PERF_RECORD_SWITCH | wc -l
    572

    After:

    $ perf record --no-switch-events --kcore -a -e intel_pt//k -- sleep 0.001
    Warning:
    Intel Processor Trace decoding will not be possible except for kernel tracing!
    [ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 0.838 MB perf.data ]
    $ perf script -D | grep PERF_RECORD_SWITCH | wc -l
    0

    $ sudo chmod go-r /proc/kcore
    $ sudo setcap -r ~/bin/perf

    Signed-off-by: Adrian Hunter
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Andi Kleen
    Cc: Jiri Olsa
    Cc: Mathieu Poirier
    Link: http://lore.kernel.org/lkml/20200528120859.21604-1-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     
  • On a CPU like skylakex an uncore_iio_0 PMU may alias with
    uncore_iio_free_running_0. The latter PMU doesn't support fc_mask as a
    parameter and so pmu_config_term fails. Typically parse_events_add_pmu
    is called in a loop where if one alias succeeds errors are ignored,
    however, if multiple errors occur parse_events__handle_error will
    currently give a WARN_ONCE.

    This change removes the WARN_ONCE in parse_events__handle_error and
    makes it a pr_debug. It adds verbose messages to parse_events_add_pmu
    warning that non-fatal errors may occur, while giving details on the pmu
    and config terms for useful context. pmu_config_term is altered so the
    failing term and pmu are present in the case of the 'unknown term' error
    which makes spotting the free_running case more straightforward.

    Before:

    $ perf --debug verbose=3 stat -M llc_misses.pcie_read sleep 1
    Using CPUID GenuineIntel-6-55-4
    metric expr unc_iio_data_req_of_cpu.mem_read.part0 + unc_iio_data_req_of_cpu.mem_read.part1 + unc_iio_data_req_of_cpu.mem_read.part2 + unc_iio_data_req_of_cpu.mem_read.part3 for LLC_MISSES.PCIE_READ
    found event unc_iio_data_req_of_cpu.mem_read.part0
    found event unc_iio_data_req_of_cpu.mem_read.part1
    found event unc_iio_data_req_of_cpu.mem_read.part2
    found event unc_iio_data_req_of_cpu.mem_read.part3
    metric expr unc_iio_data_req_of_cpu.mem_read.part0 + unc_iio_data_req_of_cpu.mem_read.part1 + unc_iio_data_req_of_cpu.mem_read.part2 + unc_iio_data_req_of_cpu.mem_read.part3 for LLC_MISSES.PCIE_READ
    found event unc_iio_data_req_of_cpu.mem_read.part0
    found event unc_iio_data_req_of_cpu.mem_read.part1
    found event unc_iio_data_req_of_cpu.mem_read.part2
    found event unc_iio_data_req_of_cpu.mem_read.part3
    adding {unc_iio_data_req_of_cpu.mem_read.part0,unc_iio_data_req_of_cpu.mem_read.part1,unc_iio_data_req_of_cpu.mem_read.part2,unc_iio_data_req_of_cpu.mem_read.part3}:W,{unc_iio_data_req_of_cpu.mem_read.part0,unc_iio_data_req_of_cpu.mem_read.part1,unc_iio_data_req_of_cpu.mem_read.part2,unc_iio_data_req_of_cpu.mem_read.part3}:W
    intel_pt default config: tsc,mtc,mtc_period=3,psb_period=3,pt,branch
    WARNING: multiple event parsing errors
    ...
    Invalid event/parameter 'fc_mask'
    ...

    After:

    $ perf --debug verbose=3 stat -M llc_misses.pcie_read sleep 1
    Using CPUID GenuineIntel-6-55-4
    metric expr unc_iio_data_req_of_cpu.mem_read.part0 + unc_iio_data_req_of_cpu.mem_read.part1 + unc_iio_data_req_of_cpu.mem_read.part2 + unc_iio_data_req_of_cpu.mem_read.part3 for LLC_MISSES.PCIE_READ
    found event unc_iio_data_req_of_cpu.mem_read.part0
    found event unc_iio_data_req_of_cpu.mem_read.part1
    found event unc_iio_data_req_of_cpu.mem_read.part2
    found event unc_iio_data_req_of_cpu.mem_read.part3
    metric expr unc_iio_data_req_of_cpu.mem_read.part0 + unc_iio_data_req_of_cpu.mem_read.part1 + unc_iio_data_req_of_cpu.mem_read.part2 + unc_iio_data_req_of_cpu.mem_read.part3 for LLC_MISSES.PCIE_READ
    found event unc_iio_data_req_of_cpu.mem_read.part0
    found event unc_iio_data_req_of_cpu.mem_read.part1
    found event unc_iio_data_req_of_cpu.mem_read.part2
    found event unc_iio_data_req_of_cpu.mem_read.part3
    adding {unc_iio_data_req_of_cpu.mem_read.part0,unc_iio_data_req_of_cpu.mem_read.part1,unc_iio_data_req_of_cpu.mem_read.part2,unc_iio_data_req_of_cpu.mem_read.part3}:W,{unc_iio_data_req_of_cpu.mem_read.part0,unc_iio_data_req_of_cpu.mem_read.part1,unc_iio_data_req_of_cpu.mem_read.part2,unc_iio_data_req_of_cpu.mem_read.part3}:W
    intel_pt default config: tsc,mtc,mtc_period=3,psb_period=3,pt,branch
    Attempting to add event pmu 'uncore_iio_free_running_5' with 'unc_iio_data_req_of_cpu.mem_read.part0,' that may result in non-fatal errors
    After aliases, add event pmu 'uncore_iio_free_running_5' with 'fc_mask,ch_mask,umask,event,' that may result in non-fatal errors
    Attempting to add event pmu 'uncore_iio_free_running_3' with 'unc_iio_data_req_of_cpu.mem_read.part0,' that may result in non-fatal errors
    After aliases, add event pmu 'uncore_iio_free_running_3' with 'fc_mask,ch_mask,umask,event,' that may result in non-fatal errors
    Attempting to add event pmu 'uncore_iio_free_running_1' with 'unc_iio_data_req_of_cpu.mem_read.part0,' that may result in non-fatal errors
    After aliases, add event pmu 'uncore_iio_free_running_1' with 'fc_mask,ch_mask,umask,event,' that may result in non-fatal errors
    Multiple errors dropping message: unknown term 'fc_mask' for pmu 'uncore_iio_free_running_3' (valid terms: event,umask,config,config1,config2,name,period,percore)
    ...

    So before you see a 'WARNING: multiple event parsing errors' and
    'Invalid event/parameter'. After you see 'Attempting... that may result
    in non-fatal errors' then 'Multiple errors...' with details that
    'fc_mask' wasn't known to a free running counter. While not completely
    clean, this makes it clearer that an error hasn't really occurred.

    v2. addresses review feedback from Jiri Olsa .

    Signed-off-by: Ian Rogers
    Reviewed-by: Andi Kleen
    Acked-by: Jiri Olsa
    Cc: Adrian Hunter
    Cc: Alexander Shishkin
    Cc: Jin Yao
    Cc: John Garry
    Cc: Kan Liang
    Cc: Leo Yan
    Cc: Mark Rutland
    Cc: Mathieu Poirier
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Thomas Gleixner
    Link: http://lore.kernel.org/lkml/20200513220635.54700-1-irogers@google.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Ian Rogers
     
  • Commit 7eec00a74720 ("perf symbols: Consolidate symbol fixup issue")
    removed powerpc specific sym-handling.c file from Build. This wasn't
    caught by build CI because all functions in this file are declared
    as __weak in common code. Fix it.

    Fixes: 7eec00a74720 ("perf symbols: Consolidate symbol fixup issue")
    Reported-by: Sandipan Das
    Signed-off-by: Ravi Bangoria
    Reviewed-by: Leo Yan
    Reviewed-by: Naveen N. Rao
    Acked-by: Sandipan Das
    Cc: Jiri Olsa
    Link: http://lore.kernel.org/lkml/20200509112113.174745-1-ravi.bangoria@linux.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Ravi Bangoria
     
  • As it is a 'struct evsel' method, not part of tools/lib/perf/, aka
    libperf, to whom the perf_ prefix belongs.

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

    Arnaldo Carvalho de Melo