1. 04 Jan, 2023 2 commits
    • Namhyung Kim's avatar
      perf stat: Fix handling of unsupported cgroup events when using BPF counters · 2d656b0f
      Namhyung Kim authored
      When --for-each-cgroup option is used, it fails when any of events is
      not supported and exits immediately.  This is not how 'perf stat'
      handles unsupported events.
      
      Let's ignore the failure and proceed with others so that the output is
      similar to when BPF counters are not used:
      
      Before:
      
        $ sudo ./perf stat -a --bpf-counters -e L1-icache-loads,L1-dcache-loads --for-each-cgroup system.slice,user.slice sleep 1
        Failed to open first cgroup events
        $
      
      After it shows output similat to when --bpf-counters isn't specified:
      
        $ sudo ./perf stat -a --bpf-counters -e L1-icache-loads,L1-dcache-loads --for-each-cgroup system.slice,user.slice sleep 1
      
         Performance counter stats for 'system wide':
      
           <not supported>      L1-icache-loads                  system.slice
                29,892,418      L1-dcache-loads                  system.slice
           <not supported>      L1-icache-loads                  user.slice
                52,497,220      L1-dcache-loads                  user.slice
        $
      
      Fixes: 944138f0 ("perf stat: Enable BPF counter with --for-each-cgroup")
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Song Liu <songliubraving@fb.com>
      Link: https://lore.kernel.org/r/20230104064402.1551516-4-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      2d656b0f
    • Thomas Richter's avatar
      perf test record_probe_libc_inet_pton: Fix test on s/390 where... · fb710dde
      Thomas Richter authored
      perf test record_probe_libc_inet_pton: Fix test on s/390 where 'text_to_binary_address' now appears on the backtrace
      
      perf test '84: probe libc's inet_pton & backtrace it with ping' fails on
      s390. Debugging revealed a changed stack trace for the ping command
      using probes:
      
        ping 35729 [002]  8006.365063: probe_libc:inet_pton: (3ff9603e7c0)
                          13e7c0 __GI___inet_pton+0x0 (/usr/lib64/libc.so.6)
                  --->    104371 text_to_binary_address+0xef1 (inlined)
                          104371 gaih_inet+0xef1 (inlined)
                          104371 __GI_getaddrinfo+0xef1 (inlined)
                            5d4b main+0x139b (/usr/bin/ping)
      
      The line "---> text_to_binary_address ..." is new. It was introduced
      with glibc version 2.36.7.2 released with Fedora 37 for s390.
      
      Output before
      
        # perf test inet_pton
        84: probe libc's inet_pton & backtrace it with ping   : FAILED!
        #
      
      Output after:
      
        # perf test inet_pton
        84: probe libc's inet_pton & backtrace it with ping   : Ok
        #
      Signed-off-by: default avatarThomas Richter <tmricht@linux.ibm.com>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Sven Schnelle <svens@linux.ibm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Link: https://lore.kernel.org/r/20221228145704.2702487-1-tmricht@linux.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      fb710dde
  2. 03 Jan, 2023 3 commits
    • Thomas Richter's avatar
      perf lock contention: Fix core dump related to not finding the "__sched_text_end" symbol on s/390 · d8d85ce8
      Thomas Richter authored
      The test case perf lock contention dumps core on s390. Run the following
      commands:
      
        # ./perf lock record -- ./perf bench sched messaging
        # Running 'sched/messaging' benchmark:
        # 20 sender and receiver processes per group
        # 10 groups == 400 processes run
      
            Total time: 2.799 [sec]
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.073 MB perf.data (100 samples) ]
        #
        # ./perf lock contention
        Segmentation fault (core dumped)
        #
      
      The function call stack is lengthy, here are the top 5 functions:
      
        # gdb ./perf core.24048
        GNU gdb (GDB) Fedora Linux 12.1-6.fc37
        Core was generated by `./perf lock contention'.
        Program terminated with signal SIGSEGV, Segmentation fault.
        #0  0x00000000011dd25c in machine__is_lock_function (machine=0x3029e28, addr=1789230) at util/machine.c:3356
               3356 machine->sched.text_end = kmap->unmap_ip(kmap, sym->start);
      
       (gdb) where
        #0  0x00000000011dd25c in machine__is_lock_function (machine=0x3029e28, addr=1789230) at util/machine.c:3356
        #1  0x000000000109f244 in callchain_id (evsel=0x30313e0, sample=0x3ffea4f77d0) at builtin-lock.c:957
        #2  0x000000000109e094 in get_key_by_aggr_mode (key=0x3ffea4f7290, addr=27758136, evsel=0x30313e0, sample=0x3ffea4f77d0) at builtin-lock.c:586
        #3  0x000000000109f4d0 in report_lock_contention_begin_event (evsel=0x30313e0, sample=0x3ffea4f77d0) at builtin-lock.c:1004
        #4  0x00000000010a00ae in evsel__process_contention_begin (evsel=0x30313e0, sample=0x3ffea4f77d0) at builtin-lock.c:1254
        #5  0x00000000010a0e14 in process_sample_event (tool=0x3ffea4f8480, event=0x3ff85601ef8, sample=0x3ffea4f77d0, evsel=0x30313e0, machine=0x3029e28) at builtin-lock.c:1464
        .....
      
      The issue is in function machine__is_lock_function() in file
      ./util/machine.c lines 3355:
      
         /* should not fail from here */
         sym = machine__find_kernel_symbol_by_name(machine, "__sched_text_end", &kmap);
         machine->sched.text_end = kmap->unmap_ip(kmap, sym->start)
      
      On s390 the symbol __sched_text_end is *NOT* in the symbol list and the
      resulting pointer sym is set to NULL. The sym->start is then a NULL pointer
      access and generates the core dump.
      
      The reason why __sched_text_end is not in the symbol list on s390 is
      simple:
      
      When the symbol list is created at perf start up with function calls
      
        dso__load
        +--> dso__load_vmlinux_path
             +--> dso__load_vmlinux
                  +--> dso__load_sym
      	         +--> dso__load_sym_internal (reads kernel symbols)
      		 +--> symbols__fixup_end
      		 +--> symbols__fixup_duplicate
      
      The issue is in function symbols__fixup_duplicate(). It deletes all
      symbols with have the same address. On s390:
      
        # nm -g  ~/linux/vmlinux| fgrep c68390
        0000000000c68390 T __cpuidle_text_start
        0000000000c68390 T __sched_text_end
        #
      
      two symbols have identical addresses and __sched_text_end is considered
      duplicate (in ascending sort order) and removed from the symbol list.
      Therefore it is missing and an invalid pointer reference occurs.  The
      code checks for symbol __sched_text_start and when it exists assumes
      symbol __sched_text_end is also in the symbol table. However this is not
      the case on s390.
      
      Same situation exists for symbol __lock_text_start:
      
      0000000000c68770 T __cpuidle_text_end
      0000000000c68770 T __lock_text_start
      
      This symbol is also removed from the symbol table but used in function
      machine__is_lock_function().
      
      To fix this and keep duplicate symbols in the symbol table, set
      symbol_conf.allow_aliases to true. This prevents the removal of
      duplicate symbols in function symbols__fixup_duplicate().
      
      Output After:
      
       # ./perf lock contention
       contended total wait  max wait  avg wait    type   caller
      
              48   124.39 ms 123.99 ms   2.59 ms rwsem:W unlink_anon_vmas+0x24a
              47    83.68 ms  83.26 ms   1.78 ms rwsem:W free_pgtables+0x132
               5    41.22 us  10.55 us   8.24 us rwsem:W free_pgtables+0x140
               4    40.12 us  20.55 us  10.03 us rwsem:W copy_process+0x1ac8
       #
      
      Fixes: 0d2997f7 ("perf lock: Look up callchain for the contended locks")
      Signed-off-by: default avatarThomas Richter <tmricht@linux.ibm.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Sven Schnelle <svens@linux.ibm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Link: https://lore.kernel.org/r/20221230102627.2410847-1-tmricht@linux.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d8d85ce8
    • Ian Rogers's avatar
      perf build: Don't propagate subdir to submakes for install_headers · f89fb557
      Ian Rogers authored
      subdir is added to the OUTPUT which fails as part of building
      install_headers when passed from "make -C tools perf_install".
      
      Committer testing:
      
      The original reporter (see the Link: below) had trouble with this:
      
      $ make -C tools perf_install
      
      That ended up with errors like this:
      
        /var/home/acme/git/perf-urgent/tools/scripts/Makefile.include:17: *** output directory "/var/home/acme/git/perf-urgent/tools/perf/libperf/perf/" does not exist.  Stop.
      
      With this patch applied we now get it installed at:
      
        INSTALL /var/home/acme/git/perf-urgent/tools/perf/libperf/include/perf/bpf_perf.h
      
      As expected:
      
        $ ls -la /var/home/acme/git/perf-urgent/tools/perf/libperf/include/perf/bpf_perf.h
        -rw-r--r--. 1 acme acme 1146 Jan  3 15:42 /var/home/acme/git/perf-urgent/tools/perf/libperf/include/perf/bpf_perf.h
      
      And if we clean tools with:
      
        $ make -C tools clean
      
      it gets cleaned up:
      
        $ ls -la /var/home/acme/git/perf-urgent/tools/perf/libperf/include/perf/bpf_perf.h
        ls: cannot access '/var/home/acme/git/perf-urgent/tools/perf/libperf/include/perf/bpf_perf.h': No such file or directory
        $
      
      Fixes: 746bd29e ("perf build: Use tools/lib headers from install path")
      Reported-by: default avatarTorsten Hilbrich <torsten.hilbrich@secunet.com>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/fa4b3115-d555-3d7f-54d1-018002e99350@secunet.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f89fb557
    • Arnaldo Carvalho de Melo's avatar
      perf test record_probe_libc_inet_pton: Fix failure due to extra inet_pton()... · b963c1d6
      Arnaldo Carvalho de Melo authored
      perf test record_probe_libc_inet_pton: Fix failure due to extra inet_pton() backtrace in glibc >= 2.35
      
      Starting with glibc 2.35 there are extra inet_pton() calls when doing a
      IPv6 ping as in one of the 'perf test' entry, which makes it fail:
      
        # perf test inet_pton
        89: probe libc's inet_pton & backtrace it with ping   : FAILED!
        #
      
      If we look at what this script is expecting (commenting out the removal
      of the temporary files in it):
      
        # cat /tmp/expected.aT6
        ping[][0-9 \.:]+probe_libc:inet_pton: \([[:xdigit:]]+\)
        .*inet_pton\+0x[[:xdigit:]]+[[:space:]]\(/usr/lib64/libc.so.6|inlined\)$
        getaddrinfo\+0x[[:xdigit:]]+[[:space:]]\(/usr/lib64/libc.so.6\)$
        .*(\+0x[[:xdigit:]]+|\[unknown\])[[:space:]]\(.*/bin/ping.*\)$
        #
      
      And looking at what we are getting out of 'perf script', to match with
      the above:
      
        # cat /tmp/perf.script.IUC
        ping 623883 [006] 265438.471610: probe_libc:inet_pton: (7f32bcf314c0)
                          1314c0 __GI___inet_pton+0x0 (/usr/lib64/libc.so.6)
                           29510 __libc_start_call_main+0x80 (/usr/lib64/libc.so.6)
      
        ping 623883 [006] 265438.471664: probe_libc:inet_pton: (7f32bcf314c0)
                          1314c0 __GI___inet_pton+0x0 (/usr/lib64/libc.so.6)
                           fa6c6 getaddrinfo+0x126 (/usr/lib64/libc.so.6)
                            491e [unknown] (/usr/bin/ping)
        #
      
      We see that its just the first call to inet_pton() that didn't came thru
      getaddrinfo(), so if we ignore the first the script matches what it
      expects, testing that using 'perf probe' + 'perf record' + 'perf script'
      with callchains on userspace targets is producing the expected results.
      
      Since we don't have a 'perf script --skip' to help us here, use tac +
      grep to do that, resulting in a one liner that makes this script work on
      both older glibc versions as well as with 2.35.
      
      With it, on fedora 36, x86, glibc 2.35:
      
        # perf test inet_pton
         90: probe libc's inet_pton & backtrace it with ping                 : Ok
        # perf test -v inet_pton
         90: probe libc's inet_pton & backtrace it with ping                 :
        --- start ---
        test child forked, pid 627197
        ping 627220 1 267956.962402: probe_libc:inet_pton_1: (7f488bf314c0)
        1314c0 __GI___inet_pton+0x0 (/usr/lib64/libc.so.6)
        fa6c6 getaddrinfo+0x126 (/usr/lib64/libc.so.6)
        491e n (/usr/bin/ping)
        test child finished with 0
        ---- end ----
        probe libc's inet_pton & backtrace it with ping: Ok
        #
      
      And on Ubuntu 22.04.1 LTS on a Libre Computer ROC-RK3399-PC arm64 system:
      
      Before this patch it works (see that the script used has no 'tac' to
      remove the first event):
      
        root@roc-rk3399-pc:~# dpkg -l | grep libc-bin
        ii  libc-bin                                2.35-0ubuntu3.1                         arm64        GNU C Library: Binaries
        root@roc-rk3399-pc:~# grep -w tac ~acme/libexec/perf-core/tests/shell/record+probe_libc_inet_pton.sh
        root@roc-rk3399-pc:~# perf test inet_pton
         86: probe libc's inet_pton & backtrace it with ping                 : Ok
        root@roc-rk3399-pc:~# perf test -v inet_pton
         86: probe libc's inet_pton & backtrace it with ping                 :
        --- start ---
        test child forked, pid 1375
        ping 1399 [000] 4114.417450: probe_libc:inet_pton: (ffffb3e26120)
        106120 inet_pton+0x0 (/usr/lib/aarch64-linux-gnu/libc.so.6)
        d18bc getaddrinfo+0xec (/usr/lib/aarch64-linux-gnu/libc.so.6)
        2b68 [unknown] (/usr/bin/ping)
        test child finished with 0
        ---- end ----
        probe libc's inet_pton & backtrace it with ping: Ok
        root@roc-rk3399-pc:~#
      
      And after it continues to work:
      
        root@roc-rk3399-pc:~# grep -w tac ~acme/libexec/perf-core/tests/shell/record+probe_libc_inet_pton.sh
        	perf script -i $perf_data | tac | grep -m1 ^ping -B9 | tac > $perf_script
        root@roc-rk3399-pc:~# perf test inet_pton
         86: probe libc's inet_pton & backtrace it with ping                 : Ok
        root@roc-rk3399-pc:~# perf test -v inet_pton
         86: probe libc's inet_pton & backtrace it with ping                 :
        --- start ---
        test child forked, pid 6995
        ping 7019 [005] 4832.160741: probe_libc:inet_pton: (ffffa62e6120)
        106120 inet_pton+0x0 (/usr/lib/aarch64-linux-gnu/libc.so.6)
        d18bc getaddrinfo+0xec (/usr/lib/aarch64-linux-gnu/libc.so.6)
        2b68 [unknown] (/usr/bin/ping)
        test child finished with 0
        ---- end ----
        probe libc's inet_pton & backtrace it with ping: Ok
        root@roc-rk3399-pc:~#
      Reported-by: default avatarThomas Richter <tmricht@linux.ibm.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Sven Schnelle <svens@linux.ibm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Link: http://lore.kernel.org/lkml/Y7QyPkPlDYip3cZH@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b963c1d6
  3. 02 Jan, 2023 5 commits
    • Arnaldo Carvalho de Melo's avatar
      perf tools: Fix segfault when trying to process tracepoints in perf.data and... · 77fe30fe
      Arnaldo Carvalho de Melo authored
      perf tools: Fix segfault when trying to process tracepoints in perf.data and not linked with libtraceevent
      
      When we have a perf.data file with tracepoints, such as:
      
        # perf evlist -f
        probe_perf:lzma_decompress_to_file
        # Tip: use 'perf evlist --trace-fields' to show fields for tracepoint events
        #
      
      We end up segfaulting when using perf built with NO_LIBTRACEEVENT=1 by
      trying to find an evsel with a NULL 'event_name' variable:
      
        (gdb) run report --stdio -f
        Starting program: /root/bin/perf report --stdio -f
      
        Program received signal SIGSEGV, Segmentation fault.
        0x000000000055219d in find_evsel (evlist=0xfda7b0, event_name=0x0) at util/sort.c:2830
        warning: Source file is more recent than executable.
        2830		if (event_name[0] == '%') {
        Missing separate debuginfos, use: dnf debuginfo-install bzip2-libs-1.0.8-11.fc36.x86_64 cyrus-sasl-lib-2.1.27-18.fc36.x86_64 elfutils-debuginfod-client-0.188-3.fc36.x86_64 elfutils-libelf-0.188-3.fc36.x86_64 elfutils-libs-0.188-3.fc36.x86_64 glibc-2.35-20.fc36.x86_64 keyutils-libs-1.6.1-4.fc36.x86_64 krb5-libs-1.19.2-12.fc36.x86_64 libbrotli-1.0.9-7.fc36.x86_64 libcap-2.48-4.fc36.x86_64 libcom_err-1.46.5-2.fc36.x86_64 libcurl-7.82.0-12.fc36.x86_64 libevent-2.1.12-6.fc36.x86_64 libgcc-12.2.1-4.fc36.x86_64 libidn2-2.3.4-1.fc36.x86_64 libnghttp2-1.51.0-1.fc36.x86_64 libpsl-0.21.1-5.fc36.x86_64 libselinux-3.3-4.fc36.x86_64 libssh-0.9.6-4.fc36.x86_64 libstdc++-12.2.1-4.fc36.x86_64 libunistring-1.0-1.fc36.x86_64 libunwind-1.6.2-2.fc36.x86_64 libxcrypt-4.4.33-4.fc36.x86_64 libzstd-1.5.2-2.fc36.x86_64 numactl-libs-2.0.14-5.fc36.x86_64 opencsd-1.2.0-1.fc36.x86_64 openldap-2.6.3-1.fc36.x86_64 openssl-libs-3.0.5-2.fc36.x86_64 slang-2.3.2-11.fc36.x86_64 xz-libs-5.2.5-9.fc36.x86_64 zlib-1.2.11-33.fc36.x86_64
        (gdb) bt
        #0  0x000000000055219d in find_evsel (evlist=0xfda7b0, event_name=0x0) at util/sort.c:2830
        #1  0x0000000000552416 in add_dynamic_entry (evlist=0xfda7b0, tok=0xffb6eb "trace", level=2) at util/sort.c:2976
        #2  0x0000000000552d26 in sort_dimension__add (list=0xf93e00 <perf_hpp_list>, tok=0xffb6eb "trace", evlist=0xfda7b0, level=2) at util/sort.c:3193
        #3  0x0000000000552e1c in setup_sort_list (list=0xf93e00 <perf_hpp_list>, str=0xffb6eb "trace", evlist=0xfda7b0) at util/sort.c:3227
        #4  0x00000000005532fa in __setup_sorting (evlist=0xfda7b0) at util/sort.c:3381
        #5  0x0000000000553cdc in setup_sorting (evlist=0xfda7b0) at util/sort.c:3608
        #6  0x000000000042eb9f in cmd_report (argc=0, argv=0x7fffffffe470) at builtin-report.c:1596
        #7  0x00000000004aee7e in run_builtin (p=0xf64ca0 <commands+288>, argc=3, argv=0x7fffffffe470) at perf.c:330
        #8  0x00000000004af0f2 in handle_internal_command (argc=3, argv=0x7fffffffe470) at perf.c:384
        #9  0x00000000004af241 in run_argv (argcp=0x7fffffffe29c, argv=0x7fffffffe290) at perf.c:428
        #10 0x00000000004af5fc in main (argc=3, argv=0x7fffffffe470) at perf.c:562
        (gdb)
      
      So check if we have tracepoint events in add_dynamic_entry() and bail
      out instead:
      
        # perf report --stdio -f
        This perf binary isn't linked with libtraceevent, can't process probe_perf:lzma_decompress_to_file
        Error:
        Unknown --sort key: `trace'
        #
      
      Fixes: 378ef0f5 ("perf build: Use libtraceevent from the system")
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lore.kernel.org/lkml/Y7MDb7kRaHZB6APC@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      77fe30fe
    • Ahelenia Ziemiańska's avatar
      perf tools: Don't include signature in version strings · f24fb539
      Ahelenia Ziemiańska authored
      This explodes the build if HEAD is signed, since the generated version
      is gpg: Signature made Mon 26 Dec 2022 20:34:48 CET, then a few more
      lines, then the SHA.
      Signed-off-by: default avatarAhelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/7c9637711271f50ec2341fb8a7c29585335dab04.1672174189.git.nabijaczleweli@nabijaczleweli.xyzSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f24fb539
    • Yang Jihong's avatar
      perf help: Use HAVE_LIBTRACEEVENT to filter out unsupported commands · 55c41f2e
      Yang Jihong authored
      Commands such as kmem, kwork, lock, sched, trace and timechart depend on
      libtraceevent, these commands need to be isolated using HAVE_LIBTRACEEVENT
      macro when cmdlist generation.
      
      The output of the generate-cmdlist.sh script is as follows:
      
        # ./util/generate-cmdlist.sh
        /* Automatically generated by ./util/generate-cmdlist.sh */
        struct cmdname_help
        {
            char name[16];
            char help[80];
        };
      
        static struct cmdname_help common_cmds[] = {
          {"annotate", "Read perf.data (created by perf record) and display annotated code"},
          {"archive", "Create archive with object files with build-ids found in perf.data file"},
          {"bench", "General framework for benchmark suites"},
          {"buildid-cache", "Manage build-id cache."},
          {"buildid-list", "List the buildids in a perf.data file"},
          {"c2c", "Shared Data C2C/HITM Analyzer."},
          {"config", "Get and set variables in a configuration file."},
          {"daemon", "Run record sessions on background"},
          {"data", "Data file related processing"},
          {"diff", "Read perf.data files and display the differential profile"},
          {"evlist", "List the event names in a perf.data file"},
          {"ftrace", "simple wrapper for kernel's ftrace functionality"},
          {"inject", "Filter to augment the events stream with additional information"},
          {"iostat", "Show I/O performance metrics"},
          {"kallsyms", "Searches running kernel for symbols"},
          {"kvm", "Tool to trace/measure kvm guest os"},
          {"list", "List all symbolic event types"},
          {"mem", "Profile memory accesses"},
          {"record", "Run a command and record its profile into perf.data"},
          {"report", "Read perf.data (created by perf record) and display the profile"},
          {"script", "Read perf.data (created by perf record) and display trace output"},
          {"stat", "Run a command and gather performance counter statistics"},
          {"test", "Runs sanity tests."},
          {"top", "System profiling tool."},
          {"version", "display the version of perf binary"},
        #ifdef HAVE_LIBELF_SUPPORT
          {"probe", "Define new dynamic tracepoints"},
        #endif /* HAVE_LIBELF_SUPPORT */
        #if defined(HAVE_LIBTRACEEVENT) && (defined(HAVE_LIBAUDIT_SUPPORT) || defined(HAVE_SYSCALL_TABLE_SUPPORT))
          {"trace", "strace inspired tool"},
        #endif /* HAVE_LIBTRACEEVENT && (HAVE_LIBAUDIT_SUPPORT || HAVE_SYSCALL_TABLE_SUPPORT) */
        #ifdef HAVE_LIBTRACEEVENT
          {"kmem", "Tool to trace/measure kernel memory properties"},
          {"kwork", "Tool to trace/measure kernel work properties (latencies)"},
          {"lock", "Analyze lock events"},
          {"sched", "Tool to trace/measure scheduler properties (latencies)"},
          {"timechart", "Tool to visualize total system behavior during a workload"},
        #endif /* HAVE_LIBTRACEEVENT */
        };
      
      Fixes: 378ef0f5 ("perf build: Use libtraceevent from the system")
      Signed-off-by: default avatarYang Jihong <yangjihong1@huawei.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20221226085703.95081-1-yangjihong1@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      55c41f2e
    • Eric Lin's avatar
      perf tools riscv: Fix build error on riscv due to missing header for 'struct perf_sample' · a8f54d94
      Eric Lin authored
      Since the definition of 'struct perf_sample' has been moved to sample.h,
      we need to include this header file to fix the build error as follows:
      
        arch/riscv/util/unwind-libdw.c: In function 'libdw__arch_set_initial_registers':
        arch/riscv/util/unwind-libdw.c:12:50: error: invalid use of undefined type 'struct perf_sample'
           12 |         struct regs_dump *user_regs = &ui->sample->user_regs;
              |                                                  ^~
      
      Fixes: 9823147d ("perf tools: Move 'struct perf_sample' to a separate header file to disentangle headers")
      Signed-off-by: default avatarEric Lin <eric.lin@sifive.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: greentime.hu@sifive.com
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: linux-riscv@lists.infradead.org
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Vincent Chen <vincent.chen@sifive.com>
      Link: https://lore.kernel.org/r/20221231052731.24908-1-eric.lin@sifive.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a8f54d94
    • Miaoqian Lin's avatar
      perf tools: Fix resources leak in perf_data__open_dir() · 0a6564eb
      Miaoqian Lin authored
      In perf_data__open_dir(), opendir() opens the directory stream.  Add
      missing closedir() to release it after use.
      
      Fixes: eb617670 ("perf data: Add perf_data__open_dir_data function")
      Reviewed-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: default avatarMiaoqian Lin <linmq006@gmail.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20221229090903.1402395-1-linmq006@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0a6564eb
  4. 01 Jan, 2023 6 commits
  5. 31 Dec, 2022 2 commits
  6. 30 Dec, 2022 19 commits
  7. 29 Dec, 2022 3 commits
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · 2258c2dc
      Linus Torvalds authored
      Pull kvm fixes from Paolo Bonzini:
       "Changes that were posted too late for 6.1, or after the release.
      
        x86:
      
         - several fixes to nested VMX execution controls
      
         - fixes and clarification to the documentation for Xen emulation
      
         - do not unnecessarily release a pmu event with zero period
      
         - MMU fixes
      
         - fix Coverity warning in kvm_hv_flush_tlb()
      
        selftests:
      
         - fixes for the ucall mechanism in selftests
      
         - other fixes mostly related to compilation with clang"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (41 commits)
        KVM: selftests: restore special vmmcall code layout needed by the harness
        Documentation: kvm: clarify SRCU locking order
        KVM: x86: fix deadlock for KVM_XEN_EVTCHN_RESET
        KVM: x86/xen: Documentation updates and clarifications
        KVM: x86/xen: Add KVM_XEN_INVALID_GPA and KVM_XEN_INVALID_GFN to uapi
        KVM: x86/xen: Simplify eventfd IOCTLs
        KVM: x86/xen: Fix SRCU/RCU usage in readers of evtchn_ports
        KVM: x86/xen: Use kvm_read_guest_virt() instead of open-coding it badly
        KVM: x86/xen: Fix memory leak in kvm_xen_write_hypercall_page()
        KVM: Delete extra block of "};" in the KVM API documentation
        kvm: x86/mmu: Remove duplicated "be split" in spte.h
        kvm: Remove the unused macro KVM_MMU_READ_{,UN}LOCK()
        MAINTAINERS: adjust entry after renaming the vmx hyperv files
        KVM: selftests: Mark correct page as mapped in virt_map()
        KVM: arm64: selftests: Don't identity map the ucall MMIO hole
        KVM: selftests: document the default implementation of vm_vaddr_populate_bitmap
        KVM: selftests: Use magic value to signal ucall_alloc() failure
        KVM: selftests: Disable "gnu-variable-sized-type-not-at-end" warning
        KVM: selftests: Include lib.mk before consuming $(CC)
        KVM: selftests: Explicitly disable builtins for mem*() overrides
        ...
      2258c2dc
    • Jens Axboe's avatar
      Merge tag 'nvme-6.2-2022-12-29' of git://git.infradead.org/nvme into block-6.2 · 1551ed5a
      Jens Axboe authored
      Pull NVMe fixes from Christoph:
      
      "nvme fixes for Linux 6.2
      
       - fix various problems in handling the Command Supported and Effects log
         (Christoph Hellwig)
       - don't allow unprivileged passthrough of commands that don't transfer
         data but modify logical block content (Christoph Hellwig)
       - add a features and quirks policy document (Christoph Hellwig)
       - fix some really nasty code that was correct but made smatch complain
         (Sagi Grimberg)"
      
      * tag 'nvme-6.2-2022-12-29' of git://git.infradead.org/nvme:
        nvme-auth: fix smatch warning complaints
        nvme: consult the CSE log page for unprivileged passthrough
        nvme: also return I/O command effects from nvme_command_effects
        nvmet: don't defer passthrough commands with trivial effects to the workqueue
        nvmet: set the LBCC bit for commands that modify data
        nvmet: use NVME_CMD_EFFECTS_CSUPP instead of open coding it
        nvme: fix the NVME_CMD_EFFECTS_CSE_MASK definition
        docs, nvme: add a feature and quirk policy document
      1551ed5a
    • Bhaskar Chowdhury's avatar
      kconfig: Add static text for search information in help menu · da8daff9
      Bhaskar Chowdhury authored
      Add few static text to explain how one can bring up the search dialog
      box by pressing the forward slash key anywhere on this interface.
      Signed-off-by: default avatarBhaskar Chowdhury <unixbhaskar@gmail.com>
      Acked-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      da8daff9