1. 13 1月, 2022 2 次提交
    • I
      perf script: Fix flipped index and cpu · b57af1b4
      Ian Rogers 提交于
      perf_counts are accessed by the densely packed index.
      Signed-off-by: NIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: John Garry <john.garry@huawei.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: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Clarke <pc@us.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Vineet Singh <vineet.singh@intel.com>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: zhengjun.xing@intel.com
      Link: https://lore.kernel.org/r/20220105061351.120843-47-irogers@google.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b57af1b4
    • I
      perf script: Use for each cpu to aid readability · f9551b3f
      Ian Rogers 提交于
      Use perf_cpu_map__for_each_cpu() to help with readability.
      Signed-off-by: NIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: John Garry <john.garry@huawei.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: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Clarke <pc@us.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Vineet Singh <vineet.singh@intel.com>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: zhengjun.xing@intel.com
      Link: https://lore.kernel.org/r/20220105061351.120843-33-irogers@google.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f9551b3f
  2. 29 12月, 2021 1 次提交
  3. 22 12月, 2021 2 次提交
  4. 16 12月, 2021 1 次提交
    • G
      perf arch: Support register names from all archs · 83869019
      German Gomez 提交于
      When reading a perf.data file with register values, there is a mismatch
      between the names and the values of the registers because the tool is
      built using only the register names from the local architecture.
      
      Reading a perf.data file that was recorded on ARM64, gives the following
      erroneous output on an X86 machine:
      
        # perf report -i perf_arm64.data -D
        [...]
        24661932634451 0x698 [0x21d0]: PERF_RECORD_SAMPLE(IP, 0x1): 43239/43239: 0xffffc5be8f100f98 period: 1 addr: 0
        ... user regs: mask 0x1ffffffff ABI 64-bit
        .... AX    0x0000ffffd1515817
        .... BX    0x0000ffffd1515480
        .... CX    0x0000aaaadabf6c80
        .... DX    0x000000000000002e
        .... SI    0x0000000040100401
        .... DI    0x0040600200000080
        .... BP    0x0000ffffd1510e10
        .... SP    0x0000000000000000
        .... IP    0x00000000000000dd
        .... FLAGS 0x0000ffffd1510cd0
        .... CS    0x0000000000000000
        .... SS    0x0000000000000030
        .... DS    0x0000ffffa569a208
        .... ES    0x0000000000000000
        .... FS    0x0000000000000000
        .... GS    0x0000000000000000
        .... R8    0x0000aaaad3de9650
        .... R9    0x0000ffffa57397f0
        .... R10   0x0000000000000001
        .... R11   0x0000ffffa57fd000
        .... R12   0x0000ffffd1515817
        .... R13   0x0000ffffd1515480
        .... R14   0x0000aaaadabf6c80
        .... R15   0x0000000000000000
        .... unknown 0x0000000000000001
        .... unknown 0x0000000000000000
        .... unknown 0x0000000000000000
        .... unknown 0x0000000000000000
        .... unknown 0x0000000000000000
        .... unknown 0x0000ffffd1510d90
        .... unknown 0x0000ffffa5739b90
        .... unknown 0x0000ffffd1510d80
        .... XMM0  0x0000ffffa57392c8
         ... thread: perf-exec:43239
         ...... dso: [kernel.kallsyms]
      
      As can be seen, the register names correspond to X86 registers, even
      though the perf.data file was recorded on an ARM64 system. After this
      patch, the output of the command displays the correct register names:
      
        # perf report -i perf_arm64.data -D
        [...]
        24661932634451 0x698 [0x21d0]: PERF_RECORD_SAMPLE(IP, 0x1): 43239/43239: 0xffffc5be8f100f98 period: 1 addr: 0
        ... user regs: mask 0x1ffffffff ABI 64-bit
        .... x0    0x0000ffffd1515817
        .... x1    0x0000ffffd1515480
        .... x2    0x0000aaaadabf6c80
        .... x3    0x000000000000002e
        .... x4    0x0000000040100401
        .... x5    0x0040600200000080
        .... x6    0x0000ffffd1510e10
        .... x7    0x0000000000000000
        .... x8    0x00000000000000dd
        .... x9    0x0000ffffd1510cd0
        .... x10   0x0000000000000000
        .... x11   0x0000000000000030
        .... x12   0x0000ffffa569a208
        .... x13   0x0000000000000000
        .... x14   0x0000000000000000
        .... x15   0x0000000000000000
        .... x16   0x0000aaaad3de9650
        .... x17   0x0000ffffa57397f0
        .... x18   0x0000000000000001
        .... x19   0x0000ffffa57fd000
        .... x20   0x0000ffffd1515817
        .... x21   0x0000ffffd1515480
        .... x22   0x0000aaaadabf6c80
        .... x23   0x0000000000000000
        .... x24   0x0000000000000001
        .... x25   0x0000000000000000
        .... x26   0x0000000000000000
        .... x27   0x0000000000000000
        .... x28   0x0000000000000000
        .... x29   0x0000ffffd1510d90
        .... lr    0x0000ffffa5739b90
        .... sp    0x0000ffffd1510d80
        .... pc    0x0000ffffa57392c8
         ... thread: perf-exec:43239
         ...... dso: [kernel.kallsyms]
      
      Tester comments:
      
      Athira reports:
      
      "Looks good to me. Tested this patchset in powerpc by capturing regs in
      powerpc and doing perf report to read the data from x86."
      Reported-by: NAlexandre Truong <alexandre.truong@arm.com>
      Reviewed-by: NAthira Jajeev <atrajeev@linux.vnet.ibm.com>
      Signed-off-by: NGerman Gomez <german.gomez@arm.com>
      Tested-by: NAthira Jajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Will Deacon <will@kernel.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-csky@vger.kernel.org
      Cc: linux-riscv@lists.infradead.org
      Link: https://lore.kernel.org/r/20211207180653.1147374-4-german.gomez@arm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      83869019
  5. 07 11月, 2021 1 次提交
  6. 31 10月, 2021 2 次提交
  7. 28 10月, 2021 1 次提交
  8. 19 9月, 2021 1 次提交
    • A
      perf script: Fix ip display when type != attr->type · ff6f41fb
      Adrian Hunter 提交于
      set_print_ip_opts() was not being called when type != attr->type
      because there is not a one-to-one relationship between output types
      and attr->type. That resulted in ip not printing.
      
      The attr_type() function is removed, and the match of attr->type to
      output type is corrected.
      
      Example on ADL using taskset to select an atom cpu:
      
       # perf record -e cpu_atom/cpu-cycles/ taskset 0x1000 uname
       Linux
       [ perf record: Woken up 1 times to write data ]
       [ perf record: Captured and wrote 0.003 MB perf.data (7 samples) ]
      
       Before:
      
        # perf script | head
               taskset   428 [-01] 10394.179041:          1 cpu_atom/cpu-cycles/:
               taskset   428 [-01] 10394.179043:          1 cpu_atom/cpu-cycles/:
               taskset   428 [-01] 10394.179044:         11 cpu_atom/cpu-cycles/:
               taskset   428 [-01] 10394.179045:        407 cpu_atom/cpu-cycles/:
               taskset   428 [-01] 10394.179046:      16789 cpu_atom/cpu-cycles/:
               taskset   428 [-01] 10394.179052:     676300 cpu_atom/cpu-cycles/:
                 uname   428 [-01] 10394.179278:    4079859 cpu_atom/cpu-cycles/:
      
       After:
      
        # perf script | head
               taskset   428 10394.179041:          1 cpu_atom/cpu-cycles/:  ffffffff95a0bb97 __intel_pmu_enable_all.constprop.48+0x47 ([kernel.kallsyms])
               taskset   428 10394.179043:          1 cpu_atom/cpu-cycles/:  ffffffff95a0bb97 __intel_pmu_enable_all.constprop.48+0x47 ([kernel.kallsyms])
               taskset   428 10394.179044:         11 cpu_atom/cpu-cycles/:  ffffffff95a0bb97 __intel_pmu_enable_all.constprop.48+0x47 ([kernel.kallsyms])
               taskset   428 10394.179045:        407 cpu_atom/cpu-cycles/:  ffffffff95a0bb97 __intel_pmu_enable_all.constprop.48+0x47 ([kernel.kallsyms])
               taskset   428 10394.179046:      16789 cpu_atom/cpu-cycles/:  ffffffff95a0bb97 __intel_pmu_enable_all.constprop.48+0x47 ([kernel.kallsyms])
               taskset   428 10394.179052:     676300 cpu_atom/cpu-cycles/:      7f829ef73800 cfree+0x0 (/lib/libc-2.32.so)
                 uname   428 10394.179278:    4079859 cpu_atom/cpu-cycles/:  ffffffff95bae912 vma_interval_tree_remove+0x1f2 ([kernel.kallsyms])
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Reviewed-by: NKan Liang <kan.liang@linux.intel.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lore.kernel.org/lkml/20210911133053.15682-1-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      ff6f41fb
  9. 03 9月, 2021 1 次提交
  10. 11 8月, 2021 1 次提交
  11. 02 8月, 2021 1 次提交
  12. 16 7月, 2021 2 次提交
  13. 10 7月, 2021 1 次提交
    • J
      libperf: Move 'leader' from tools/perf to perf_evsel::leader · fba7c866
      Jiri Olsa 提交于
      Move evsel::leader to perf_evsel::leader, so we can move the group
      interface to libperf.
      
      Also add several evsel helpers to ease up the transition:
      
        struct evsel *evsel__leader(struct evsel *evsel);
        - get leader evsel
      
        bool evsel__has_leader(struct evsel *evsel, struct evsel *leader);
        - true if evsel has leader as leader
      
        bool evsel__is_leader(struct evsel *evsel);
        - true if evsel is itw own leader
      
        void evsel__set_leader(struct evsel *evsel, struct evsel *leader);
        - set leader for evsel
      
      Committer notes:
      
      Fix this when building with 'make BUILD_BPF_SKEL=1'
      
        tools/perf/util/bpf_counter.c
      
        -       if (evsel->leader->core.nr_members > 1) {
        +       if (evsel->core.leader->nr_members > 1) {
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Requested-by: NShunsuke Nakamura <nakamura.shun@fujitsu.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/20210706151704.73662-4-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      fba7c866
  14. 02 7月, 2021 4 次提交
  15. 23 6月, 2021 3 次提交
  16. 01 6月, 2021 2 次提交
  17. 25 5月, 2021 4 次提交
  18. 24 3月, 2021 1 次提交
  19. 09 3月, 2021 1 次提交
  20. 19 2月, 2021 2 次提交
    • A
      perf script: Add branch types for VM-Entry and VM-Exit · c025d46c
      Adrian Hunter 提交于
      In preparation to support Intel PT decoding of virtual machine traces, add
      branch types for VM-Entry and VM-Exit.
      
      Note they are both treated as "calls" because the VM-Exit transfers control
      to a different address.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: NAndi Kleen <ak@linux.intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: https://lore.kernel.org/r/20210218095801.19576-2-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      c025d46c
    • A
      perf intel-pt: Add PSB events · c840cbfe
      Adrian Hunter 提交于
      Emitting a PSB+ can cause a CPU a slight delay. When doing timing analysis
      of code with Intel PT, it is useful to know if a timing bubble was caused
      by Intel PT or not. Add reporting of PSB events via perf script. PSB
      events are printed with the existing itrace 'p' option which also prints
      power and frequency changes. The PSB event contains the trace offset at
      which the PSB occurs, to allow easy reference back to the PSB+ packets.
      
      The PSB event timestamp is always the timestamp from the PSB+ TSC
      packet, and the ip is always the address from the PSB+ FUP packet.
      
      The code changes are non-trivial because the decoder must walk to the
      PSB+ FUP address before outputting the PSB event.
      
      Example:
      
        $ perf record -e intel_pt/cyc,psb_period=0/u uname
        Linux
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.046 MB perf.data ]
        $ perf script --itrace=p --ns
           perf 17981 [006] 25617.510820383:  psb:  psb offs: 0                               0 [unknown] ([unknown])
           perf 17981 [006] 25617.510820383:  cbr:  cbr: 42 freq: 4219 MHz (156%)             0 [unknown] ([unknown])
          uname 17981 [006] 25617.510889753:  psb:  psb offs: 0xb50                7f78c12a212e __GI___tunables_init+0xee (/usr/lib/x86_64-linux-gnu/ld-2.31.so)
          uname 17981 [006] 25617.510899162:  psb:  psb offs: 0x12d0               7f78c128af1c dl_main+0x93c (/usr/lib/x86_64-linux-gnu/ld-2.31.so)
          uname 17981 [006] 25617.510939242:  psb:  psb offs: 0x1a50               7f78c128eefc _dl_map_object_from_fd+0x13c (/usr/lib/x86_64-linux-gnu/ld-2.31.so)
          uname 17981 [006] 25617.510981274:  psb:  psb offs: 0x21c8               7f78c1296307 _dl_relocate_object+0x927 (/usr/lib/x86_64-linux-gnu/ld-2.31.so)
          uname 17981 [006] 25617.510993034:  psb:  psb offs: 0x2948               7f78c12940e4 _dl_lookup_symbol_x+0x14 (/usr/lib/x86_64-linux-gnu/ld-2.31.so)
          uname 17981 [006] 25617.511003871:  psb:  psb offs: 0x30c8               7f78c12937b3 do_lookup_x+0x2f3 (/usr/lib/x86_64-linux-gnu/ld-2.31.so)
          uname 17981 [006] 25617.511019854:  psb:  psb offs: 0x3850               7f78c1295eed _dl_relocate_object+0x50d (/usr/lib/x86_64-linux-gnu/ld-2.31.so)
          uname 17981 [006] 25617.511029015:  psb:  psb offs: 0x4390               7f78c12a855a strcmp+0xf6a (/usr/lib/x86_64-linux-gnu/ld-2.31.so)
          uname 17981 [006] 25617.511064876:  psb:  psb offs: 0x4b10                          0 [unknown] ([unknown])
          uname 17981 [006] 25617.511080762:  psb:  psb offs: 0x5290               7f78c11db53d _dl_addr+0x13d (/usr/lib/x86_64-linux-gnu/libc-2.31.so)
          uname 17981 [006] 25617.511086035:  psb:  psb offs: 0x5a08               7f78c11db538 _dl_addr+0x138 (/usr/lib/x86_64-linux-gnu/libc-2.31.so)
          uname 17981 [006] 25617.511091381:  psb:  psb offs: 0x6190               7f78c11db534 _dl_addr+0x134 (/usr/lib/x86_64-linux-gnu/libc-2.31.so)
          uname 17981 [006] 25617.511096681:  psb:  psb offs: 0x6910               7f78c11db4c3 _dl_addr+0xc3 (/usr/lib/x86_64-linux-gnu/libc-2.31.so)
          uname 17981 [006] 25617.511119520:  psb:  psb offs: 0x7090               7f78c10ada5e _nl_intern_locale_data+0x12e (/usr/lib/x86_64-linux-gnu/libc-2.31.so)
          uname 17981 [006] 25617.511126584:  psb:  psb offs: 0x7818               7f78c10ada50 _nl_intern_locale_data+0x120 (/usr/lib/x86_64-linux-gnu/libc-2.31.so)
          uname 17981 [006] 25617.511132775:  psb:  psb offs: 0x8358               7f78c10c20c0 getenv+0xa0 (/usr/lib/x86_64-linux-gnu/libc-2.31.so)
          uname 17981 [006] 25617.511134598:  psb:  psb offs: 0x8ad0               7f78c10ada09 _nl_intern_locale_data+0xd9 (/usr/lib/x86_64-linux-gnu/libc-2.31.so)
          uname 17981 [006] 25617.511135685:  psb:  psb offs: 0x9258               7f78c10ada50 _nl_intern_locale_data+0x120 (/usr/lib/x86_64-linux-gnu/libc-2.31.so)
          uname 17981 [006] 25617.511138322:  psb:  psb offs: 0x99d0               7f78c11fffd9 __strncmp_avx2+0x39 (/usr/lib/x86_64-linux-gnu/libc-2.31.so)
          uname 17981 [006] 25617.511158907:  psb:  psb offs: 0xa150                          0 [unknown] ([unknown])
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Reviewed-by: NAndi Kleen <ak@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: https://lore.kernel.org/r/20210205175350.23817-5-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      c840cbfe
  21. 10 2月, 2021 1 次提交
  22. 09 2月, 2021 1 次提交
    • J
      perf script: Support filtering by hex address · 61d9fc44
      Jin Yao 提交于
      'perf script' supports '-S' or '--symbol' options to only list the
      records for these symbols. A symbol is typically a name or hex address.
      If it's hex address, it is the start address of one symbol.
      
      While it would be useful if we can filter trace records by any hex
      address (not only the start address of symbol). So now we support
      filtering trace records by more conditions, such as:
      
      - symbol name
      - start address of symbol
      - any hexadecimal address
      - address range
      
      The comparison order is defined as:
      
      1. symbol name comparison
      2. symbol start address comparison.
      3. any hexadecimal address comparison.
      4. address range comparison.
      
      The idea is if we can get a valid address from -S list, we add the
      address to addr_list for address comparison otherwise we still leave
      it to sym_list for symbol comparison.
      
      Some examples:
      
        root@kbl-ppc:~# ./perf script -S ffffffff9a477308
                  perf  8562 [000] 347303.578858:          1   cycles:  ffffffff9a477308 native_write_msr+0x8 ([kernel.kallsyms])
                  perf  8562 [000] 347303.578860:          1   cycles:  ffffffff9a477308 native_write_msr+0x8 ([kernel.kallsyms])
                  perf  8562 [000] 347303.578861:         11   cycles:  ffffffff9a477308 native_write_msr+0x8 ([kernel.kallsyms])
                  perf  8562 [001] 347303.578903:          1   cycles:  ffffffff9a477308 native_write_msr+0x8 ([kernel.kallsyms])
                  perf  8562 [001] 347303.578905:          1   cycles:  ffffffff9a477308 native_write_msr+0x8 ([kernel.kallsyms])
                  perf  8562 [001] 347303.578906:         15   cycles:  ffffffff9a477308 native_write_msr+0x8 ([kernel.kallsyms])
                  perf  8562 [002] 347303.578952:          1   cycles:  ffffffff9a477308 native_write_msr+0x8 ([kernel.kallsyms])
                  perf  8562 [002] 347303.578953:          1   cycles:  ffffffff9a477308 native_write_msr+0x8 ([kernel.kallsyms])
      
      Filter the traced records by hex address ffffffff9a477308.
      
        root@kbl-ppc:~# ./perf script -S ffffffff9a4dd4ce,ffffffff9a4d2de9,ffffffff9a6bf9f4
                  perf  8562 [001] 347303.578911:     311706   cycles:  ffffffff9a6bf9f4 __kmalloc_node+0x204 ([kernel.kallsyms])
                  perf  8562 [002] 347303.578960:     354477   cycles:  ffffffff9a4d2de9 sched_setaffinity+0x49 ([kernel.kallsyms])
                  perf  8562 [003] 347303.579015:     450958   cycles:  ffffffff9a4dd4ce dequeue_task_fair+0x1ae ([kernel.kallsyms])
      
      Filter the traced records by hex address ffffffff9a4dd4ce, ffffffff9a4d2de9, ffffffff9a6bf9f4.
      
        root@kbl-ppc:~# ./perf script -S ffffffff9a477309 --addr-range 16
                  perf  8562 [000] 347303.578863:        291   cycles:  ffffffff9a47730a native_write_msr+0xa ([kernel.kallsyms])
                  perf  8562 [001] 347303.578907:        411   cycles:  ffffffff9a47730a native_write_msr+0xa ([kernel.kallsyms])
                  perf  8562 [002] 347303.578956:        462   cycles:  ffffffff9a47730f native_write_msr+0xf ([kernel.kallsyms])
                  perf  8562 [003] 347303.579010:        497   cycles:  ffffffff9a47730f native_write_msr+0xf ([kernel.kallsyms])
                  perf  8562 [004] 347303.579059:        429   cycles:  ffffffff9a47730f native_write_msr+0xf ([kernel.kallsyms])
                  perf  8562 [005] 347303.579109:        408   cycles:  ffffffff9a47730a native_write_msr+0xa ([kernel.kallsyms])
                  perf  8562 [006] 347303.579159:        460   cycles:  ffffffff9a47730f native_write_msr+0xf ([kernel.kallsyms])
                  perf  8562 [007] 347303.579213:        436   cycles:  ffffffff9a47730f native_write_msr+0xf ([kernel.kallsyms])
      
      Filter the traced records from address range [ffffffff9a477309, ffffffff9a477309 + 15].
      
        root@kbl-ppc:~# ./perf script -S "ffffffff9b163046,rcu_nmi_exit"
                  perf  8562 [004] 347303.579060:      12013   cycles:  ffffffff9b163046 exc_nmi+0x166 ([kernel.kallsyms])
                  perf  8562 [007] 347303.579214:      12138   cycles:  ffffffff9b165944 rcu_nmi_exit+0x34 ([kernel.kallsyms])
      
      Filter by address + symbol
      Signed-off-by: NJin Yao <yao.jin@linux.intel.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jin Yao <yao.jin@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/20210207080935.31784-2-yao.jin@linux.intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      61d9fc44
  23. 04 2月, 2021 1 次提交
    • J
      perf script: Support DSO filter like in other perf tools · 4b799a9b
      Jin Yao 提交于
      Other perf tool builtins already supported a DSO filter.
      
      For example:
      
        $ perf report --dsos a,b,c
      
      which only considers symbols in these dsos.
      
      Now the DSO filter is supported in 'perf script':
      
        root@kbl-ppc:~# ./perf script --dsos "[kernel.kallsyms]"
                  perf 18123 [000] 6142863.075104:          1   cycles:  ffffffff9ca77308 native_write_msr+0x8 ([kernel.kallsyms])
                  perf 18123 [000] 6142863.075107:          1   cycles:  ffffffff9ca77308 native_write_msr+0x8 ([kernel.kallsyms])
                  perf 18123 [000] 6142863.075108:         10   cycles:  ffffffff9ca77308 native_write_msr+0x8 ([kernel.kallsyms])
                  perf 18123 [000] 6142863.075109:        273   cycles:  ffffffff9ca7730a native_write_msr+0xa ([kernel.kallsyms])
                  perf 18123 [000] 6142863.075110:       7684   cycles:  ffffffff9ca3c9c0 native_sched_clock+0x50 ([kernel.kallsyms])
                  perf 18123 [000] 6142863.075112:     213017   cycles:  ffffffff9d765a92 syscall_exit_to_user_mode+0x32 ([kernel.kallsyms])
                  perf 18123 [001] 6142863.075156:          1   cycles:  ffffffff9ca77308 native_write_msr+0x8 ([kernel.kallsyms])
                  perf 18123 [001] 6142863.075158:          1   cycles:  ffffffff9ca77308 native_write_msr+0x8 ([kernel.kallsyms])
                  perf 18123 [001] 6142863.075159:         17   cycles:  ffffffff9ca77308 native_write_msr+0x8 ([kernel.kallsyms])
      
      Committer testing:
      
        $ perf script
                      ls 2364888 29303.010949:          1 cycles:u:  ffffffffa4bbc6a9 [unknown] ([unknown])
                      ls 2364888 29303.010957:          1 cycles:u:  ffffffffa429ef48 [unknown] ([unknown])
                      ls 2364888 29303.010961:          1 cycles:u:  ffffffffa4260133 [unknown] ([unknown])
                      ls 2364888 29303.010964:          5 cycles:u:  ffffffffa429efad [unknown] ([unknown])
                      ls 2364888 29303.010967:         41 cycles:u:  ffffffffa42a4586 [unknown] ([unknown])
                      ls 2364888 29303.010972:        435 cycles:u:  ffffffffa429efe0 [unknown] ([unknown])
                      ls 2364888 29303.010978:       5142 cycles:u:      7f9b95bc2abf __GI___tunables_init+0x11f (/usr/lib64/ld-2.32.so)
                      ls 2364888 29303.011006:      38551 cycles:u:  ffffffffa4290f61 [unknown] ([unknown])
                      ls 2364888 29303.011486:     238234 cycles:u:      7f9b95bb7741 _dl_relocate_object+0xa71 (/usr/lib64/ld-2.32.so)
                      ls 2364888 29303.011937:     415870 cycles:u:      7f9b95a1c80e __strcoll_l+0xe (/usr/lib64/libc-2.32.so)
        $
      
      Before:
      
        $ perf script --dsos /usr/lib64/libc-2.32.so |& head -5
          Error: unknown option `dsos'
      
         Usage: perf script [<options>]
            or: perf script [<options>] record <script> [<record-options>] <command>
            or: perf script [<options>] report <script> [script-args]
        $
      
      After:
      
        $ perf script --dsos /usr/lib64/libc-2.32.so
                      ls 2364888 29303.011937:     415870 cycles:u:      7f9b95a1c80e __strcoll_l+0xe (/usr/lib64/libc-2.32.so)
        $
      Signed-off-by: NJin Yao <yao.jin@linux.intel.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jin Yao <yao.jin@intel.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/20210124232750.19170-2-yao.jin@linux.intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      4b799a9b
  24. 22 1月, 2021 1 次提交
    • J
      perf script: Fix overrun issue for dynamically-allocated PMU type number · 8adc0a06
      Jin Yao 提交于
      When unpacking the event which is from dynamic PMU, the array
      output[OUTPUT_TYPE_MAX] may be overrun. For example, type number of SKL
      uncore_imc is 10, but OUTPUT_TYPE_MAX is 7 now (OUTPUT_TYPE_MAX =
      PERF_TYPE_MAX + 1).
      
      /* In builtin-script.c */
      
      process_event()
      {
              unsigned int type = output_type(attr->type);
      
              if (output[type].fields == 0)
                      return;
      }
      
      output[10] is overrun.
      
      Create a type OUTPUT_TYPE_OTHER for dynamic PMU events, then
      output_type(attr->type) will return OUTPUT_TYPE_OTHER here.
      
      Note that if PERF_TYPE_MAX ever changed, then there would be a conflict
      between old perf.data files that had a dynamicaliy allocated PMU number
      that would then be the same as a fixed PERF_TYPE.
      
      Example:
      
        # perf record --switch-events -C 0 -e "{cpu-clock,uncore_imc/data_reads/,uncore_imc/data_writes/}:SD" -a -- sleep 1
        # perf script
      
        Before:
               swapper     0 [000] 1479253.987551:     277766               cpu-clock:  ffffffff9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms])
               swapper     0 [000] 1479253.987797:     246709               cpu-clock:  ffffffff9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms])
               swapper     0 [000] 1479253.988127:     329883               cpu-clock:  ffffffff9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms])
               swapper     0 [000] 1479253.988273:     146393               cpu-clock:  ffffffff9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms])
               swapper     0 [000] 1479253.988523:     249977               cpu-clock:  ffffffff9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms])
               swapper     0 [000] 1479253.988877:     354090               cpu-clock:  ffffffff9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms])
               swapper     0 [000] 1479253.989023:     145940               cpu-clock:  ffffffff9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms])
               swapper     0 [000] 1479253.989383:     359856               cpu-clock:  ffffffff9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms])
               swapper     0 [000] 1479253.989523:     140082               cpu-clock:  ffffffff9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms])
      
        After:
               swapper     0 [000] 1397040.402011:     272384               cpu-clock:  ffffffff9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms])
               swapper     0 [000] 1397040.402011:       5396  uncore_imc/data_reads/:
               swapper     0 [000] 1397040.402011:        967 uncore_imc/data_writes/:
               swapper     0 [000] 1397040.402259:     249153               cpu-clock:  ffffffff9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms])
               swapper     0 [000] 1397040.402259:       7231  uncore_imc/data_reads/:
               swapper     0 [000] 1397040.402259:       1297 uncore_imc/data_writes/:
               swapper     0 [000] 1397040.402508:     249108               cpu-clock:  ffffffff9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms])
               swapper     0 [000] 1397040.402508:       5333  uncore_imc/data_reads/:
               swapper     0 [000] 1397040.402508:       1008 uncore_imc/data_writes/:
      Signed-off-by: NJin Yao <yao.jin@linux.intel.com>
      Acked-by: NAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: NJiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Kan Liang <kan.liang@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Link: https://lore.kernel.org/r/20201209005828.21302-1-yao.jin@linux.intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      8adc0a06
  25. 21 1月, 2021 1 次提交
  26. 20 12月, 2020 1 次提交