An error occurred fetching the project authors.
  1. 03 Apr, 2024 1 commit
  2. 21 Mar, 2024 1 commit
  3. 21 Feb, 2024 3 commits
    • Changbin Du's avatar
      perf: script: add raw|disasm arguments to --insn-trace option · 6750ba4b
      Changbin Du authored
      Now '--insn-trace' accept a argument to specify the output format:
        - raw: display raw instructions.
        - disasm: display mnemonic instructions (if capstone is installed).
      
      $ sudo perf script --insn-trace=raw
                    ls 1443864 [006] 2275506.209908875:      7f216b426100 _start+0x0 (/usr/lib/x86_64-linux-gnu/ld-2.31.so) insn: 48 89 e7
                    ls 1443864 [006] 2275506.209908875:      7f216b426103 _start+0x3 (/usr/lib/x86_64-linux-gnu/ld-2.31.so) insn: e8 e8 0c 00 00
                    ls 1443864 [006] 2275506.209908875:      7f216b426df0 _dl_start+0x0 (/usr/lib/x86_64-linux-gnu/ld-2.31.so) insn: f3 0f 1e fa
      
      $ sudo perf script --insn-trace=disasm
                    ls 1443864 [006] 2275506.209908875:      7f216b426100 _start+0x0 (/usr/lib/x86_64-linux-gnu/ld-2.31.so)		movq %rsp, %rdi
                    ls 1443864 [006] 2275506.209908875:      7f216b426103 _start+0x3 (/usr/lib/x86_64-linux-gnu/ld-2.31.so)		callq _dl_start+0x0
                    ls 1443864 [006] 2275506.209908875:      7f216b426df0 _dl_start+0x0 (/usr/lib/x86_64-linux-gnu/ld-2.31.so)	illegal instruction
                    ls 1443864 [006] 2275506.209908875:      7f216b426df4 _dl_start+0x4 (/usr/lib/x86_64-linux-gnu/ld-2.31.so)	pushq %rbp
                    ls 1443864 [006] 2275506.209908875:      7f216b426df5 _dl_start+0x5 (/usr/lib/x86_64-linux-gnu/ld-2.31.so)	movq %rsp, %rbp
                    ls 1443864 [006] 2275506.209908875:      7f216b426df8 _dl_start+0x8 (/usr/lib/x86_64-linux-gnu/ld-2.31.so)	pushq %r15
      Signed-off-by: default avatarChangbin Du <changbin.du@huawei.com>
      Reviewed-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: changbin.du@gmail.com
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/r/20240217074046.4100789-5-changbin.du@huawei.com
      6750ba4b
    • Changbin Du's avatar
      perf: script: add field 'disasm' to display mnemonic instructions · 99417234
      Changbin Du authored
      In addition to the 'insn' field, this adds a new field 'disasm' to
      display mnemonic instructions instead of the raw code.
      
      $ sudo perf script -F +disasm
             perf-exec 1443864 [006] 2275506.209848:          psb:  psb offs: 0                                      0 [unknown] ([unknown])
             perf-exec 1443864 [006] 2275506.209848:          cbr:  cbr: 41 freq: 4100 MHz (114%)                    0 [unknown] ([unknown])
                    ls 1443864 [006] 2275506.209905:          1  branches:uH:      7f216b426100 _start+0x0 (/usr/lib/x86_64-linux-gnu/ld-2.31.so)	movq %rsp, %rdi
                    ls 1443864 [006] 2275506.209908:          1  branches:uH:      7f216b426103 _start+0x3 (/usr/lib/x86_64-linux-gnu/ld-2.31.so)	callq _dl_start+0x0
      Signed-off-by: default avatarChangbin Du <changbin.du@huawei.com>
      Reviewed-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: changbin.du@gmail.com
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/r/20240217074046.4100789-4-changbin.du@huawei.com
      99417234
    • Changbin Du's avatar
      perf: util: use capstone disasm engine to show assembly instructions · 8f0ec15f
      Changbin Du authored
      Currently, the instructions of samples are shown as raw hex strings
      which are hard to read. x86 has a special option '--xed' to disassemble
      the hex string via intel XED tool.
      
      Here we use capstone as our disassembler engine to give more friendly
      instructions. We select libcapstone because capstone can provide more
      insn details. Perf will fallback to raw instructions if libcapstone is
      not available.
      
      The advantages compared to XED tool:
       * Support arm, arm64, x86-32, x86_64 (more could be supported),
         xed only for x86_64.
       * Immediate address operands are shown as symbol+offs.
      Signed-off-by: default avatarChangbin Du <changbin.du@huawei.com>
      Reviewed-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: changbin.du@gmail.com
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/r/20240217074046.4100789-3-changbin.du@huawei.com
      8f0ec15f
  4. 08 Feb, 2024 1 commit
    • Adrian Hunter's avatar
      perf tools: Make it possible to see perf's kernel and module memory mappings · 0bdfbd04
      Adrian Hunter authored
      Dump kmaps if using 'perf --debug kmaps' or verbose > 2 (e.g. -vvv) for
      tools 'perf script' and 'perf report' if there is no browser.
      
      Example:
      
        $ perf --debug kmaps script 2>&1 >/dev/null | grep kvm.intel
        build id event received for /lib/modules/6.7.2-local/kernel/arch/x86/kvm/kvm-intel.ko: 0691d75e10e72ebbbd45a44c59f6d00a5604badf [20]
        Map: 0-3a3 4f5d8 [kvm_intel].modinfo
        Map: 0-5240 5f280 [kvm_intel]__versions
        Map: 0-30 64 [kvm_intel].note.Linux
        Map: 0-14 644c0 [kvm_intel].orc_header
        Map: 0-5297 43680 [kvm_intel].rodata
        Map: 0-5bee 3b837 [kvm_intel].text.unlikely
        Map: 0-7e0 41430 [kvm_intel].noinstr.text
        Map: 0-2080 713c0 [kvm_intel].bss
        Map: 0-26 705c8 [kvm_intel].data..read_mostly
        Map: 0-5888 6a4c0 [kvm_intel].data
        Map: 0-22 70220 [kvm_intel].data.once
        Map: 0-40 705f0 [kvm_intel].data..percpu
        Map: 0-1685 41d20 [kvm_intel].init.text
        Map: 0-4b8 6fd60 [kvm_intel].init.data
        Map: 0-380 70248 [kvm_intel]__dyndbg
        Map: 0-8 70218 [kvm_intel].exit.data
        Map: 0-438 4f980 [kvm_intel]__param
        Map: 0-5f5 4ca0f [kvm_intel].rodata.str1.1
        Map: 0-3657 493b8 [kvm_intel].rodata.str1.8
        Map: 0-e0 70640 [kvm_intel].data..ro_after_init
        Map: 0-500 70ec0 [kvm_intel].gnu.linkonce.this_module
        Map: ffffffffc13a7000-ffffffffc1421000 a0 /lib/modules/6.7.2-local/kernel/arch/x86/kvm/kvm-intel.ko
      
      The example above shows how the module section mappings are all wrong
      except for the main .text mapping at 0xffffffffc13a7000.
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Like Xu <like.xu.linux@gmail.com>
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/r/20240208085326.13432-2-adrian.hunter@intel.com
      0bdfbd04
  5. 07 Feb, 2024 1 commit
    • Kan Liang's avatar
      perf script: Print source line for each jump in brstackinsn · 112c5547
      Kan Liang authored
      With the srcline option, the perf script only prints a source line at
      the beginning of a sample with call/ret from functions, but not for
      each jump in brstackinsn. It's useful to print a source line for each
      jump in brstackinsn when the end user analyze the full assembler
      sequences of branch sequences for the sample.
      
      The srccode option can also be used to locate the source code line.
      However, it's printed almost for every line and makes the output less
      readable.
      
       $perf script -F +brstackinsn,+srcline --xed
      
      Before the patch,
      
       tchain_edit_deb 1463275 15228549.107820:     282495 instructions:u:            401133 f3+0xd (/home/kan/os.li>
        tchain_edit.c:22
              f3+40:  tchain_edit.c:20
              000000000040114e                        jle 0x401133                    # PRED 6 cycles [6]
              0000000000401133                        movl  -0x4(%rbp), %eax
              0000000000401136                        and $0x1, %eax
              0000000000401139                        test %eax, %eax
              000000000040113b                        jz 0x401143
              000000000040113d                        addl  $0x1, -0x4(%rbp)
              0000000000401141                        jmp 0x401147                    # PRED 3 cycles [9] 2.00 IPC
              0000000000401147                        cmpl  $0x3e7, -0x4(%rbp)
              000000000040114e                        jle 0x401133                    # PRED 6 cycles [15] 0.33 IPC
      
      After the patch,
      
       tchain_edit_deb 1463275 15228549.107820:     282495 instructions:u:            401133 f3+0xd (/home/kan/os.li>
        tchain_edit.c:22
              f3+40:  tchain_edit.c:20
              000000000040114e                        jle 0x401133                     srcline: tchain_edit.c:20      # PRED 6 cycles [6]
              0000000000401133                        movl  -0x4(%rbp), %eax
              0000000000401136                        and $0x1, %eax
              0000000000401139                        test %eax, %eax
              000000000040113b                        jz 0x401143
              000000000040113d                        addl  $0x1, -0x4(%rbp)
              0000000000401141                        jmp 0x401147                     srcline: tchain_edit.c:23      # PRED 3 cycles [9] 2.00 IPC
              0000000000401147                        cmpl  $0x3e7, -0x4(%rbp)
              000000000040114e                        jle 0x401133                     srcline: tchain_edit.c:20      # PRED 6 cycles [15] 0.33 IPC
      Signed-off-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Reviewed-by: default avatarIan Rogers <irogers@google.com>
      Cc: ahmad.yasin@intel.com
      Cc: amiri.khalil@intel.com
      Cc: ak@linux.intel.com
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/r/20240205145819.1943114-1-kan.liang@linux.intel.com
      112c5547
  6. 17 Oct, 2023 1 commit
  7. 08 Aug, 2023 1 commit
    • Ivan Babrou's avatar
      perf script: Print "cgroup" field on the same line as "comm" · 8c49c6e1
      Ivan Babrou authored
      Commit 3fd7a168 ("perf script: Add 'cgroup' field for output")
      added support for printing cgroup path in perf script output.
      
      It was okay if you didn't want any stacks:
      
          $ sudo perf script --comms jpegtran:23f4bf -F comm,tid,cpu,time,cgroup
          jpegtran:23f4bf 3321915 [013] 404718.587488:  /idle.slice/polish.service
          jpegtran:23f4bf 3321915 [031] 404718.592073:  /idle.slice/polish.service
      
      With stacks it gets messier as cgroup is printed after the stack:
      
          $ perf script --comms jpegtran:23f4bf -F comm,tid,cpu,time,cgroup,ip,sym
          jpegtran:23f4bf 3321915 [013] 404718.587488:
                          5c554 compress_output
                          570d9 jpeg_finish_compress
                          3476e jpegtran_main
                          330ee jpegtran::main
                          326e2 core::ops::function::FnOnce::call_once (inlined)
                          326e2 std::sys_common::backtrace::__rust_begin_short_backtrace
          /idle.slice/polish.service
          jpegtran:23f4bf 3321915 [031] 404718.592073:
                          8474d jsimd_encode_mcu_AC_first_prepare_sse2.PADDING
                      55af68e62fff [unknown]
          /idle.slice/polish.service
      
      Let's instead print cgroup on the same line as comm:
      
          $ perf script --comms jpegtran:23f4bf -F comm,tid,cpu,time,cgroup,ip,sym
          jpegtran:23f4bf 3321915 [013] 404718.587488:  /idle.slice/polish.service
                          5c554 compress_output
                          570d9 jpeg_finish_compress
                          3476e jpegtran_main
                          330ee jpegtran::main
                          326e2 core::ops::function::FnOnce::call_once (inlined)
                          326e2 std::sys_common::backtrace::__rust_begin_short_backtrace
      
          jpegtran:23f4bf 3321915 [031] 404718.592073:  /idle.slice/polish.service
                          8474d jsimd_encode_mcu_AC_first_prepare_sse2.PADDING
                      55af68e62fff [unknown]
      
      Fixes: 3fd7a168 ("perf script: Add 'cgroup' field for output")
      Signed-off-by: default avatarIvan Babrou <ivan@cloudflare.com>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      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>
      Cc: kernel-team@cloudflare.com
      Link: https://lore.kernel.org/r/20230718000737.49077-1-ivan@cloudflare.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8c49c6e1
  8. 12 Jun, 2023 5 commits
    • Ian Rogers's avatar
      perf script: Remove some large stack allocations · e590e46b
      Ian Rogers authored
      Some char buffers are stack allocated but in total they come to
      24kb. Avoid Wstack-usage warnings by moving the arrays to being
      dynamically allocated.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.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/20230527034324.2597593-3-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e590e46b
    • Ian Rogers's avatar
      perf callchain: Use pthread keys for tls callchain_cursor · 8ab12a20
      Ian Rogers authored
      Pthread keys are more portable than __thread and allow the association
      of a destructor with the key. Use the destructor to clean up TLS
      callchain cursors to aid understanding memory leaks.
      
      Committer notes:
      
      Had to fixup a series of unconverted places and also check for the
      return of get_tls_callchain_cursor() as it may fail and return NULL.
      
      In that unlikely case we now either print something to a file, if the
      caller was expecting to print a callchain, or return an error code to
      state that resolving the callchain isn't possible.
      
      In some cases this was made easier because thread__resolve_callchain()
      already can fail for other reasons, so this new one (cursor == NULL) can
      be added and the callers don't have to explicitely check for this new
      condition.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ali Saidi <alisaidi@amazon.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Brian Robbins <brianrob@linux.microsoft.com>
      Cc: Changbin Du <changbin.du@huawei.com>
      Cc: Dmitrii Dolgov <9erthalion6@gmail.com>
      Cc: Fangrui Song <maskray@google.com>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Ivan Babrou <ivan@cloudflare.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jing Zhang <renyu.zj@linux.alibaba.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Liam Howlett <liam.howlett@oracle.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Miguel Ojeda <ojeda@kernel.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Steinar H. Gunderson <sesse@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Wenyu Liu <liuwenyu7@huawei.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: Ye Xingchen <ye.xingchen@zte.com.cn>
      Cc: Yuan Can <yuancan@huawei.com>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20230608232823.4027869-25-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8ab12a20
    • Ian Rogers's avatar
      perf addr_location: Add init/exit/copy functions · 0dd5041c
      Ian Rogers authored
      struct addr_location holds references to multiple reference counted
      objects. Add init/exit functions to make maintenance of those more
      consistent with the rest of the code and to try to avoid
      leaks. Modification of thread reference counts isn't included in this
      change.
      
      Committer notes:
      
      I needed to initialize result to sample->ip to make sure is set to
      something, fixing a compile time error, mostly keeping the previous
      logic as build_alloc_func_list() already does debugging/error prints
      about what went wrong if it takes the 'goto out'.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ali Saidi <alisaidi@amazon.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Brian Robbins <brianrob@linux.microsoft.com>
      Cc: Changbin Du <changbin.du@huawei.com>
      Cc: Dmitrii Dolgov <9erthalion6@gmail.com>
      Cc: Fangrui Song <maskray@google.com>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Ivan Babrou <ivan@cloudflare.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jing Zhang <renyu.zj@linux.alibaba.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Liam Howlett <liam.howlett@oracle.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Miguel Ojeda <ojeda@kernel.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Steinar H. Gunderson <sesse@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Wenyu Liu <liuwenyu7@huawei.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: Ye Xingchen <ye.xingchen@zte.com.cn>
      Cc: Yuan Can <yuancan@huawei.com>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20230608232823.4027869-7-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0dd5041c
    • Ian Rogers's avatar
      perf thread: Add accessor functions for thread · ee84a303
      Ian Rogers authored
      Using accessors will make it easier to add reference count checking in
      later patches.
      
      Committer notes:
      
      thread->nsinfo wasn't wrapped as it is used together with
      nsinfo__zput(), where does a trick to set the field with a refcount
      being dropped to NULL, and that doesn't work well with using
      thread__nsinfo(thread), that loses the &thread->nsinfo pointer.
      
      When refcount checking is added to 'struct thread', later in this
      series, nsinfo__zput(RC_CHK_ACCESS(thread)->nsinfo) will be used to
      check the thread pointer.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ali Saidi <alisaidi@amazon.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Brian Robbins <brianrob@linux.microsoft.com>
      Cc: Changbin Du <changbin.du@huawei.com>
      Cc: Dmitrii Dolgov <9erthalion6@gmail.com>
      Cc: Fangrui Song <maskray@google.com>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Ivan Babrou <ivan@cloudflare.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jing Zhang <renyu.zj@linux.alibaba.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Liam Howlett <liam.howlett@oracle.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Miguel Ojeda <ojeda@kernel.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Steinar H. Gunderson <sesse@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Wenyu Liu <liuwenyu7@huawei.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: Ye Xingchen <ye.xingchen@zte.com.cn>
      Cc: Yuan Can <yuancan@huawei.com>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20230608232823.4027869-4-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ee84a303
    • Arnaldo Carvalho de Melo's avatar
      perf script: Fix allocation of evsel->priv related to per-event dump files · 36d3e413
      Arnaldo Carvalho de Melo authored
      When printing output we may want to generate per event files, where the
      --per-event-dump option should be used, creating perf.data.EVENT.dump
      files instead of printing to stdout.
      
      The callback thar processes event thus expects that evsel->priv->fp
      should point to either the per-event FILE descriptor or to stdout.
      
      The a3af66f5 ("perf script: Fix crash because of missing
      evsel->priv") changeset fixed a case where evsel->priv wasn't setup,
      thus set to NULL, causing a segfault when trying to access
      evsel->priv->fp.
      
      But it did it for the non --per-event-dump case by allocating a 'struct
      perf_evsel_script' just to set its ->fp to stdout.
      
      Since evsel->priv is only freed when --per-event-dump is used, we ended
      up with a memory leak, detected using ASAN.
      
      Fix it by using the same method as perf_script__setup_per_event_dump(),
      and reuse that static 'struct perf_evsel_script'.
      
      Also check if evsel_script__new() failed.
      
      Fixes: a3af66f5 ("perf script: Fix crash because of missing evsel->priv")
      Reported-by: default avatarIan Rogers <irogers@google.com>
      Tested-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>
      Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
      Link: https://lore.kernel.org/lkml/ZH+F0wGAWV14zvMP@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      36d3e413
  9. 01 Jun, 2023 1 commit
    • Namhyung Kim's avatar
      perf script: Increase PID/TID width for output · fe8e0434
      Namhyung Kim authored
      On large systems, it's common that PID/TID is bigger than 5-digit and it
      makes the output unaligned.  Let's increase the width to 7.
      
      Before:
      
        $ perf script
        ...
                 swapper     0 [006] 1540823.803935:    1369324 cycles:P:  ffffffff9c755588 ktime_get+0x18 ([kernel.kallsyms])
             gvfsd-dnssd 95114 [004] 1540823.804164:    1643871 cycles:P:  ffffffff9cfdca5c __get_user_8+0x1c ([kernel.kallsyms])
               perf-exec 1558582 [000] 1540823.804209:    1018714 cycles:P:  ffffffff9c924ab9 __slab_free+0x9 ([kernel.kallsyms])
                   nmcli 1558589 [007] 1540823.804384:    1859212 cycles:P:      7f70537a8ad8 __strchrnul_evex+0x18 (/usr/lib/x86_64-linux-gnu/libc.so.6>
                   sleep 1558582 [000] 1540823.804456:     987425 cycles:P:      7fd35bb27b30 _dl_init+0x0 (/usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2>
             dbus-daemon  3043 [003] 1540823.804575:    1564465 cycles:P:  ffffffff9cb2bb70 llist_add_batch+0x0 ([kernel.kallsyms])
                   gdbus 1558592 [001] 1540823.804766:    1315219 cycles:P:  ffffffff9c797b2e audit_filter_syscall+0x9e ([kernel.kallsyms])
          NetworkManager  3452 [005] 1540823.805301:    1558782 cycles:P:      7fa957737748 g_bit_lock+0x58 (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.5>
      
      After:
      
        $ perf script
        ...
                 swapper       0 [006] 1540823.803935:    1369324 cycles:P:  ffffffff9c755588 ktime_get+0x18 ([kernel.kallsyms])
             gvfsd-dnssd   95114 [004] 1540823.804164:    1643871 cycles:P:  ffffffff9cfdca5c __get_user_8+0x1c ([kernel.kallsyms])
               perf-exec 1558582 [000] 1540823.804209:    1018714 cycles:P:  ffffffff9c924ab9 __slab_free+0x9 ([kernel.kallsyms])
                   nmcli 1558589 [007] 1540823.804384:    1859212 cycles:P:      7f70537a8ad8 __strchrnul_evex+0x18 (/usr/lib/x86_64-linux-gnu/libc.so.6>
                   sleep 1558582 [000] 1540823.804456:     987425 cycles:P:      7fd35bb27b30 _dl_init+0x0 (/usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2>
             dbus-daemon    3043 [003] 1540823.804575:    1564465 cycles:P:  ffffffff9cb2bb70 llist_add_batch+0x0 ([kernel.kallsyms])
                   gdbus 1558592 [001] 1540823.804766:    1315219 cycles:P:  ffffffff9c797b2e audit_filter_syscall+0x9e ([kernel.kallsyms])
          NetworkManager    3452 [005] 1540823.805301:    1558782 cycles:P:      7fa957737748 g_bit_lock+0x58 (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.5>
      
      Reviewer notes:
      
      Adrian added:
      
      "Might be worth noting that currently the biggest PID_MAX_LIMIT is 2^22
       so pids don't get bigger than 7 digits presently"
      
      $ echo $((2 ** 22))
      4194304
      $ echo -n $((2 ** 22)) | wc -c
      7
      $
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/20230531203236.1602054-1-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      fe8e0434
  10. 12 May, 2023 1 commit
    • Changbin Du's avatar
      perf script: Add new output field 'dsoff' to print dso offset · af9eb56b
      Changbin Du authored
      This adds a new 'dsoff' field to print dso offset for resolved symbols,
      and the offset is appended to dso name.
      
      Default output:
      
        $ perf script
             ls 2695501 3011030.487017:     500000 cycles:      152cc73ef4b5 get_common_indices.constprop.0+0x155 (/usr/lib/x86_64-linux-gnu/ld-2.31.so)
             ls 2695501 3011030.487018:     500000 cycles:  ffffffff99045b3e [unknown] ([unknown])
             ls 2695501 3011030.487018:     500000 cycles:  ffffffff9968e107 [unknown] ([unknown])
             ls 2695501 3011030.487018:     500000 cycles:  ffffffffc1f54afb [unknown] ([unknown])
             ls 2695501 3011030.487018:     500000 cycles:  ffffffff9968382f [unknown] ([unknown])
             ls 2695501 3011030.487019:     500000 cycles:  ffffffff99e00094 [unknown] ([unknown])
             ls 2695501 3011030.487019:     500000 cycles:      152cc718a8d0 __errno_location@plt+0x0 (/usr/lib/x86_64-linux-gnu/libselinux.so.1)
      
      Display 'dsoff' field:
      
        $ perf script -F +dsoff
             ls 2695501 3011030.487017:     500000 cycles:      152cc73ef4b5 get_common_indices.constprop.0+0x155 (/usr/lib/x86_64-linux-gnu/ld-2.31.so+0x1c4b5)
             ls 2695501 3011030.487018:     500000 cycles:  ffffffff99045b3e [unknown] ([unknown])
             ls 2695501 3011030.487018:     500000 cycles:  ffffffff9968e107 [unknown] ([unknown])
             ls 2695501 3011030.487018:     500000 cycles:  ffffffffc1f54afb [unknown] ([unknown])
             ls 2695501 3011030.487018:     500000 cycles:  ffffffff9968382f [unknown] ([unknown])
             ls 2695501 3011030.487019:     500000 cycles:  ffffffff99e00094 [unknown] ([unknown])
             ls 2695501 3011030.487019:     500000 cycles:      152cc718a8d0 __errno_location@plt+0x0 (/usr/lib/x86_64-linux-gnu/libselinux.so.1+0x68d0)
             ls 2695501 3011030.487019:     500000 cycles:  ffffffff992a6db0 [unknown] ([unknown])
      Signed-off-by: default avatarChangbin Du <changbin.du@huawei.com>
      Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Hui Wang <hw.huiwang@huawei.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: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20230418031825.1262579-4-changbin.du@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      af9eb56b
  11. 10 May, 2023 1 commit
    • Sandipan Das's avatar
      perf script: Skip aggregation for stat events · 2fe65759
      Sandipan Das authored
      The script command does not support aggregation modes by itself although
      that can be achieved using post-processing scripts. Because of this, it
      does not allocate memory for aggregated event values.
      
      Upon running perf stat record, the aggregation mode is set in the perf
      data file. If the mode is AGGR_GLOBAL, the aggregated event values are
      accessed and this leads to a segmentation fault since these were never
      allocated to begin with. Set the mode to AGGR_NONE explicitly to avoid
      this.
      
      E.g.
      
        $ perf stat record -e cycles true
        $ perf script
      
      Before:
        Segmentation fault (core dumped)
      
      After:
        CPU   THREAD             VAL             ENA             RUN            TIME EVENT
         -1   231919          162831          362069          362069          935289 cycles:u
      
      Fixes: 8b76a318 ("perf stat: Remove unused perf_counts.aggr field")
      Signed-off-by: default avatarSandipan Das <sandipan.das@amd.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ananth Narayan <ananth.narayan@amd.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: Namhyung Kim <namhyung@kernel.org>
      Cc: Nick Terrell <terrelln@fb.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: stable@vger.kernel.org # v6.2+
      Link: https://lore.kernel.org/r/83d6c6c05c54bf00c5a9df32ac160718efca0c7a.1683280603.git.sandipan.das@amd.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      2fe65759
  12. 19 Apr, 2023 1 commit
    • Arnaldo Carvalho de Melo's avatar
      perf dso: Fix use before NULL check introduced by map__dso() introduction · 3ad1be6f
      Arnaldo Carvalho de Melo authored
      James Clark noticed that the recent 63df0e4b ("perf map: Add
      accessor for dso") patch accessed map->dso before the 'map' variable was
      NULL checked, which is a change in logic that leads to segmentation
      faults, so comb thru that patch to fix similar cases.
      
      Fixes: 63df0e4b ("perf map: Add accessor for dso")
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Link: https://lore.kernel.org/lkml/ZD68RYCVT8hqPuxr@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3ad1be6f
  13. 07 Apr, 2023 2 commits
    • Ian Rogers's avatar
      perf map: Add helper for ->map_ip() and ->unmap_ip() · 78a1f7cd
      Ian Rogers authored
      Later changes will add reference count checking for struct map, add a
      helper function to invoke the map_ip and unmap_ip function pointers. The
      helper allows the reference count check to be in fewer places.
      
      Committer notes:
      
      Add missing conversions to:
      
        tools/perf/util/map.c
        tools/perf/util/cs-etm.c
        tools/perf/util/annotate.c
        tools/perf/arch/powerpc/util/sym-handling.c
        tools/perf/arch/s390/annotate/instructions.c
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Dmitriy Vyukov <dvyukov@google.com>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: Hao Luo <haoluo@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Miaoqian Lin <linmq006@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Shunsuke Nakamura <nakamura.shun@fujitsu.com>
      Cc: Song Liu <song@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Stephen Brennan <stephen.s.brennan@oracle.com>
      Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Yury Norov <yury.norov@gmail.com>
      Link: https://lore.kernel.org/r/20230404205954.2245628-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      78a1f7cd
    • Ian Rogers's avatar
      perf map: Rename map_ip() and unmap_ip() · 0e6aa013
      Ian Rogers authored
      Add dso to match comment. This avoids a naming conflict with later
      added accessor functions for variables in struct map.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Dmitriy Vyukov <dvyukov@google.com>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: Hao Luo <haoluo@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Miaoqian Lin <linmq006@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Shunsuke Nakamura <nakamura.shun@fujitsu.com>
      Cc: Song Liu <song@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Stephen Brennan <stephen.s.brennan@oracle.com>
      Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Yury Norov <yury.norov@gmail.com>
      Link: https://lore.kernel.org/r/20230404205954.2245628-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0e6aa013
  14. 04 Apr, 2023 2 commits
    • Ian Rogers's avatar
      perf map: Add accessor for start and end · e5116f46
      Ian Rogers authored
      Later changes will add reference count checking for struct map, start
      and end are frequently accessed variables. Add an accessor so that the
      reference count check is only necessary in one place.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Dmitriy Vyukov <dvyukov@google.com>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: Hao Luo <haoluo@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Miaoqian Lin <linmq006@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Shunsuke Nakamura <nakamura.shun@fujitsu.com>
      Cc: Song Liu <song@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Stephen Brennan <stephen.s.brennan@oracle.com>
      Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Yury Norov <yury.norov@gmail.com>
      Link: https://lore.kernel.org/r/20230320212248.1175731-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e5116f46
    • Ian Rogers's avatar
      perf map: Add accessor for dso · 63df0e4b
      Ian Rogers authored
      Later changes will add reference count checking for struct map, with
      dso being the most frequently accessed variable. Add an accessor so
      that the reference count check is only necessary in one place.
      
      Additional changes:
       - add a dso variable to avoid repeated map__dso calls.
       - in builtin-mem.c dump_raw_samples, code only partially tested for
         dso == NULL. Make the possibility of NULL consistent.
       - in thread.c thread__memcpy fix use of spaces and use tabs.
      
      Committer notes:
      
      Did missing conversions on these files:
      
         tools/perf/arch/powerpc/util/skip-callchain-idx.c
         tools/perf/arch/powerpc/util/sym-handling.c
         tools/perf/ui/browsers/hists.c
         tools/perf/ui/gtk/annotate.c
         tools/perf/util/cs-etm.c
         tools/perf/util/thread.c
         tools/perf/util/unwind-libunwind-local.c
         tools/perf/util/unwind-libunwind.c
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Dmitriy Vyukov <dvyukov@google.com>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: Hao Luo <haoluo@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Miaoqian Lin <linmq006@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Shunsuke Nakamura <nakamura.shun@fujitsu.com>
      Cc: Song Liu <song@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Stephen Brennan <stephen.s.brennan@oracle.com>
      Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Yury Norov <yury.norov@gmail.com>
      Link: https://lore.kernel.org/r/20230320212248.1175731-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      63df0e4b
  15. 20 Mar, 2023 1 commit
  16. 15 Mar, 2023 1 commit
    • Adrian Hunter's avatar
      perf script: Fix Python support when no libtraceevent · 80c3a7d9
      Adrian Hunter authored
      Python scripting can be used without libtraceevent. In particular,
      scripting for Intel PT does not use tracepoints, and so does not need
      libtraceevent support.
      
      Alter the build and employ conditional compilation to allow Python
      scripting without libtraceevent.
      
      Example:
      
       Before:
      
          $ ldd `which perf` | grep -i python
          $ ldd `which perf` | grep -i libtraceevent
          $ perf record -e intel_pt//u uname
          Linux
          [ perf record: Woken up 1 times to write data ]
          [ perf record: Captured and wrote 0.031 MB perf.data ]
          $ perf script intel-pt-events.py |& head -3
            Error: Couldn't find script `intel-pt-events.py'
      
           See perf script -l for available scripts.
      
       After:
      
          $ ldd `which perf` | grep -i python
                  libpython3.10.so.1.0 => /lib/x86_64-linux-gnu/libpython3.10.so.1.0 (0x00007f4bac400000)
          $ ldd `which perf` | grep -i libtraceevent
          $ perf script intel-pt-events.py | head
          Intel PT Branch Trace, Power Events, Event Trace and PTWRITE
               Switch In    8021/8021  [000]     11234.097713404     0/0
                 perf-exec  8021/8021  [000]     11234.098041726       psb                        offset: 0x0                0 [unknown] ([unknown])
                 perf-exec  8021/8021  [000]     11234.098041726       cbr                         45  freq: 4505 MHz  (161%)                0 [unknown] ([unknown])
                     uname  8021/8021  [000]     11234.098082170  branches:uH  tr strt                              0 [unknown] ([unknown]) => 7f3a8b9422b0 _start+0x0 (/usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2)
                     uname  8021/8021  [000]     11234.098082379  branches:uH  tr end                    7f3a8b9422b0 _start+0x0 (/usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2) => 0 [unknown] ([unknown])
                     uname  8021/8021  [000]     11234.098083629  branches:uH  tr strt                              0 [unknown] ([unknown]) => 7f3a8b9422b0 _start+0x0 (/usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2)
                     uname  8021/8021  [000]     11234.098083629  branches:uH  call                      7f3a8b9422b3 _start+0x3 (/usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2) => 7f3a8b943050 _dl_start+0x0 (/usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2)
                     uname  8021/8021  [000]     11234.098083837  branches:uH  tr end                    7f3a8b943060 _dl_start+0x10 (/usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2) => 0 [unknown] ([unknown])  IPC: 0.01 (9/938)
                     uname  8021/8021  [000]     11234.098084670  branches:uH  tr strt                              0 [unknown] ([unknown]) => 7f3a8b943060 _dl_start+0x10 (/usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2)
      
      Fixes: 378ef0f5 ("perf build: Use libtraceevent from the system")
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/r/20230315084321.14563-1-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      80c3a7d9
  17. 19 Feb, 2023 2 commits
    • Ian Rogers's avatar
      perf stat: Remove saved_value/runtime_stat · aa0964e3
      Ian Rogers authored
      As saved_value/runtime_stat are only written to and not read, remove
      the associated logic and writes.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Eduard Zingerman <eddyz87@gmail.com>
      Cc: Florian Fischer <florian.fischer@muhq.space>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jing Zhang <renyu.zj@linux.alibaba.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-stm32@st-md-mailman.stormreply.com
      Link: https://lore.kernel.org/r/20230219092848.639226-52-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      aa0964e3
    • Ian Rogers's avatar
      perf stat: Hide runtime_stat · cc26ffaa
      Ian Rogers authored
      runtime_stat is only shared for the sake of tests that don't care
      about its value. Move the definition into stat-shadow.c and have the
      tests also use the global version.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Eduard Zingerman <eddyz87@gmail.com>
      Cc: Florian Fischer <florian.fischer@muhq.space>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jing Zhang <renyu.zj@linux.alibaba.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-stm32@st-md-mailman.stormreply.com
      Link: https://lore.kernel.org/r/20230219092848.639226-48-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      cc26ffaa
  18. 03 Feb, 2023 1 commit
  19. 02 Feb, 2023 2 commits
    • Sandipan Das's avatar
      perf script: Show branch speculation info · 6ade6c64
      Sandipan Das authored
      Show the branch speculation info if provided by the branch recording
      hardware feature. This can be useful for optimizing code further.
      
      The speculation info is appended to the end of the list of fields so any
      existing tools that use "/" as a delimiter for access fields via an index
      remain unaffected. Also show "-" instead of "N/A" when speculation info
      is unavailable because "/" is used as the field separator.
      
      E.g.
      
        $ perf record -j any,u,save_type ./test_branch
        $ perf script --fields brstacksym
      
      Before:
      
        [...]
        check_match+0x60/strcmp+0x0/P/-/-/0/CALL
        do_lookup_x+0x3c5/check_match+0x0/P/-/-/0/CALL
        [...]
      
      After:
      
        [...]
        check_match+0x60/strcmp+0x0/P/-/-/0/CALL/NON_SPEC_CORRECT_PATH
        do_lookup_x+0x3c5/check_match+0x0/P/-/-/0/CALL/NON_SPEC_CORRECT_PATH
        [...]
      
      The bitfield swapping scheme used duing sample parsing has changed
      because of the addition of new branch flags, namely "spec", "new_type"
      and "priv". Earlier, these were all part of the "reserved" field but
      now, each of these fields get swapped separately. Change the expected
      flag values accordingly for the test to pass.
      
      E.g.
      
        $ perf test -v 27
      
      Before:
      
         27: Sample parsing                                                  :
        --- start ---
        test child forked, pid 61979
        parsing failed for sample_type 0x800
        test child finished with -1
        ---- end ----
        Sample parsing: FAILED!
      
      After:
      
         27: Sample parsing                                                  :
        --- start ---
        test child forked, pid 63293
        test child finished with 0
        ---- end ----
        Sample parsing: Ok
      Signed-off-by: default avatarSandipan Das <sandipan.das@amd.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ananth Narayan <ananth.narayan@amd.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Santosh Shukla <santosh.shukla@amd.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: x86@kernel.org
      Link: https://lore.kernel.org/r/56e272583552526e999ba0b536ac009ae3613966.1675333809.git.sandipan.das@amd.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6ade6c64
    • Namhyung Kim's avatar
      perf script: Add 'cgroup' field for output · 3fd7a168
      Namhyung Kim authored
      There's no field for the cgroup, let's add one.  To do that, users need to
      specify --all-cgroup option for perf record to capture the cgroup info.
      
        $ perf record --all-cgroups -- true
      
        $ perf script -F comm,pid,cgroup
                  true 337112  /user.slice/user-657345.slice/user@657345.service/...
                  true 337112  /user.slice/user-657345.slice/user@657345.service/...
                  true 337112  /user.slice/user-657345.slice/user@657345.service/...
                  true 337112  /user.slice/user-657345.slice/user@657345.service/...
      
      If it's recorded without the --all-cgroups, it'd complain.
      
        $ perf script -F comm,pid,cgroup
        Samples for 'cycles:u' event do not have CGROUP attribute set. Cannot print 'cgroup' field.
        Hint: run 'perf record --all-cgroups ...'
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      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: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20230126213610.3381147-1-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3fd7a168
  20. 23 Jan, 2023 1 commit
  21. 20 Dec, 2022 1 commit
  22. 14 Dec, 2022 1 commit
    • Ian Rogers's avatar
      perf build: Use libtraceevent from the system · 378ef0f5
      Ian Rogers authored
      Remove the LIBTRACEEVENT_DYNAMIC and LIBTRACEFS_DYNAMIC make command
      line variables.
      
      If libtraceevent isn't installed or NO_LIBTRACEEVENT=1 is passed to the
      build, don't compile in libtraceevent and libtracefs support.
      
      This also disables CONFIG_TRACE that controls "perf trace".
      
      CONFIG_LIBTRACEEVENT is used to control enablement in Build/Makefiles,
      HAVE_LIBTRACEEVENT is used in C code.
      
      Without HAVE_LIBTRACEEVENT tracepoints are disabled and as such the
      commands kmem, kwork, lock, sched and timechart are removed.  The
      majority of commands continue to work including "perf test".
      
      Committer notes:
      
      Fixed up a tools/perf/util/Build reject and added:
      
        #include <traceevent/event-parse.h>
      
      to tools/perf/util/scripting-engines/trace-event-perl.c.
      
      Committer testing:
      
        $ rpm -qi libtraceevent-devel
        Name        : libtraceevent-devel
        Version     : 1.5.3
        Release     : 2.fc36
        Architecture: x86_64
        Install Date: Mon 25 Jul 2022 03:20:19 PM -03
        Group       : Unspecified
        Size        : 27728
        License     : LGPLv2+ and GPLv2+
        Signature   : RSA/SHA256, Fri 15 Apr 2022 02:11:58 PM -03, Key ID 999f7cbf38ab71f4
        Source RPM  : libtraceevent-1.5.3-2.fc36.src.rpm
        Build Date  : Fri 15 Apr 2022 10:57:01 AM -03
        Build Host  : buildvm-x86-05.iad2.fedoraproject.org
        Packager    : Fedora Project
        Vendor      : Fedora Project
        URL         : https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/
        Bug URL     : https://bugz.fedoraproject.org/libtraceevent
        Summary     : Development headers of libtraceevent
        Description :
        Development headers of libtraceevent-libs
        $
      
      Default build:
      
        $ ldd ~/bin/perf | grep tracee
        	libtraceevent.so.1 => /lib64/libtraceevent.so.1 (0x00007f1dcaf8f000)
        $
      
        # perf trace -e sched:* --max-events 10
             0.000 migration/0/17 sched:sched_migrate_task(comm: "", pid: 1603763 (perf), prio: 120, dest_cpu: 1)
             0.005 migration/0/17 sched:sched_wake_idle_without_ipi(cpu: 1)
             0.011 migration/0/17 sched:sched_switch(prev_comm: "", prev_pid: 17 (migration/0), prev_state: 1, next_comm: "", next_prio: 120)
             1.173 :0/0 sched:sched_wakeup(comm: "", pid: 3138 (gnome-terminal-), prio: 120)
             1.180 :0/0 sched:sched_switch(prev_comm: "", prev_prio: 120, next_comm: "", next_pid: 3138 (gnome-terminal-), next_prio: 120)
             0.156 migration/1/21 sched:sched_migrate_task(comm: "", pid: 1603763 (perf), prio: 120, orig_cpu: 1, dest_cpu: 2)
             0.160 migration/1/21 sched:sched_wake_idle_without_ipi(cpu: 2)
             0.166 migration/1/21 sched:sched_switch(prev_comm: "", prev_pid: 21 (migration/1), prev_state: 1, next_comm: "", next_prio: 120)
             1.183 :0/0 sched:sched_wakeup(comm: "", pid: 1602985 (kworker/u16:0-f), prio: 120, target_cpu: 1)
             1.186 :0/0 sched:sched_switch(prev_comm: "", prev_prio: 120, next_comm: "", next_pid: 1602985 (kworker/u16:0-f), next_prio: 120)
        #
      
      Had to tweak tools/perf/util/setup.py to make sure the python binding
      shared object links with libtraceevent if -DHAVE_LIBTRACEEVENT is
      present in CFLAGS.
      
      Building with NO_LIBTRACEEVENT=1 uncovered some more build failures:
      
      - Make building of data-convert-bt.c to CONFIG_LIBTRACEEVENT=y
      
      - perf-$(CONFIG_LIBTRACEEVENT) += scripts/
      
      - bpf_kwork.o needs also to be dependent on CONFIG_LIBTRACEEVENT=y
      
      - The python binding needed some fixups and util/trace-event.c can't be
        built and linked with the python binding shared object, so remove it
        in tools/perf/util/setup.py and exclude it from the list of
        dependencies in the python/perf.so Makefile.perf target.
      
      Building without libtraceevent-devel installed uncovered more build
      failures:
      
      - The python binding tools/perf/util/python.c was assuming that
        traceevent/parse-events.h was always available, which was the case
        when we defaulted to using the in-kernel tools/lib/traceevent/ files,
        now we need to enclose it under ifdef HAVE_LIBTRACEEVENT, just like
        the other parts of it that deal with tracepoints.
      
      - We have to ifdef the rules in the Build files with
        CONFIG_LIBTRACEEVENT=y to build builtin-trace.c and
        tools/perf/trace/beauty/ as we only ifdef setting CONFIG_TRACE=y when
        setting NO_LIBTRACEEVENT=1 in the make command line, not when we don't
        detect libtraceevent-devel installed in the system. Simplification here
        to avoid these two ways of disabling builtin-trace.c and not having
        CONFIG_TRACE=y when libtraceevent-devel isn't installed is the clean
        way.
      
      From Athira:
      
      <quote>
      tools/perf/arch/powerpc/util/Build
      -perf-y += kvm-stat.o
      +perf-$(CONFIG_LIBTRACEEVENT) += kvm-stat.o
      </quote>
      
      Then, ditto for arm64 and s390, detected by container cross build tests.
      
      - s/390 uses test__checkevent_tracepoint() that is now only available if
        HAVE_LIBTRACEEVENT is defined, enclose the callsite with ifder HAVE_LIBTRACEEVENT.
      
      Also from Athira:
      
      <quote>
      With this change, I could successfully compile in these environment:
      - Without libtraceevent-devel installed
      - With libtraceevent-devel installed
      - With “make NO_LIBTRACEEVENT=1”
      </quote>
      
      Then, finally rename CONFIG_TRACEEVENT to CONFIG_LIBTRACEEVENT for
      consistency with other libraries detected in tools/perf/.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Tested-by: default avatarAthira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: bpf@vger.kernel.org
      Link: http://lore.kernel.org/lkml/20221205225940.3079667-3-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      378ef0f5
  23. 27 Oct, 2022 1 commit
    • Namhyung Kim's avatar
      perf stat: Allocate evsel->stats->aggr properly · 1f297a6e
      Namhyung Kim authored
      The perf_stat_config.aggr_map should have a correct size of the
      aggregation map.  Use it to allocate aggr_counts.
      
      Also AGGR_NONE with per-core events can be tricky because it doesn't
      aggreate basically but it needs to do so for per-core events only.
      So only per-core evsels will have stats->aggr data.
      
      Note that other caller of evlist__alloc_stat() might not have
      stat_config or aggr_map.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20221018020227.85905-9-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1f297a6e
  24. 06 Oct, 2022 2 commits
  25. 04 Oct, 2022 1 commit
    • Anshuman Khandual's avatar
      perf branch: Extend branch type classification · 0ddea8e2
      Anshuman Khandual authored
      This updates the perf tool with generic branch type classification with new
      ABI extender place holder i.e PERF_BR_EXTEND_ABI, the new 4 bit branch type
      field i.e perf_branch_entry.new_type, new generic page fault related branch
      types and some arch specific branch types as added earlier in the kernel.
      
      Committer note:
      
      Add an extra entry to the branch_type_name array to cope with
      PERF_BR_EXTEND_ABI, to address build warnings on some compiler/systems,
      like:
      
        75     8.89 ubuntu:20.04-x-powerpc64el    : FAIL gcc version 10.3.0 (Ubuntu 10.3.0-1ubuntu1~20.04)
              inlined from 'branch_type_stat_display' at util/branch.c:152:4:
          /usr/powerpc64le-linux-gnu/include/bits/stdio2.h:100:10: error: '%8s' directive argument is null [-Werror=format-overflow=]
            100 |   return __fprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt,
                |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            101 |    __va_arg_pack ());
                |    ~~~~~~~~~~~~~~~~~
      Signed-off-by: default avatarAnshuman Khandual <anshuman.khandual@arm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.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>
      Cc: Robin Murphy <robin.murphy@arm.com>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Deacon <will@kernel.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20220824044822.70230-7-anshuman.khandual@arm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0ddea8e2
  26. 08 Sep, 2022 1 commit
    • Zhengjun Xing's avatar
      perf script: Fix Cannot print 'iregs' field for hybrid systems · 82b2425f
      Zhengjun Xing authored
      Commit b91e5492 ("perf record: Add a dummy event on hybrid
      systems to collect metadata records") adds a dummy event on hybrid
      systems to fix the symbol "unknown" issue when the workload is created
      in a P-core but runs on an E-core. The added dummy event will cause
      "perf script -F iregs" to fail. Dummy events do not have "iregs"
      attribute set, so when we do evsel__check_attr, the "iregs" attribute
      check will fail, so the issue happened.
      
      The following commit [1] has fixed a similar issue by skipping the attr
      check for the dummy event because it does not have any samples anyway. It
      works okay for the normal mode, but the issue still happened when running
      the test in the pipe mode. In the pipe mode, it calls process_attr() which
      still checks the attr for the dummy event. This commit fixed the issue by
      skipping the attr check for the dummy event in the API evsel__check_attr,
      Otherwise, we have to patch everywhere when evsel__check_attr() is called.
      
      Before:
      
        #./perf record -o - --intr-regs=di,r8,dx,cx -e br_inst_retired.near_call:p -c 1000 --per-thread true 2>/dev/null|./perf script -F iregs |head -5
        Samples for 'dummy:HG' event do not have IREGS attribute set. Cannot print 'iregs' field.
        0x120 [0x90]: failed to process type: 64
        #
      
      After:
      
        # ./perf record -o - --intr-regs=di,r8,dx,cx -e br_inst_retired.near_call:p -c 1000 --per-thread true 2>/dev/null|./perf script -F iregs |head -5
        ABI:2    CX:0x55b8efa87000    DX:0x55b8efa7e000    DI:0xffffba5e625efbb0    R8:0xffff90e51f8ae100
        ABI:2    CX:0x7f1dae1e4000    DX:0xd0    DI:0xffff90e18c675ac0    R8:0x71
        ABI:2    CX:0xcc0    DX:0x1    DI:0xffff90e199880240    R8:0x0
        ABI:2    CX:0xffff90e180dd7500    DX:0xffff90e180dd7500    DI:0xffff90e180043500    R8:0x1
        ABI:2    CX:0x50    DX:0xffff90e18c583bd0    DI:0xffff90e1998803c0    R8:0x58
        #
      
      [1]https://lore.kernel.org/lkml/20220831124041.219925-1-jolsa@kernel.org/
      
      Fixes: b91e5492 ("perf record: Add a dummy event on hybrid systems to collect metadata records")
      Suggested-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarXing Zhengjun <zhengjun.xing@linux.intel.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20220908070030.3455164-1-zhengjun.xing@linux.intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      82b2425f
  27. 31 Aug, 2022 1 commit
  28. 12 Aug, 2022 1 commit
  29. 20 Jul, 2022 1 commit