1. 04 6月, 2018 6 次提交
  2. 02 6月, 2018 2 次提交
    • A
      perf tools intel-pt-decoder: Update insn.h from the kernel sources · 0b3a1838
      Arnaldo Carvalho de Melo 提交于
      To pick up the changes in:
      
        ee6a7354 ("kprobes/x86: Prohibit probing on exception masking instructions")
      
      That doesn't entail changes in tooling, but silences this perf build
      warning:
      
        Warning: Intel PT: x86 instruction decoder header at 'tools/perf/util/intel-pt-decoder/insn.h' differs from latest version at 'arch/x86/include/asm/insn.h'
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-o3wfwjnyh7r8l0gi9q3y9f44@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0b3a1838
    • A
      perf trace beauty prctl: Default header_dir to cwd to work without parms · 0d690fc0
      Arnaldo Carvalho de Melo 提交于
      Useful when checking the effects of header synchs for the files it uses
      as a input to generate string tables, in retrospect this is how it
      should've been done from day 1, not requiring the header_dir to be set
      on the Makefile, will change everything later, so that the only parm,
      common to all generators will be $(srctree) and $(beauty_outdir).
      
      So, to see what it generates, just call it without any parameters:
      
        $ tools/perf/trace/beauty/prctl_option.sh
        static const char *prctl_options[] = {
      	  [1] = "SET_PDEATHSIG",
      	  [2] = "GET_PDEATHSIG",
      	  [3] = "GET_DUMPABLE",
      	  [4] = "SET_DUMPABLE",
      	  [5] = "GET_UNALIGN",
      	  [6] = "SET_UNALIGN",
      	  [7] = "GET_KEEPCAPS",
      	  [8] = "SET_KEEPCAPS",
      	  [9] = "GET_FPEMU",
      	  [10] = "SET_FPEMU",
      	  [11] = "GET_FPEXC",
      	  [12] = "SET_FPEXC",
      	  [13] = "GET_TIMING",
      	  [14] = "SET_TIMING",
      	  [15] = "SET_NAME",
      	  [16] = "GET_NAME",
      	  [19] = "GET_ENDIAN",
      	  [20] = "SET_ENDIAN",
      	  [21] = "GET_SECCOMP",
      	  [22] = "SET_SECCOMP",
      	  [25] = "GET_TSC",
      	  [26] = "SET_TSC",
      	  [27] = "GET_SECUREBITS",
      	  [28] = "SET_SECUREBITS",
      	  [29] = "SET_TIMERSLACK",
      	  [30] = "GET_TIMERSLACK",
      	  [35] = "SET_MM",
      	  [36] = "SET_CHILD_SUBREAPER",
      	  [37] = "GET_CHILD_SUBREAPER",
      	  [38] = "SET_NO_NEW_PRIVS",
      	  [39] = "GET_NO_NEW_PRIVS",
      	  [40] = "GET_TID_ADDRESS",
      	  [41] = "SET_THP_DISABLE",
      	  [42] = "GET_THP_DISABLE",
      	  [45] = "SET_FP_MODE",
      	  [46] = "GET_FP_MODE",
        };
        static const char *prctl_set_mm_options[] = {
      	  [1] = "START_CODE",
      	  [2] = "END_CODE",
      	  [3] = "START_DATA",
      	  [4] = "END_DATA",
      	  [5] = "START_STACK",
      	  [6] = "START_BRK",
      	  [7] = "BRK",
      	  [8] = "ARG_START",
      	  [9] = "ARG_END",
      	  [10] = "ENV_START",
      	  [11] = "ENV_END",
      	  [12] = "AUXV",
      	  [13] = "EXE_FILE",
      	  [14] = "MAP",
      	  [15] = "MAP_SIZE",
        };
        $
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-qtotspuztydjttxi7k6mec6h@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0d690fc0
  3. 31 5月, 2018 5 次提交
  4. 30 5月, 2018 2 次提交
    • T
      perf test: "Session topology" dumps core on s390 · d1211091
      Thomas Richter 提交于
      The "perf test Session topology" entry fails with core dump on s390. The root
      cause is a NULL pointer dereference in function check_cpu_topology() line 76
      (or line 82 without -v).
      
      The session->header.env.cpu variable is NULL because on s390 function
      process_cpu_topology() returns with error:
      
          socket_id number is too big.
          You may need to upgrade the perf tool.
      
      and releases the env.cpu variable via zfree() and sets it to NULL.
      
      Here is the gdb output:
      (gdb) n
      76                      pr_debug("CPU %d, core %d, socket %d\n", i,
      (gdb) n
      
      Program received signal SIGSEGV, Segmentation fault.
      0x00000000010f4d9e in check_cpu_topology (path=0x3ffffffd6c8
      	"/tmp/perf-test-J6CHMa", map=0x14a1740) at tests/topology.c:76
      76  pr_debug("CPU %d, core %d, socket %d\n", i,
      (gdb)
      
      Make sure the env.cpu variable is not used when its NULL.
      Test for NULL pointer and return TEST_SKIP if so.
      
      Output before:
      
        [root@p23lp27 perf]# ./perf test -F 39
        39: Session topology  :Segmentation fault (core dumped)
        [root@p23lp27 perf]#
      
      Output after:
      
        [root@p23lp27 perf]# ./perf test -vF 39
        39: Session topology                                      :
        --- start ---
        templ file: /tmp/perf-test-Ajx59D
        socket_id number is too big.You may need to upgrade the perf tool.
        ---- end ----
        Session topology: Skip
        [root@p23lp27 perf]#
      Signed-off-by: NThomas Richter <tmricht@linux.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Link: http://lkml.kernel.org/r/20180528073657.11743-1-tmricht@linux.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d1211091
    • K
      perf parse-events: Handle uncore event aliases in small groups properly · 369b2308
      Kan Liang 提交于
      Perf stat doesn't count the uncore event aliases from the same uncore
      block in a group, for example:
      
        perf stat -e '{unc_m_cas_count.all,unc_m_clockticks}' -a -I 1000
        #           time             counts unit events
             1.000447342      <not counted>      unc_m_cas_count.all
             1.000447342      <not counted>      unc_m_clockticks
             2.000740654      <not counted>      unc_m_cas_count.all
             2.000740654      <not counted>      unc_m_clockticks
      
      The output is very misleading. It gives a wrong impression that the
      uncore event doesn't work.
      
      An uncore block could be composed by several PMUs. An uncore event alias
      is a joint name which means the same event runs on all PMUs of a block.
      Perf doesn't support mixed events from different PMUs in the same group.
      It is wrong to put uncore event aliases in a big group.
      
      The right way is to split the big group into multiple small groups which
      only include the events from the same PMU.
      
      Only uncore event aliases from the same uncore block should be specially
      handled here. It doesn't make sense to mix the uncore events with other
      uncore events from different blocks or even core events in a group.
      
      With the patch:
        #           time             counts unit events
           1.001557653            140,833      unc_m_cas_count.all
           1.001557653      1,330,231,332      unc_m_clockticks
           2.002709483             85,007      unc_m_cas_count.all
           2.002709483      1,429,494,563      unc_m_clockticks
      Reported-by: NAndi Kleen <ak@linux.intel.com>
      Signed-off-by: NKan Liang <kan.liang@linux.intel.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Agustin Vega-Frias <agustinv@codeaurora.org>
      Cc: Ganapatrao Kulkarni <ganapatrao.kulkarni@cavium.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Shaokun Zhang <zhangshaokun@hisilicon.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Link: http://lkml.kernel.org/r/1525727623-19768-1-git-send-email-kan.liang@linux.intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      369b2308
  5. 23 5月, 2018 11 次提交
  6. 22 5月, 2018 7 次提交
  7. 19 5月, 2018 6 次提交
    • A
      perf tools: Fix kernel_start for PTI on x86 · 19422a9f
      Adrian Hunter 提交于
      Opickn x86_64, PTI entry trampolines are less than the start of kernel text,
      but still above 2^63. So leave kernel_start = 1ULL << 63 for x86_64.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Tested-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: x86@kernel.org
      Link: http://lkml.kernel.org/r/1526548928-20790-7-git-send-email-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      19422a9f
    • A
      perf machine: Add machine__is() to identify machine arch · dbbd34a6
      Adrian Hunter 提交于
      Add a function to identify the machine architecture.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Tested-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: x86@kernel.org
      Link: http://lkml.kernel.org/r/1526548928-20790-6-git-send-email-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      dbbd34a6
    • A
      perf bpf: Fixup include and examples install messages · cfc4033b
      Arnaldo Carvalho de Melo 提交于
      Before:
      
        INSTALL  lib
      install include/bpf/*.h '/home/acme/lib/include/perf/bpf'
        INSTALL  lib
      install examples/bpf/*.c '/home/acme/lib/examples/perf/bpf'
      
      After:
      
        INSTALL  lib
        INSTALL  include/bpf
        INSTALL  lib
        INSTALL  examples/bpf
      Reported-by: NIngo Molnar <mingo@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Fixes: dd8e4ead ("perf bpf: Add bpf.h to be used in eBPF proggies")
      Fixes: 8f12a2ff ("perf bpf: Add 'examples' directories")
      Link: https://lkml.kernel.org/n/tip-icljqe87e8pak8mu6mkki9d4@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      cfc4033b
    • J
      perf annotate: Create hotkey 'c' to show min/max cycles · 3e71fc03
      Jin Yao 提交于
      In the 'perf annotate' view, a new hotkey 'c' is created for showing the
      min/max cycles.
      
      For example, when press 'c', the annotate view is:
      
        Percent│ IPC     Cycle(min/max)
               │
               │
               │                             Disassembly of section .text:
               │
               │                             000000000003aab0 <random@@GLIBC_2.2.5>:
          8.22 │3.92                           sub    $0x18,%rsp
               │3.92                           mov    $0x1,%esi
               │3.92                           xor    %eax,%eax
               │3.92                           cmpl   $0x0,argp_program_version_hook@@G
               │3.92             1(2/1)      ↓ je     20
               │                               lock   cmpxchg %esi,__abort_msg@@GLIBC_P
               │                             ↓ jne    29
               │                             ↓ jmp    43
               │1.10                     20:   cmpxchg %esi,__abort_msg@@GLIBC_PRIVATE+
          8.93 │1.10             1(5/1)      ↓ je     43
      
      When press 'c' again, the annotate view is switched back:
      
        Percent│ IPC Cycle
               │
               │
               │                Disassembly of section .text:
               │
               │                000000000003aab0 <random@@GLIBC_2.2.5>:
          8.22 │3.92              sub    $0x18,%rsp
               │3.92              mov    $0x1,%esi
               │3.92              xor    %eax,%eax
               │3.92              cmpl   $0x0,argp_program_version_hook@@GLIBC_2.2.5+0x
               │3.92     1      ↓ je     20
               │                  lock   cmpxchg %esi,__abort_msg@@GLIBC_PRIVATE+0x8a0
               │                ↓ jne    29
               │                ↓ jmp    43
               │1.10        20:   cmpxchg %esi,__abort_msg@@GLIBC_PRIVATE+0x8a0
          8.93 │1.10     1      ↓ je     43
      Signed-off-by: NJin Yao <yao.jin@linux.intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1526569118-14217-3-git-send-email-yao.jin@linux.intel.com
      [ Rename all maxmin to minmax ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      3e71fc03
    • J
      perf annotate: Record the min/max cycles · 48659ebf
      Jin Yao 提交于
      Currently perf has a feature to account cycles for LBRs
      
      For example, on skylake:
      
        perf record -b ...
        perf report or perf annotate
      
      And then browsing the annotate browser gives average cycle counts for
      program blocks.
      
      For some analysis it would be useful if we could know not only the
      average cycles but also the min and max cycles.
      
      This patch records the min and max cycles.
      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: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1526569118-14217-2-git-send-email-yao.jin@linux.intel.com
      [ Switch from max/min to min/max ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      48659ebf
    • S
      perf script: Show symbol offsets by default · 7903a708
      Sandipan Das 提交于
      Since the ip shown for a symbol is now always a virtual address, it
      becomes difficult to correlate this with objdump output and determine
      the exact instruction address. So, we always show the offset from the
      start of the symbol.
      
      This can be verified on a powerpc64le system running Fedora 27 as
      follows:
      
        # perf probe -a sys_write
        # perf record -e probe:sys_write -g ~/test
      
      Before applying this patch:
      
        # perf script
      
        test  9710 [013] 95614.332431: probe:sys_write: (c0000000004025b0)
                c0000000004025b0 sys_write (/lib/modules/4.17.0-rc4+/build/vmlinux)
                c00000000000b9e0 system_call (/lib/modules/4.17.0-rc4+/build/vmlinux)
                    7fffb70d8234 __GI___libc_write (/usr/lib64/libc-2.26.so)
                    7fffb7052c74 _IO_file_write@@GLIBC_2.17 (/usr/lib64/libc-2.26.so)
                        5afc1818 [unknown] ([unknown])
                    7fffb7051a60 new_do_write (/usr/lib64/libc-2.26.so)
                    7fffb7054638 _IO_do_write@@GLIBC_2.17 (/usr/lib64/libc-2.26.so)
                    7fffb7054bbc _IO_file_overflow@@GLIBC_2.17 (/usr/lib64/libc-2.26.so)
                    7fffb7055a24 __overflow (/usr/lib64/libc-2.26.so)
                    7fffb7044548 _IO_puts (/usr/lib64/libc-2.26.so)
                        10000440 main (/home/sandipan/test)
                    7fffb6fe36a0 generic_start_main.isra.0 (/usr/lib64/libc-2.26.so)
                    7fffb6fe3898 __libc_start_main (/usr/lib64/libc-2.26.so)
                               0 [unknown] ([unknown])
        ...
      
      After applying this patch:
      
        # perf script
      
        test  9710 [013] 95614.332431: probe:sys_write: (c0000000004025b0)
                c0000000004025b0 sys_write+0x10 (/lib/modules/4.17.0-rc4+/build/vmlinux)
                c00000000000b9e0 system_call+0x58 (/lib/modules/4.17.0-rc4+/build/vmlinux)
                    7fffb70d8234 __GI___libc_write+0x24 (/usr/lib64/libc-2.26.so)
                    7fffb7052c74 _IO_file_write@@GLIBC_2.17+0x44 (/usr/lib64/libc-2.26.so)
                        5afc1818 [unknown] ([unknown])
                    7fffb7051a60 new_do_write+0x90 (/usr/lib64/libc-2.26.so)
                    7fffb7054638 _IO_do_write@@GLIBC_2.17+0x38 (/usr/lib64/libc-2.26.so)
                    7fffb7054bbc _IO_file_overflow@@GLIBC_2.17+0x14c (/usr/lib64/libc-2.26.so)
                    7fffb7055a24 __overflow+0x64 (/usr/lib64/libc-2.26.so)
                    7fffb7044548 _IO_puts+0x218 (/usr/lib64/libc-2.26.so)
                        10000440 main+0x20 (/home/sandipan/test)
                    7fffb6fe36a0 generic_start_main.isra.0+0x140 (/usr/lib64/libc-2.26.so)
                    7fffb6fe3898 __libc_start_main+0xb8 (/usr/lib64/libc-2.26.so)
                               0 [unknown] ([unknown])
        ...
      Signed-off-by: NSandipan Das <sandipan@linux.vnet.ibm.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
      Link: http://lkml.kernel.org/r/20180517063326.6319-2-sandipan@linux.vnet.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      7903a708
  8. 18 5月, 2018 1 次提交
    • S
      perf script: Show virtual addresses instead of offsets · 19610184
      Sandipan Das 提交于
      When perf data is recorded with the call-graph option enabled, the
      callchain shown by perf script shows the binary offsets of the symbols
      as the ip. This is incorrect for kernel symbols as the ip values are
      always off by a fixed offset depending on the architecture. If the
      offsets from the start of the symbols are printed, they are also
      incorrect for both kernel and userspace symbols.
      
      Without the call-graph option, the callchain shows the virtual addresses
      of the symbols rather than their binary offsets. The offsets printed in
      this case are also correct.
      
      This fixes the inconsistency in perf script's output.
      
      This can be verified on a powerpc64le system running Fedora 27 as
      follows:
      
        # cat /proc/kallsyms | grep sys_write
        ...
        c0000000004025a0 T sys_write
        c0000000004025a0 T __se_sys_write
        ...
      
        # perf probe -a sys_write
      
      Before applying this patch:
      
        # perf record -e probe:sys_write -g ~/test
        # perf script -F ip,sym,symoff
      
                          4125b0 sys_write+0x8000000000008010
                           1b9e0 system_call+0x8000000000008058
                          118234 __GI___libc_write+0xffff0000f52c0024
                           92c74 _IO_file_write@@GLIBC_2.17+0xffff0000f52c0044
                        5afbfd8a [unknown]
                           91a60 new_do_write+0xffff0000f52c0090
                           94638 _IO_do_write@@GLIBC_2.17+0xffff0000f52c0038
                           94bbc _IO_file_overflow@@GLIBC_2.17+0xffff0000f52c014c
                           95a24 __overflow+0xffff0000f52c0064
                           84548 _IO_puts+0xffff0000f52c0218
                             440 main+0xffffffffe0000020
                           236a0 generic_start_main.isra.0+0xffff0000f52c0140
                           23898 __libc_start_main+0xffff0000f52c00b8
                               0 [unknown]
        ...
      
        # perf record -e probe:sys_write ~/test
        # perf script -F ip,sym,symoff
      
        c0000000004025b0 sys_write+0x10
        ...
      
      After applying this patch:
      
        # perf record -e probe:sys_write -g ~/test
        # perf script -F ip,sym,symoff
      
                c0000000004025b0 sys_write+0x10
                c00000000000b9e0 system_call+0x58
                    7fffb70d8234 __GI___libc_write+0x24
                    7fffb7052c74 _IO_file_write@@GLIBC_2.17+0x44
                        5afc1818 [unknown]
                    7fffb7051a60 new_do_write+0x90
                    7fffb7054638 _IO_do_write@@GLIBC_2.17+0x38
                    7fffb7054bbc _IO_file_overflow@@GLIBC_2.17+0x14c
                    7fffb7055a24 __overflow+0x64
                    7fffb7044548 _IO_puts+0x218
                        10000440 main+0x20
                    7fffb6fe36a0 generic_start_main.isra.0+0x140
                    7fffb6fe3898 __libc_start_main+0xb8
                               0 [unknown]
        ...
      
        # perf record -e probe:sys_write ~/test
        # perf script -F ip,sym,symoff
      
        c0000000004025b0 sys_write+0x10
        ...
      Signed-off-by: NSandipan Das <sandipan@linux.vnet.ibm.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
      Link: http://lkml.kernel.org/r/20180517063326.6319-1-sandipan@linux.vnet.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      19610184