1. 23 8月, 2019 18 次提交
  2. 22 8月, 2019 4 次提交
  3. 21 8月, 2019 2 次提交
    • I
      Merge tag 'perf-core-for-mingo-5.4-20190820' of... · 4e92b18e
      Ingo Molnar 提交于
      Merge tag 'perf-core-for-mingo-5.4-20190820' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
      
      Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
      
      callchains:
      
         Alexey Budankov:
      
        - Allow collecting LBR together with DWARF callchains, for workloads
          where the userspace stack size collected is not big enough for
          pure DWARF based unwinding.
      
        - Dump the LBR call stack in 'perf report -D'.
      
      perf top:
      
        Arnaldo Carvalho de Melo:
      
        - Show visual cue at start to state that the minimal set of samples
          are being collected prior to sorting/bucketizing/displaying.
      
      CoreSight (ARM hardware tracing):
      
        Leo Yan:
      
        - Support sample flags 'insn' and 'insnlen'.
      
      core:
      
        Adrian Hunter:
      
        - Add comment for 'idx' member in 'struct perf_sample_id.
      
      tools headers:
      
        Arnaldo Carvalho de Melo:
      
        - Synchronize linux/bits.h, which required grabbing a copy of the kernel
          const.h headers and some changes in the ordering of header directories.
      
        - Sync x86's asm/cpufeatures.h with the with the kernel, no change in
          any of the tools.
      
      libperf:
      
        Jiri Olsa:
      
        - Fix arch include paths.
      
      libtraceevent:
      
        Steven Rostedt (VMware):
      
        - Fix "robust" test of do_generate_dynamic_list_file.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      4e92b18e
    • I
      Merge tag 'v5.3-rc5' into perf/core, to pick up fixes · 51c359c2
      Ingo Molnar 提交于
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      51c359c2
  4. 20 8月, 2019 16 次提交
    • J
      libperf: Fix arch include paths · b81d39c7
      Jiri Olsa 提交于
      Guenter Roeck reported problem with compilation when the ARCH is
      specified:
      
        $ make ARCH=x86_64
        In file included from tools/include/asm/atomic.h:6:0,
                         from include/linux/atomic.h:5,
                         from tools/include/linux/refcount.h:41,
                         from cpumap.c:4: tools/include/asm/../../arch/x86/include/asm/atomic.h:11:10:
        fatal error: asm/cmpxchg.h: No such file or directory
      
      The problem is that we don't use SRCARCH (the sanitized ARCH version)
      and we don't get the proper include path.
      Reported-by: NGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Tested-by: NGuenter Roeck <linux@roeck-us.net>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Fixes: 31435049 ("libperf: Make libperf.a part of the perf build")
      Link: http://lkml.kernel.org/r/20190820124624.GG24105@kravaSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b81d39c7
    • A
      tools headers: Fixup bitsperlong per arch includes · 42fc2e9e
      Arnaldo Carvalho de Melo 提交于
      We were getting the file by luck, from one of the paths in -I, fix it to
      get it from the proper place:
      
        $ cd tools/include/uapi/asm/
        [acme@quaco asm]$ grep include bitsperlong.h
        #include "../../arch/x86/include/uapi/asm/bitsperlong.h"
        #include "../../arch/arm64/include/uapi/asm/bitsperlong.h"
        #include "../../arch/powerpc/include/uapi/asm/bitsperlong.h"
        #include "../../arch/s390/include/uapi/asm/bitsperlong.h"
        #include "../../arch/sparc/include/uapi/asm/bitsperlong.h"
        #include "../../arch/mips/include/uapi/asm/bitsperlong.h"
        #include "../../arch/ia64/include/uapi/asm/bitsperlong.h"
        #include "../../arch/riscv/include/uapi/asm/bitsperlong.h"
        #include "../../arch/alpha/include/uapi/asm/bitsperlong.h"
        #include <asm-generic/bitsperlong.h>
        $ ls -la ../../arch/x86/include/uapi/asm/bitsperlong.h
        ls: cannot access '../../arch/x86/include/uapi/asm/bitsperlong.h': No such file or directory
        $ ls -la ../../../arch/*/include/uapi/asm/bitsperlong.h
        -rw-rw-r--. 1 237 ../../../arch/alpha/include/uapi/asm/bitsperlong.h
        -rw-rw-r--. 1 841 ../../../arch/arm64/include/uapi/asm/bitsperlong.h
        -rw-rw-r--. 1 966 ../../../arch/hexagon/include/uapi/asm/bitsperlong.h
        -rw-rw-r--. 1 234 ../../../arch/ia64/include/uapi/asm/bitsperlong.h
        -rw-rw-r--. 1 100 ../../../arch/microblaze/include/uapi/asm/bitsperlong.h
        -rw-rw-r--. 1 244 ../../../arch/mips/include/uapi/asm/bitsperlong.h
        -rw-rw-r--. 1 352 ../../../arch/parisc/include/uapi/asm/bitsperlong.h
        -rw-rw-r--. 1 312 ../../../arch/powerpc/include/uapi/asm/bitsperlong.h
        -rw-rw-r--. 1 353 ../../../arch/riscv/include/uapi/asm/bitsperlong.h
        -rw-rw-r--. 1 292 ../../../arch/s390/include/uapi/asm/bitsperlong.h
        -rw-rw-r--. 1 323 ../../../arch/sparc/include/uapi/asm/bitsperlong.h
        -rw-rw-r--. 1 320 ../../../arch/x86/include/uapi/asm/bitsperlong.h
        $
      
      Found while fixing some other problem, before it was escaping the
      tools/ chroot and using stuff in the kernel sources:
      
          CC       /tmp/build/perf/util/find_bit.o
      In file included from /git/linux/tools/include/../../arch/x86/include/uapi/asm/bitsperlong.h:11,
                       from /git/linux/tools/include/uapi/asm/bitsperlong.h:3,
                       from /git/linux/tools/include/linux/bits.h:6,
                       from /git/linux/tools/include/linux/bitops.h:13,
                       from ../lib/find_bit.c:17:
      
        # cd /git/linux/tools/include/../../arch/x86/include/uapi/asm/
        # pwd
        /git/linux/arch/x86/include/uapi/asm
        #
      
      Now it is getting the one we want it to, i.e. the one inside tools/:
      
          CC       /tmp/build/perf/util/find_bit.o
        In file included from /git/linux/tools/arch/x86/include/uapi/asm/bitsperlong.h:11,
                         from /git/linux/tools/include/linux/bits.h:6,
                         from /git/linux/tools/include/linux/bitops.h:13,
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-8f8cfqywmf6jk8a3ucr0ixhu@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      42fc2e9e
    • A
      perf top: Show info message while collecting samples · 5c959b6d
      Arnaldo Carvalho de Melo 提交于
      Give visual cue about what is happening while initially collecting the
      minimal set of samples to collect/sort/display.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-xcui60p1v6ozijfam2o89ya8@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5c959b6d
    • A
      perf ui browser: Allow specifying message to show when no samples are available to display · 2284cf80
      Arnaldo Carvalho de Melo 提交于
      The 'perf top' tool will use that to avoid having a initial blank screen
      while collecting the minimum number of samples to sort and display.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-89ciceg8cy4442he3t0jzo3f@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      2284cf80
    • A
      perf ui: Introduce non-interactive ui__info_window() function · 9b016119
      Arnaldo Carvalho de Melo 提交于
      Sometimes we want just to print a message on the center of the screen,
      like in 'perf top' while we wait for the minimum amount of samples to be
      collected before sorting and showing them.
      
      Also expose __ui__info_window() as an optimization for cases where such
      message is to be printed while holding the ui lock.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-uat0f89vfwl2w52kv9wzwd8a@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      9b016119
    • A
      perf ui: Make 'exit_msg' optional in ui__question_window() · 9e79ff77
      Arnaldo Carvalho de Melo 提交于
      We will not need it when refactoring this function to be
      non-interactive, so make it optional.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-pnx1dn17bsz7lqt9ty95nnjx@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      9e79ff77
    • L
      perf cs-etm: Support sample flags 'insn' and 'insnlen' · a4973d8f
      Leo Yan 提交于
      The synthetic branch and instruction samples are missed to set
      instruction related info, thus the perf tool fails to display samples
      with flags '-F,+insn,+insnlen'.
      
      The CoreSight trace decoder provides sufficient information to decide
      the instruction size based on the ISA type: A64/A32 instructions are
      32-bit size, but one exception is the T32 instruction size, which might
      be 32-bit or 16-bit.
      
      This patch handles these cases and it reads the instruction values from
      DSO file; thus can support the flags '-F,+insn,+insnlen'.
      
      Before:
      
        # perf script -F,insn,insnlen,ip,sym
                      0 [unknown] ilen: 0
           ffff97174044 _start ilen: 0
           ffff97174938 _dl_start ilen: 0
           ffff97174938 _dl_start ilen: 0
           ffff97174938 _dl_start ilen: 0
           ffff97174938 _dl_start ilen: 0
           ffff97174938 _dl_start ilen: 0
           ffff97174938 _dl_start ilen: 0
           ffff97174938 _dl_start ilen: 0
           ffff97174938 _dl_start ilen: 0
      
        [...]
      
      After:
      
        # perf script -F,insn,insnlen,ip,sym
                      0 [unknown] ilen: 0
           ffff97174044 _start ilen: 4 insn: 2f 02 00 94
           ffff97174938 _dl_start ilen: 4 insn: c1 ff ff 54
           ffff97174938 _dl_start ilen: 4 insn: c1 ff ff 54
           ffff97174938 _dl_start ilen: 4 insn: c1 ff ff 54
           ffff97174938 _dl_start ilen: 4 insn: c1 ff ff 54
           ffff97174938 _dl_start ilen: 4 insn: c1 ff ff 54
           ffff97174938 _dl_start ilen: 4 insn: c1 ff ff 54
           ffff97174938 _dl_start ilen: 4 insn: c1 ff ff 54
           ffff97174938 _dl_start ilen: 4 insn: c1 ff ff 54
      
        [...]
      Signed-off-by: NLeo Yan <leo.yan@linaro.org>
      Reviewed-by: NMathieu Poirier <mathieu.poirier@linaro.org>
      Tested-by: NMathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Robert Walker <robert.walker@arm.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: http://lkml.kernel.org/r/20190815082854.18191-1-leo.yan@linaro.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      a4973d8f
    • A
      perf report: Prefer DWARF callstacks to LBR ones when captured both · 10ccbc1c
      Alexey Budankov 提交于
      Display DWARF based callchains when the perf.data file contains raw thread
      stack data as LBR callstack data.
      
      Commiter testing:
      
      This changes the output from the branch stack based one, i.e. without
      this patch, for the same file as in the previous csets:
      
        # perf report --stdio
        # To display the perf.data header info, please use --header/--header-only options.
        #
        # Total Lost Samples: 0
        #
        # Samples: 13  of event 'cycles'
        # Event count (approx.): 13
        #
        # Overhead  Command  Source Shared Object  Source Symbol                Target Symbol                              Basic Block Cycles
        # ........  .......  ....................  ...........................  .........................................  ..................
        #
             7.69%  ls       libpthread-2.29.so    [.] _init                    [.] __pthread_initialize_minimal_internal  6827
             7.69%  ls       ld-2.29.so            [k] _start                   [k] _dl_start                              -
             7.69%  ls       ld-2.29.so            [.] _dl_start_user           [.] _dl_init                               -24790
             7.69%  ls       ld-2.29.so            [k] _dl_start                [k] _dl_sysdep_start                       278
             7.69%  ls       ld-2.29.so            [k] dl_main                  [k] _dl_map_object_deps                    15581
             7.69%  ls       ld-2.29.so            [k] open_verify.constprop.0  [k] lseek64                                4228
             7.69%  ls       ld-2.29.so            [k] _dl_map_object           [k] open_verify.constprop.0                55
             7.69%  ls       ld-2.29.so            [k] openaux                  [k] _dl_map_object                         67
             7.69%  ls       ld-2.29.so            [k] _dl_map_object_deps      [k] 0x00007f441b57c090                     112
             7.69%  ls       ld-2.29.so            [.] call_init.part.0         [.] _init                                  334
             7.69%  ls       ld-2.29.so            [.] _dl_init                 [.] call_init.part.0                       383
             7.69%  ls       ld-2.29.so            [k] _dl_sysdep_start         [k] dl_main                                45
             7.69%  ls       ld-2.29.so            [k] _dl_catch_exception      [k] openaux                                116
      
        #
        # (Tip: For memory address profiling, try: perf mem record / perf mem report)
        #
      
      To the one that shows call chains:
      
        # perf report --stdio
        # To display the perf.data header info, please use --header/--header-only options.
        #
        #
        # Total Lost Samples: 0
        #
        # Samples: 10  of event 'cycles'
        # Event count (approx.): 3204047
        #
        # Children      Self  Command  Shared Object       Symbol
        # ........  ........  .......  ..................  .........................................
        #
            55.01%     0.00%  ls       [kernel.vmlinux]    [k] entry_SYSCALL_64_after_hwframe
                    |
                    ---entry_SYSCALL_64_after_hwframe
                       do_syscall_64
                       |
                        --16.01%--__x64_sys_execve
                                  __do_execve_file.isra.0
                                  search_binary_handler
                                  load_elf_binary
                                  elf_map
                                  vm_mmap_pgoff
                                  do_mmap
                                  mmap_region
                                  perf_event_mmap
                                  perf_iterate_sb
                                  perf_iterate_ctx
                                  perf_event_mmap_output
                                  perf_output_copy
                                  memcpy_erms
      
            55.01%    39.00%  ls       [kernel.vmlinux]    [k] do_syscall_64
                    |
                    |--39.00%--0xffffffffffffffff
                    |          _dl_map_object
                    |          open_verify.constprop.0
                    |          __lseek64 (inlined)
                    |          entry_SYSCALL_64_after_hwframe
                    |          do_syscall_64
                    |
                     --16.01%--do_syscall_64
                               __x64_sys_execve
                               __do_execve_file.isra.0
                               search_binary_handler
                               load_elf_binary
                               elf_map
                               vm_mmap_pgoff
                               do_mmap
                               mmap_region
                               perf_event_mmap
                               perf_iterate_sb
                               perf_iterate_ctx
                               perf_event_mmap_output
                               perf_output_copy
                               memcpy_erms
      
            42.95%    42.95%  ls       libpthread-2.29.so  [.] __pthread_initialize_minimal_internal
                    |
                    ---_init
                       __pthread_initialize_minimal_internal
      
            42.95%     0.00%  ls       libpthread-2.29.so  [.] _init
                    |
                    ---_init
                       __pthread_initialize_minimal_internal
      
        <SNIP>
      
        #
        # (Tip: Profiling branch (mis)predictions with: perf record -b / perf report)
        #
        #
      
      The branch stack view be explicitely selected using:
      
        # perf report -h branch-stack
      
         Usage: perf report [<options>]
      
            -b, --branch-stack    use branch records for per branch histogram filling
      
        #
      
      I.e. after this patch:
      
        # perf report -b --stdio
        # To display the perf.data header info, please use --header/--header-only options.
        #
        #
        # Total Lost Samples: 0
        #
        # Samples: 13  of event 'cycles'
        # Event count (approx.): 13
        #
        # Overhead  Command  Source Shared Object  Source Symbol                Target Symbol                              Basic Block Cycles
        # ........  .......  ....................  ...........................  .........................................  ..................
        #
             7.69%  ls       libpthread-2.29.so    [.] _init                    [.] __pthread_initialize_minimal_internal  6827
             7.69%  ls       ld-2.29.so            [k] _start                   [k] _dl_start                              -
             7.69%  ls       ld-2.29.so            [.] _dl_start_user           [.] _dl_init                               -24790
             7.69%  ls       ld-2.29.so            [k] _dl_start                [k] _dl_sysdep_start                       278
             7.69%  ls       ld-2.29.so            [k] dl_main                  [k] _dl_map_object_deps                    15581
             7.69%  ls       ld-2.29.so            [k] open_verify.constprop.0  [k] lseek64                                4228
             7.69%  ls       ld-2.29.so            [k] _dl_map_object           [k] open_verify.constprop.0                55
             7.69%  ls       ld-2.29.so            [k] openaux                  [k] _dl_map_object                         67
             7.69%  ls       ld-2.29.so            [k] _dl_map_object_deps      [k] 0x00007f441b57c090                     112
             7.69%  ls       ld-2.29.so            [.] call_init.part.0         [.] _init                                  334
             7.69%  ls       ld-2.29.so            [.] _dl_init                 [.] call_init.part.0                       383
             7.69%  ls       ld-2.29.so            [k] _dl_sysdep_start         [k] dl_main                                45
             7.69%  ls       ld-2.29.so            [k] _dl_catch_exception      [k] openaux                                116
      
        #
        # (Tip: Show current config key-value pairs: perf config --list)
        #
        #
      Signed-off-by: NAlexey Budankov <alexey.budankov@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@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/ccbd9583-82f4-dec5-7e84-64bf56e351fb@linux.intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      10ccbc1c
    • A
      perf report: Dump LBR callstack data by -D jointly with thread stack · d2720c3d
      Alexey Budankov 提交于
      Make perf report -D command print captured LBR callstack chain when it is
      collected together with raw thread stack data:
      
        2752673087247083 0x5d10 [0x548]: PERF_RECORD_SAMPLE(IP, 0x4002): 5841/5841: 0x40121f period: 1543862 addr: 0
        ... FP chain: nr:0
        ... branch callstack: nr:3
        .....  0: 00000000004011d0
        .....  1: 00007f393c388411
        .....  2: 0000000000401098
        ... user regs: mask 0xff0fff ABI 64-bit
        .... AX    0x34e7
        .... BX    0x7fff5f6dd3c0
        .... CX    0xffffffff
        .... DX    0x34e6
        .... SI    0x7f393c5268d0
        .... DI    0x0
        .... BP    0x401260
        .... SP    0x7fff5f6dd3c0
        .... IP    0x40121f
        .... FLAGS 0x29f
        .... CS    0x33
        .... SS    0x2b
        .... R8    0x7f393c526800
        .... R9    0x7f393c525da0
        .... R10   0xfffffffffffff70a
        .... R11   0x246
        .... R12   0x401070
        .... R13   0x7fff5f6ddcb0
        .... R14   0x0
        .... R15   0x0
        ... ustack: size 1024, offset 0x130
         . data_src: 0x5080021
         ... thread: stack_test:5841
         ...... dso: /root/abudanko/stacks/stack_test
      
      Committer testing:
      
        # perf record -g --call-graph dwarf,1024 -j stack,u ls > /dev/null
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.042 MB perf.data (10 samples) ]
        #
      
      Before:
      
        # perf report -D |& grep PERF_RECORD_SAMPLE -A28 | tail -29
        67538909824483 0xa7a0 [0x560]: PERF_RECORD_SAMPLE(IP, 0x4002): 9721/9721: 0x7f441b2b1e20 period: 1376095 addr: 0
        ... FP chain: nr:0
        ... user regs: mask 0xff0fff ABI 64-bit
        .... AX    0x7f441b2b1000
        .... BX    0x7f441b55b970
        .... CX    0x7fff6e2db218
        .... DX    0x7fff6e2db218
        .... SI    0x7fff6e2db208
        .... DI    0x1
        .... BP    0x1
        .... SP    0x7fff6e2db178
        .... IP    0x7f441b2b1e20
        .... FLAGS 0x20a
        .... CS    0x33
        .... SS    0x2b
        .... R8    0x1
        .... R9    0x7f441b371c18
        .... R10   0x7f441b5a5f10
        .... R11   0x202
        .... R12   0x7fff6e2db208
        .... R13   0x7fff6e2db218
        .... R14   0x7f441b5a7150
        .... R15   0x0
        ... ustack: size 1024, offset 0x148
         . data_src: 0x5080021
         ... thread: ls:9721
         ...... dso: /usr/lib64/libpthread-2.29.so
      
        0xad00 [0x60]: event: 10
        #
      
      After:
      
        # perf report -D |& grep PERF_RECORD_SAMPLE -A31 | tail -32
        67538909824483 0xa7a0 [0x560]: PERF_RECORD_SAMPLE(IP, 0x4002): 9721/9721: 0x7f441b2b1e20 period: 1376095 addr: 0
        ... FP chain: nr:0
        ... branch callstack: nr:4
        .....  0: 00007f441b2b1e20
        .....  1: 00007f441b58af1a
        .....  2: 00007f441b58b0e1
        .....  3: 00007f441b57c145
        ... user regs: mask 0xff0fff ABI 64-bit
        .... AX    0x7f441b2b1000
        .... BX    0x7f441b55b970
        .... CX    0x7fff6e2db218
        .... DX    0x7fff6e2db218
        .... SI    0x7fff6e2db208
        .... DI    0x1
        .... BP    0x1
        .... SP    0x7fff6e2db178
        .... IP    0x7f441b2b1e20
        .... FLAGS 0x20a
        .... CS    0x33
        .... SS    0x2b
        .... R8    0x1
        .... R9    0x7f441b371c18
        .... R10   0x7f441b5a5f10
        .... R11   0x202
        .... R12   0x7fff6e2db208
        .... R13   0x7fff6e2db218
        .... R14   0x7f441b5a7150
        .... R15   0x0
        ... ustack: size 1024, offset 0x148
         . data_src: 0x5080021
         ... thread: ls:9721
         ...... dso: /usr/lib64/libpthread-2.29.so
        #
      Signed-off-by: NAlexey Budankov <alexey.budankov@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@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/aa82e5dd-def2-0ca8-a064-db9e2e8ad076@linux.intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d2720c3d
    • A
      perf record: Enable LBR callstack capture jointly with thread stack · 25663496
      Alexey Budankov 提交于
      Enable '-j stack' applicability together with '--call-graph dwarf'
      option so thread stack data and LBR call stack could be captured
      jointly:
      
        $ perf record -g --call-graph dwarf,1024 -j stack,u -- stack_test
      
      Collected LBR call stack can be used to augment DWARF call stack
      calculated from the raw thread stack data and to provide more
      comprehensive call stack information for cases when collected SIZE is
      not enough to cover complete thread stack.
      
      Such cases are typical for workloads that allocate large arrays of data
      on its threads stacks or the possible SIZE to collect can't be large
      enough due to workload nature or system configuration and this is where
      hardware captured LBR call stacks can provide missing stack frames.
      Possible DWARF plus LBR call stacks consolidation algorithm description
      follows.
      
      With this patch set perf report command UI currently ignores collected
      LBR call stack data and still provides DWARF based call stacks
      information.
      
        ===========================================================================
      
        Overview:
      
         Legend:
      
         THS - thread stack
         CTX - thread register context
         SWS - software stack
         SSF - skipped stack frames
         PSS - Perf sample stack
      
         ip,sp,bp - HW registers values
         d        - allocated stack regions
         kip      - ip address in the kernel space
         K        - captured thread stack size
      
              THS
      
             -----
             |   |<-stack bottom
              ...
             |---|
             |ip4|
             |---|         PSS = SWS(THS(K))
             |   |
         --> |   |
         |   |d3 |                  user/
         |   |---|         user PSS kernel PSS
         |   |ip3|         ------   ------
         |   |---|         |SSF |   |SSF |
         |   |   |          ....     ....
         |   |   |         ------   ------
         |   |d2 |         | -1 |   | -1 |
             |---|   user  ------   ------
         K   |ip2|   CTX   |ip3 |   |ip3 |
             |---|         |----|   |----|
         |   |d1 |   ...   |ip2 | , |ip2 |
         |   |---|  |---|  |----|   |----|
         |   |ip1|  |bp0|  |ip1 |   |ip1 |
         |   |---|  |---|  |----|   |----|
         |   |   |  |ip0|->|ip0 |   |ip0 |<-user stack top
         |   |   |  |---|  ------   ------
         |   |   |<-|sp0|<-stack    |kip0|<-kernel stack bottom
         --> -----  -----   top     |----|
                                    |kip1|
                                    |----|
      		              |kip2|
      		              |----|
                                     ....
      			      |    |<-kernel stack top
                                    ------
      
        Algorithm details:
      
         Legend:
      
         HWS - hardware stack
         K-SWS - kernel software stack
      
      			 BRANCH
      			 TABLE
      
      		 HWS      ip   ip
      			  from to
      		 ------  -----------
      		 |ip7`|  |ip7`|    |
      		 |----|  |----|----|
      		 |ip6`|  |ip6`|    |
      	user PSS |----|  |----|----|
      		 |ip5`|  |ip5`|    |
      	------   |----|  |----|----|
      	| -1 |   |ip4`|  |ip4`|    |
      	------   |----|  |----|----|
      	|ip3 |~~~|ip3`|  |ip3`|    |
      	|----|   |----|  |----|----|
      	|ip2 |~~~|ip2`|  |ip2`|    |
      	|----| 	 |----|  |----|----|
      	|ip1 |~~~|ip1`|  |ip1`|ip0`|
      	|----| 	 |----|  -----------
      	|ip0 |~~~|ip0`|<---------'
      	------   ------
      
      	1. if (sym(ipj) == sym(ipj`)), j=0-3 ===> user PSS
      	2. ipj`                      , j=4-7 ===> user PSS
      
        Augmented PSS = A_SWS(SWS(THS(K)), HWS):
      
      	         user/
             user PSS  kernel PSS
      
      	------   ------
      	|ip7`|   |ip7`|<-user PSS bottom
      	|----|   |----|
      	|ip6`|   |ip6`|
      	|----|   |----|
          HWS	|ip5`|   |ip5`|
      	|----|   |----|
      	|ip4`|   |ip4`|
      	------   ------
      	|ip3 |   |ip3 |
      	|----|   |----|
          SWS |ip2 |   |ip2 |
      	|----|   |----|
      	|ip1 |   |ip1 |
      	|----|   |----|
      	|ip0 |   |ip0 |<-user PSS top
      	------   ------
      		 |kip0|<-kernel PSS bottom
      		 |----|
      		 |kip1|
      	   K-SWS |----|
      		 |kip2|
      		 |----|
      		 |kip3|<-kernel PSS top
      		 ------
      
                        APSS
      
      Committer testing:
      
      Before:
      
        # perf record -g --call-graph dwarf,1024 -j stack,u ls > /dev/null
        unknown branch filter stack, check man page
      
         Usage: perf record [<options>] [<command>]
            or: perf record [<options>] -- <command> [<options>]
      
            -j, --branch-filter <branch filter mask>
                                  branch stack filter modes
        # perf record -g --call-graph dwarf,1024 -j u ls > /dev/null
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.054 MB perf.data (12 samples) ]
        # perf evlist -v
        cycles: size: 112, { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME|ADDR|CALLCHAIN|PERIOD|BRANCH_STACK|REGS_USER|STACK_USER|DATA_SRC, read_format: ID, disabled: 1, inherit: 1, mmap: 1, comm: 1, freq: 1, enable_on_exec: 1, task: 1, precise_ip: 3, mmap_data: 1, sample_id_all: 1, exclude_guest: 1, exclude_callchain_user: 1, mmap2: 1, comm_exec: 1, ksymbol: 1, bpf_event: 1, branch_sample_type: ANY, sample_regs_user: 0xff0fff, sample_stack_user: 1024
         #
      
      After:
      
        # perf record -g --call-graph dwarf,1024 -j stack,u ls > /dev/null
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.044 MB perf.data (11 samples) ]
        [root@quaco ~]# perf evlist -v
        cycles: size: 112, { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME|ADDR|CALLCHAIN|PERIOD|BRANCH_STACK|REGS_USER|STACK_USER|DATA_SRC, read_format: ID, disabled: 1, inherit: 1, mmap: 1, comm: 1, freq: 1, enable_on_exec: 1, task: 1, precise_ip: 3, mmap_data: 1, sample_id_all: 1, exclude_guest: 1, exclude_callchain_user: 1, mmap2: 1, comm_exec: 1, ksymbol: 1, bpf_event: 1, branch_sample_type: USER|CALL_STACK, sample_regs_user: 0xff0fff, sample_stack_user: 1024
        #
      Signed-off-by: NAlexey Budankov <alexey.budankov@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@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/e9e00090-66fb-d2a4-c90f-1d12344f7788@linux.intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      25663496
    • S
      tools lib traceevent: Fix "robust" test of do_generate_dynamic_list_file · 82a2f884
      Steven Rostedt (VMware) 提交于
      The tools/lib/traceevent/Makefile had a test added to it to detect a failure
      of the "nm" when making the dynamic list file (whatever that is). The
      problem is that the test sorts the values "U W w" and some versions of sort
      will place "w" ahead of "W" (even though it has a higher ASCII value, and
      break the test.
      
      Add 'tr "w" "W"' to merge the two and not worry about the ordering.
      Reported-by: NTzvetomir Stoyanov <tstoyanov@vmware.com>
      Signed-off-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Carrillo-Cisneros <davidcc@google.com>
      Cc: He Kuang <hekuang@huawei.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Michal rarek <mmarek@suse.com>
      Cc: Paul Turner <pjt@google.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Cc: Wang Nan <wangnan0@huawei.com>
      Cc: stable@vger.kernel.org
      Fixes: 6467753d ("tools lib traceevent: Robustify do_generate_dynamic_list_file")
      Link: http://lkml.kernel.org/r/20190805130150.25acfeb1@gandalf.local.homeSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      82a2f884
    • A
      perf evsel: Add comment for 'idx' member in 'struct perf_sample_id · 3c84e65a
      Adrian Hunter 提交于
      The 'idx' member was added as preparation for AUX area sampling. Add a
      comment to describe why.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/83ff264f-84c3-5372-8976-dd9293d20c6f@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      3c84e65a
    • A
      tools arch x86: Sync asm/cpufeatures.h with the with the kernel · 0ac10d87
      Arnaldo Carvalho de Melo 提交于
      To pick up the changes in:
      
        f36cf386 ("x86/speculation/swapgs: Exclude ATOMs from speculation through SWAPGS")
        18ec54fd ("x86/speculation: Prepare entry code for Spectre v1 swapgs mitigations")
      
      That don't affect anything in tools/.
      
      This silences this perf build warning:
      
        Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h'
        diff -u tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: https://lkml.kernel.org/n/tip-860dq1qie2cpnfghlpcnxrzr@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0ac10d87
    • A
      tools headers: Synchronize linux/bits.h with the kernel sources · b6589117
      Arnaldo Carvalho de Melo 提交于
      To pick up the changes in this cset:
      
        95b980d6 ("linux/bits.h: make BIT(), GENMASK(), and friends available in assembly")
      
      To address this tools/perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/linux/bits.h' differs from latest version at 'include/linux/bits.h'
        diff -u tools/include/linux/bits.h include/linux/bits.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-1if3iga5r3di6oyddgxsr225@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b6589117
    • A
      tools headers: Grab copy of linux/const.h, needed by linux/bits.h · aaa6ef8a
      Arnaldo Carvalho de Melo 提交于
      So that can update the copy of linux/bits.h that now uses macros defined
      in const.h and that are not available in older systems.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-c2qfcbl58hxyfb5u5xivp7is@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      aaa6ef8a
    • A
      perf tools: tools/include should come before tools/uapi/include · 146dc303
      Arnaldo Carvalho de Melo 提交于
      The next cset will grap const.h copies from the kernel to keep bits.h
      in sync as it started to use linux/const.h, that in turn includes
      uapi/linux/const.h.
      
      So now we have a file with the same name in tools/include and
      tools/uapi/include, and one includes the other, we need to have
      tools/include/uapi/ after tools/include/ for this to work, fix it.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-qzjqxa1wdrt51kwadyqawnuj@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      146dc303