1. 23 8月, 2019 13 次提交
  2. 22 8月, 2019 3 次提交
  3. 20 8月, 2019 4 次提交
    • 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: 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
    • 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
  4. 16 8月, 2019 4 次提交
    • J
      perf unwind: Remove unnecessary test · e2736219
      John Keeping 提交于
      If dwarf_callchain_users is false, then unwind__prepare_access() will
      not set unwind_libunwind_ops so the remaining test here is sufficient.
      Signed-off-by: NJohn Keeping <john@metanate.com>
      Reviewed-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: john keeping <john@metanate.com>
      Link: http://lkml.kernel.org/r/20190815100146.28842-3-john@metanate.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      e2736219
    • J
      perf unwind: Fix libunwind when tid != pid · e8ba2906
      John Keeping 提交于
      Commit e5adfc3e ("perf map: Synthesize maps only for thread group
      leader") changed the recording side so that we no longer get mmap events
      for threads other than the thread group leader (when synthesising these
      events for threads which exist before perf is started).
      
      When a file recorded after this change is loaded, the lack of mmap
      records mean that unwinding is not set up for any other threads.
      
      This can be seen in a simple record/report scenario:
      
      	perf record --call-graph=dwarf -t $TID
      	perf report
      
      If $TID is a process ID then the report will show call graphs, but if
      $TID is a secondary thread the output is as if --call-graph=none was
      specified.
      
      Following the rationale in that commit, move the libunwind fields into
      struct map_groups and update the libunwind functions to take this
      instead of the struct thread.  This is only required for
      unwind__finish_access which must now be called from map_groups__delete
      and the others are changed for symmetry.
      
      Note that unwind__get_entries keeps the thread argument since it is
      required for symbol lookup and the libdw unwind provider uses the thread
      ID.
      Signed-off-by: NJohn Keeping <john@metanate.com>
      Reviewed-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Fixes: e5adfc3e ("perf map: Synthesize maps only for thread group leader")
      Link: http://lkml.kernel.org/r/20190815100146.28842-2-john@metanate.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      e8ba2906
    • J
      perf map: Use zalloc for map_groups · ab6cd0e5
      John Keeping 提交于
      In the next commit we will add new fields to map_groups and we need
      these to be null if no value is assigned.  The simplest way to achieve
      this is to request zeroed memory from the allocator.
      Signed-off-by: NJohn Keeping <john@metanate.com>
      Reviewed-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: john keeping <john@metanate.com>
      Link: http://lkml.kernel.org/r/20190815100146.28842-1-john@metanate.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      ab6cd0e5
    • A
      perf top: Add --switch-on/--switch-off events · 2f53ae34
      Arnaldo Carvalho de Melo 提交于
      Just like 'perf trace' and 'perf script', should be useful for instance
      to only consider samples after the initialization phase of some
      workload.
      
      The man page has some examples and considerations about its current
      interface, that still doesn't handle the on/off events in a special way,
      behaving just like when multiple events are specified, i.e.:
      
      - In non-group mode (when the event list is not enclosed in {}) show a
        a menu to allow choosing which event the user wants to see in the
        histograms browser
      
      - In group mode, be it using {} or asking for --group, show one column
        per event.
      
      Try for instance:
      
        # perf top -e '{cycles,instructions,probe:icmp_rcv}' --switch-on=probe:icmp_rcv
      
      Replace probe:icmp_rcv, that I put in place using:
      
        # perf probe icmp_rcv:59
      
      To hit when broadcast packets arrive, with a probe installed after an
      initialization phase is over or after some other point of interest, some
      garbage collection, etc, and also use --switch-off, for instance, on a
      probe installed after said garbage collection is over.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Florian Weimer <fweimer@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: William Cohen <wcohen@redhat.com>
      Link: https://lkml.kernel.org/n/tip-c7q7qjeqtyvc9mkeipxza6ne@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      2f53ae34
  5. 15 8月, 2019 7 次提交
  6. 14 8月, 2019 9 次提交