1. 05 12月, 2017 3 次提交
    • T
      perf annotate: Fix unnecessary memory allocation for s390x · 36c26360
      Thomas Richter 提交于
      This patch fixes a bug introduced with commit d9f8dfa9 ("perf
      annotate s390: Implement jump types for perf annotate").
      
      'perf annotate' displays annotated assembler output by reading output of
      command objdump and parsing the disassembled lines. For each shown
      mnemonic this function sequence is executed:
      
        disasm_line__new()
        |
        +--> disasm_line__init_ins()
             |
             +--> ins__find()
                  |
                  +--> arch->associate_instruction_ops()
      
      The s390x specific function assigned to function pointer
      associate_instruction_ops refers to function s390__associate_ins_ops().
      
      This function checks for supported mnemonics and assigns a NULL pointer
      to unsupported mnemonics.  However even the NULL pointer is added to the
      architecture dependend instruction array.
      
      This leads to an extremely large architecture instruction array
      (due to array resize logic in function arch__grow_instructions()).
      
      Depending on the objdump output being parsed the array can end up
      with several ten-thousand elements.
      
      This patch checks if a mnemonic is supported and only adds supported
      ones into the architecture instruction array. The array does not contain
      elements with NULL pointers anymore.
      
      Before the patch (With some debug printf output):
      
      [root@s35lp76 perf]# time ./perf annotate --stdio > /tmp/xxxbb
      
      real	8m49.679s
      user	7m13.008s
      sys	0m1.649s
      [root@s35lp76 perf]# fgrep '__ins__find sorted:1 nr_instructions:'
      			/tmp/xxxbb | tail -1
      __ins__find sorted:1 nr_instructions:87433 ins:0x341583c0
      [root@s35lp76 perf]#
      
      The number of different s390x branch/jump/call/return instructions
      entered into the array is 87433.
      
      After the patch (With some printf debug output:)
      
      [root@s35lp76 perf]# time ./perf annotate --stdio > /tmp/xxxaa
      
      real	1m24.553s
      user	0m0.587s
      sys	0m1.530s
      [root@s35lp76 perf]# fgrep '__ins__find sorted:1 nr_instructions:'
      			/tmp/xxxaa | tail -1
      __ins__find sorted:1 nr_instructions:56 ins:0x3f406570
      [root@s35lp76 perf]#
      
      The number of different s390x branch/jump/call/return instructions
      entered into the array is 56 which is sensible.
      Signed-off-by: NThomas Richter <tmricht@linux.vnet.ibm.com>
      Reviewed-by: NHendrik Brueckner <brueckner@linux.vnet.ibm.com>
      Acked-by: NRavi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Link: http://lkml.kernel.org/r/20171124094637.55558-1-tmricht@linux.vnet.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      36c26360
    • J
      perf bench futex: Sync waker threads · 8085e5ab
      James Yang 提交于
      Waker threads in the futex wake-parallel benchmark are started by a loop
      using pthread_create().  However, there is no synchronization for when
      the waker threads wake the waiting threads.  Comparison of the waker
      threads' measurement timestamps show they are not all running
      concurrently because older waker threads finish their task before newer
      waker threads even start.
      
      This patch uses a barrier to better synchronize the waker threads.
      
      Signed-off-by: James Yang <james.yang@arm.com
      Cc: Kim Phillips <kim.phillips@arm.com>
      Link: http://lkml.kernel.org/r/20171127042101.3659-4-dave@stgolabs.netSigned-off-by: NDavidlohr Bueso <dave@stgolabs.net>
      [ Disable the wake-parallel test for systems without pthread_barrier_t ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      8085e5ab
    • A
      tools build feature: Check if pthread_barrier_t is available · 25ab5abf
      Arnaldo Carvalho de Melo 提交于
      As 'perf bench futex wake-parallel" will use this, which is not
      available in older systems such as versions of the android NDK used in
      my container build tests (r12b and r15c at the moment).
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: James Yang <james.yang@arm.com
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kim Phillips <kim.phillips@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-1i7iv54in4wj08lwo55b0pzv@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      25ab5abf
  2. 01 12月, 2017 1 次提交
  3. 30 11月, 2017 9 次提交
    • A
      17a68b83
    • A
      perf intel-pt: Improve build messages for files that differ from the kernel · c2653297
      Adrian Hunter 提交于
      Print file names of files that differ. For example, instead of:
      
        Warning: Intel PT: x86 instruction decoder differs from kernel
      
      print:
      
        Warning: Intel PT: x86 instruction decoder header at 'tools/perf/util/intel-pt-decoder/inat.h' differs from latest version at 'arch/x86/include/asm/inat.h'
      Reported-by: NIngo Molnar <mingo@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Link: http://lkml.kernel.org/r/1511253326-22308-2-git-send-email-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      c2653297
    • A
      perf report: Fix -D output for user metadata events · f250b09c
      Arnaldo Carvalho de Melo 提交于
      The PERF_RECORD_USER_ events are synthesized by the tool to assist in
      processing the PERF_RECORD_ ones generated by the kernel, the printing
      of that information doesn't come with a perf_sample structure, so, when
      dumping the event fields using 'perf report -D' there were columns that
      end up not being printed.
      
      To tidy up a bit this, fake a perf_sample structure with zeroes to have
      the missing columns printed and avoid the occasional surprise with that.
      
      Before:
      
      0 0x45b8 [0x68]: PERF_RECORD_MMAP -1/0: [0xffffffffc12ec000(0x4000) @ 0]: x /lib/modules/4.14.0+/kernel/fs/nls/nls_utf8.ko
      0x4620 [0x28]: PERF_RECORD_THREAD_MAP nr: 1 thread: 27820
      0x4648 [0x18]: PERF_RECORD_CPU_MAP: 0-3
      0 0x4660 [0x28]: PERF_RECORD_COMM: perf:27820/27820
      0x4a58 [0x8]: PERF_RECORD_FINISHED_ROUND
      447723433020976 0x4688 [0x28]: PERF_RECORD_SAMPLE(IP, 0x4001): 27820/27820: 0xffffffff8f1b6d7a period: 1 addr: 0
      
      After:
      
        $ perf report -D | grep PERF_RECORD_ | head
        0 0xe8 [0x20]: PERF_RECORD_TIME_CONV: unhandled!
        0 0x108 [0x28]: PERF_RECORD_THREAD_MAP nr: 1 thread: 32555
        0 0x130 [0x18]: PERF_RECORD_CPU_MAP: 0-3
        0 0x148 [0x28]: PERF_RECORD_COMM: perf:32555/32555
        0 0x4e8 [0x8]: PERF_RECORD_FINISHED_ROUND
        448743409421205 0x170 [0x28]: PERF_RECORD_COMM exec: sleep:32555/32555
        448743409431883 0x198 [0x68]: PERF_RECORD_MMAP2 32555/32555: [0x55e11d75a000(0x208000) @ 0 fd:00 3147174 2566255743]: r-xp /usr/bin/sleep
        448743409443873 0x200 [0x70]: PERF_RECORD_MMAP2 32555/32555: [0x7f0ced316000(0x229000) @ 0 fd:00 3151761 2566238119]: r-xp /usr/lib64/ld-2.25.so
        448743409454790 0x270 [0x60]: PERF_RECORD_MMAP2 32555/32555: [0x7ffe84f6d000(0x2000) @ 0 00:00 0 0]: r-xp [vdso]
        448743409479500 0x2d0 [0x28]: PERF_RECORD_SAMPLE(IP, 0x4002): 32555/32555: 0xffffffff8f84c7e7 period: 1 addr: 0
        $
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <ak@linux.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>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Fixes: 9aefcab0 ("perf session: Consolidate the dump code")
      Link: https://lkml.kernel.org/n/tip-todcu15x0cwgppkh1gi6uhru@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f250b09c
    • H
      perf buildid-cache: Document for Node.js USDT · 2e38e661
      Hansuk Hong 提交于
      Add a tip for Node.js USDT(User-Level Statically Defined Tracing) probes
      in tips.txt
      Signed-off-by: NHansuk Hong <flavono123@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lkml.kernel.org/r/20171123160546.9722-1-flavono123@gmail.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      2e38e661
    • A
      perf script: Allow computing 'perf stat' style metrics · 4bd1bef8
      Andi Kleen 提交于
      Add support for computing 'perf stat' style metrics in 'perf script'.
      
      When using leader sampling we can get metrics for each sampling period
      by computing formulas over the values of the different group members.
      
      This allows things like fine grained IPC tracking through sampling, much
      more fine grained than with 'perf stat'.
      
      The metric is still averaged over the sampling period, it is not just
      for the sampling point.
      
      This patch adds a new metric output field for 'perf script' that uses
      the existing 'perf stat' metrics infrastructure to compute any metrics
      supported by 'perf stat'.
      
      For example to sample IPC:
      
        $ perf record -e '{ref-cycles,cycles,instructions}:S' -a sleep 1
        $ perf script -F metric,ip,sym,time,cpu,comm
        ...
         alsa-sink-ALC32 [000] 42815.856074:      7fd65937d6cc [unknown]
         alsa-sink-ALC32 [000] 42815.856074:      7fd65937d6cc [unknown]
         alsa-sink-ALC32 [000] 42815.856074:      7fd65937d6cc [unknown]
         alsa-sink-ALC32 [000] 42815.856074:    metric:    0.13  insn per cycle
                 swapper [000] 42815.857961:  ffffffff81655df0 __schedule
                 swapper [000] 42815.857961:  ffffffff81655df0 __schedule
                 swapper [000] 42815.857961:  ffffffff81655df0 __schedule
                 swapper [000] 42815.857961:    metric:    0.23  insn per cycle
         qemu-system-x86 [000] 42815.858130:  ffffffff8165ad0e _raw_spin_unlock_irqrestore
         qemu-system-x86 [000] 42815.858130:  ffffffff8165ad0e _raw_spin_unlock_irqrestore
         qemu-system-x86 [000] 42815.858130:  ffffffff8165ad0e _raw_spin_unlock_irqrestore
         qemu-system-x86 [000] 42815.858130:    metric:    0.46  insn per cycle
                   :4972 [000] 42815.858312:  ffffffffa080e5f2 vmx_vcpu_run
                   :4972 [000] 42815.858312:  ffffffffa080e5f2 vmx_vcpu_run
                   :4972 [000] 42815.858312:  ffffffffa080e5f2 vmx_vcpu_run
                   :4972 [000] 42815.858312:    metric:    0.45  insn per cycle
      
      TopDown:
      
      This requires disabling SMT if you have it enabled, because SMT would
      require sampling per core, which is not supported.
      
        $ perf record -e '{ref-cycles,topdown-fetch-bubbles,\
                           topdown-recovery-bubbles,\
                           topdown-slots-retired,topdown-total-slots,\
                           topdown-slots-issued}:S' -a sleep 1
        $ perf script --header -I -F cpu,ip,sym,event,metric,period
        ...
        [000]     121108               ref-cycles:  ffffffff8165222e copy_user_enhanced_fast_string
        [000]     190350    topdown-fetch-bubbles:  ffffffff8165222e copy_user_enhanced_fast_string
        [000]       2055 topdown-recovery-bubbles:  ffffffff8165222e copy_user_enhanced_fast_string
        [000]     148729    topdown-slots-retired:  ffffffff8165222e copy_user_enhanced_fast_string
        [000]     144324      topdown-total-slots:  ffffffff8165222e copy_user_enhanced_fast_string
        [000]     160852     topdown-slots-issued:  ffffffff8165222e copy_user_enhanced_fast_string
        [000]   metric:     33.0% frontend bound
        [000]   metric:      3.5% bad speculation
        [000]   metric:     25.8% retiring
        [000]   metric:     37.7% backend bound
        [000]     112112               ref-cycles:  ffffffff8165aec8 _raw_spin_lock_irqsave
        [000]     357222    topdown-fetch-bubbles:  ffffffff8165aec8 _raw_spin_lock_irqsave
        [000]       3325 topdown-recovery-bubbles:  ffffffff8165aec8 _raw_spin_lock_irqsave
        [000]     323553    topdown-slots-retired:  ffffffff8165aec8 _raw_spin_lock_irqsave
        [000]     270507      topdown-total-slots:  ffffffff8165aec8 _raw_spin_lock_irqsave
        [000]     341226     topdown-slots-issued:  ffffffff8165aec8 _raw_spin_lock_irqsave
        [000]   metric:     33.0% frontend bound
        [000]   metric:      2.9% bad speculation
        [000]   metric:     29.9% retiring
        [000]   metric:     34.2% backend bound
      ...
      
      v2:
      Use evsel->priv for new fields
      Port to new base line, support fp output.
      Handle stats in ->stats, not ->priv
      Minor cleanups
      
      Extra explanation about the use of the term 'averaging', from Andi in the
      thread in the Link: tag below:
      
      <quote Andi>
      The current samples contains the sum of event counts for a sampling period.
      
      EventA-1           EventA-2                EventA-3      EventA-4
      EventB-1     EventB-2                             EventC-3
      
                               gap with no events                overflow
      |-----------------------------------------------------------------|
      period-start                                             period-end
      ^                                                                 ^
      |                                                                 |
      previous sample                                      current sample
      
      So EventA = 4 and EventB = 3 at the sample point
      
      I generate a metric, let's say EventA / EventB. It applies to the whole period.
      
      But the metric is over a longer time which does not have the same behavior. For
      example the gap above doesn't have any events, while they are clustered at the
      beginning and end of the sample period.
      
      But we're summing everything together. The metric doesn't know that the gap is
      different than the busy period.
      
      That's what I'm trying to express with averaging.
      </quote>
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Link: http://lkml.kernel.org/r/20171117214300.32746-4-andi@firstfloor.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      4bd1bef8
    • A
      perf record: Synthesize thread map and cpu map · 373565d2
      Andi Kleen 提交于
      Synthesize the per attr thread maps and cpu maps in 'perf record'.
      
      This allows code from 'perf stat' called from 'perf script' to access
      this information.
      
      Committer testing:
      
      Please see the PERF_RECORD_THREAD_MAP and PERF_RECORD_CPU_MAP records,
      added by this patch:
      
        $ perf record sleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.001 MB perf.data (8 samples) ]
        $ perf report -D | grep PERF_RECORD_ | head
        0xe8 [0x20]: PERF_RECORD_TIME_CONV: unhandled!
        0x108 [0x28]: PERF_RECORD_THREAD_MAP nr: 1 thread: 23568
        0x130 [0x18]: PERF_RECORD_CPU_MAP: 0-3
        0 0x148 [0x28]: PERF_RECORD_COMM: perf:23568/23568
        0x570 [0x8]: PERF_RECORD_FINISHED_ROUND
        445342677837144 0x170 [0x28]: PERF_RECORD_COMM exec: sleep:23568/23568
        445342677847339 0x198 [0x68]: PERF_RECORD_MMAP2 23568/23568: [0x564c943a4000(0x208000) @ 0 fd:00 3147174 2566255743]: r-xp /usr/bin/sleep
        445342677862450 0x200 [0x70]: PERF_RECORD_MMAP2 23568/23568: [0x7f25968a8000(0x229000) @ 0 fd:00 3151761 2566238119]: r-xp /usr/lib64/ld-2.25.so
        445342677873174 0x270 [0x60]: PERF_RECORD_MMAP2 23568/23568: [0x7ffc98176000(0x2000) @ 0 00:00 0 0]: r-xp [vdso]
        445342677891928 0x2d0 [0x28]: PERF_RECORD_SAMPLE(IP, 0x4002): 23568/23568: 0xffffffff8f84c7e7 period: 1 addr: 0
        $
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Link: http://lkml.kernel.org/r/20171117214300.32746-3-andi@firstfloor.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      373565d2
    • A
      perf record: Synthesize unit/scale/... in event update · bfd8f72c
      Andi Kleen 提交于
      Move the code to synthesize event updates for scale/unit/cpus to a
      common utility file, and use it both from stat and record.
      
      This allows to access scale and other extra qualifiers from perf script.
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Link: http://lkml.kernel.org/r/20171117214300.32746-2-andi@firstfloor.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      bfd8f72c
    • T
      perf test: Disable test cases 19 and 20 on s390x · 4ca69ca9
      Thomas Richter 提交于
      The s390x CPU sampling and measurement facilities do not support perf
      events of type PERF_TYPE_BREAKPOINT. The test cases are executed and
      fail with -ENOENT due to missing hardware support.
      
      Disable the execution of both test cases based on a
      platform check. This is the same approach as done for
      PowerPC.
      Signed-off-by: NThomas Richter <tmricht@linux.vnet.ibm.com>
      Reviewed-by: NHendrik Brueckner <brueckner@linux.vnet.ibm.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      LPU-Reference: 20171123074623.20817-1-tmricht@linux.vnet.ibm.com
      Link: https://lkml.kernel.org/n/tip-uqvoy6a1tsu8jddo5jjg4h85@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      4ca69ca9
    • I
      tools headers: Follow the upstream UAPI header version 100% differ from the kernel · 3f27bb5f
      Ingo Molnar 提交于
      Remove this from check-headers.sh:
      
        opts="--ignore-blank-lines --ignore-space-change"
      
      as the easiest policy is to just follow the upstream UAPI header version 100%.
      Pure space-only changes are comparatively rare.
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Link: http://lkml.kernel.org/r/20171121084111.y6p5zwqso2cbms5s@gmail.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      3f27bb5f
  4. 29 11月, 2017 27 次提交