1. 29 8月, 2015 4 次提交
    • M
      perf buildid: Introduce sysfs/filename__sprintf_build_id · 0b5a7935
      Masami Hiramatsu 提交于
      Introduce sysfs/filename__sprintf_build_id for consolidating similar
      code.
      Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/20150815114259.13642.34685.stgit@localhost.localdomainSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0b5a7935
    • A
      perf evsel: Add a backpointer to the evlist a evsel is in · d49e4695
      Arnaldo Carvalho de Melo 提交于
      So that functions that deal primarily with an evsel to access
      information that concerns the whole evlist it is in.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1440677263-21954-5-git-send-email-kan.liang@intel.comSigned-off-by: NKan Liang <kan.liang@intel.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d49e4695
    • A
      perf trace: Add header with copyright and background info · a598bb5e
      Arnaldo Carvalho de Melo 提交于
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-5yqtfs728r1j1u8zmg8ufxwm@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      a598bb5e
    • T
      perf scripts python: Add new compaction-times script · 84e5d89a
      Tony Jones 提交于
      This patch creates a new script (compaction-times) to report time
      spent in mm compaction. It is possible to report times in nanoseconds
      (default) or microseconds (-u).
      
      The option -p will break down results by process id, -pv will further
      decompose by each compaction entry/exit.
      
      For each compaction entry/exit what is reported is controlled by the
      options:
      
        -t   report only timing
        -m   report migration stats
        -ms  report migration scanner stats
        -fs  report free scanner stats
      
      The default is to report all.
      
      Entries may be further filtered by pid, pid-range or comm (regex).
      
      The script is useful when analysing workloads that compact memory. The
      most common example will be THP allocations on systems with a lot of
      uptime that has fragmented memory.
      
      This is an example of using the script to analyse a thpscale from
      mmtests which deliberately fragments memory and allocates THP in 4
      separate threads
      
        # Recording step, one of the following;
        $ perf record -e 'compaction:mm_compaction_*' ./workload
        # or:
        $ perf script record compaction-times
      
        # Reporting: basic
        total: 2444505743ns migration: moved=357738 failed=39275
        free_scanner: scanned=2705578 isolated=387875
        migration_scanner: scanned=414426 isolated=397013
      
        # Reporting: Per task stall times
        $ perf script report compaction-times -- -t -p
        total: 2444505743ns
        6384[thpscale]: 740800017ns
        6385[thpscale]: 274119512ns
        6386[thpscale]: 832961337ns
        6383[thpscale]: 596624877ns
      
        # Reporting: Per-compaction attempts for task 6385
        $ perf script report compaction-times -- -m -pv 6385
        total: 274119512ns migration: moved=14893 failed=24285
        6385[thpscale]: 274119512ns migration: moved=14893 failed=24285
        6385[thpscale].1: 3033277ns migration: moved=511 failed=1
        6385[thpscale].2: 9592094ns migration: moved=1524 failed=12
        6385[thpscale].3: 2495587ns migration: moved=512 failed=0
        6385[thpscale].4: 2561766ns migration: moved=512 failed=0
        6385[thpscale].5: 2523521ns migration: moved=512 failed=0
        ..... output continues ...
      
      Changes since v1:
      - report stats for isolate_migratepages and isolate_freepages
        (Vlastimil Babka)
      - refactor code to achieve above
      - add help text
      - output to stdout/stderr explicitly
      Signed-off-by: NTony Jones <tonyj@suse.com>
      Cc: Mel Gorman <mgorman@suse.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Link: http://lkml.kernel.org/r/1439840932-8933-1-git-send-email-tonyj@suse.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      84e5d89a
  2. 28 8月, 2015 2 次提交
  3. 26 8月, 2015 7 次提交
  4. 25 8月, 2015 13 次提交
    • A
      perf tools: Update Intel PT documentation · 9d1bf02a
      Adrian Hunter 提交于
      Update Intel PT documentation to describe new features.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/1437150840-31811-26-git-send-email-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      9d1bf02a
    • A
      perf tools: Add Intel PT support for decoding TRACESTOP packets · 7eacca3e
      Adrian Hunter 提交于
      A TRACESTOP packet is produced when an Intel PT trace enters a defined
      region of the address space at which point the tracing stops.
      
      This patch just adds decoder support.
      
      Support for specifying TRACESTOP regions is left until later.
      
      For details refer to the June 2015 or later Intel 64 and IA-32
      Architectures SDM Chapter 36 Intel Processor Trace.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/1437150840-31811-25-git-send-email-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      7eacca3e
    • A
      perf tools: Add Intel PT support for using CYC packets · 0de802ab
      Adrian Hunter 提交于
      CYC packets are a new Intel PT feature.
      
      CYC packets provide even finer grain timestamp information than MTC and
      TSC packets.  A CYC packet contains the number of CPU cycles since the
      last CYC packet. Unlike MTC and TSC packets, CYC packets are only sent
      when another packet is also sent.
      
      Support for this feature is indicated by:
      
      /sys/bus/event_source/devices/intel_pt/caps/psb_cyc
      
      which contains "1" if the feature is supported and "0" otherwise.
      
      CYC packets can be requested using a PMU config term e.g. perf record -e
      intel_pt/cyc/u sleep 1
      
      The frequency of CYC packets can also be specified.  e.g. perf record -e
      intel_pt/cyc,cyc_thresh=2/u sleep 1
      
      CYC packets are not requested by default.
      
      Valid cyc_thresh values are given by:
      
      /sys/bus/event_source/devices/intel_pt/caps/cycle_thresholds
      
      which contains a hexadecimal value, the bits of which represent valid
      values e.g. bit 2 set means value 2 is valid.
      
      The value represents the minimum number of CPU cycles that must have
      passed before a CYC packet can be sent.  The number of CPU cycles is:
      
          2 ^ (value - 1)
      
      e.g. value 4 means 8 CPU cycles must pass before a CYC packet can be
      sent.  Note a CYC packet is still only sent when another packet is sent,
      not at, e.g. every 8 CPU cycles.
      
      If an invalid value is entered, the error message will give a list of
      valid values e.g.
      
          $ perf record -e intel_pt/cyc,cyc_thresh=15/u uname
          Invalid cyc_thresh for intel_pt. Valid values are: 0-12
      
      tools/perf/Documentation/intel-pt.txt is updated in a later patch as
      there are a number of new features being added.
      
      For more information refer to the June 2015 or later Intel 64 and IA-32
      Architectures SDM Chapter 36 Intel Processor Trace.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/1437150840-31811-24-git-send-email-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0de802ab
    • A
      perf tools: Add Intel PT support for decoding CYC packets · cc336186
      Adrian Hunter 提交于
      CYC packets provide even finer grain timestamp information than MTC and
      TSC packets.  A CYC packet contains the number of CPU cycles since the
      last CYC packet.
      
      This patch just adds decoder support.  The CPU frequency can be related
      to TSC using the Maximum Non-Turbo Ratio in combination with the CBR
      (core-to-bus ratio) packet.  However more accuracy is achieved by simply
      interpolating the number of cycles between other timing packets like MTC
      or TSC.  This patch takes the latter approach.
      
      Support for a default value and validation of values is provided by a
      later patch. Also documentation is updated in a separate patch.
      
      For details refer to the June 2015 or later Intel 64 and IA-32
      Architectures SDM Chapter 36 Intel Processor Trace.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/1437150840-31811-23-git-send-email-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      cc336186
    • A
      perf tools: Add Intel PT support for using MTC packets · b45fc0bf
      Adrian Hunter 提交于
      MTC packets are a new Intel PT feature.
      
      MTC packets provide finer grain timestamp information than TSC packets.
      
      Support for this feature is indicated by:
      
        /sys/bus/event_source/devices/intel_pt/caps/mtc
      
      which contains "1" if the feature is supported and "0" otherwise.
      
      MTC packets can be requested using a PMU config term e.g. perf record -e
      intel_pt/mtc/u sleep 1
      
      The frequency of MTC packets can also be specified.  e.g. perf record -e
      intel_pt/mtc,mtc_period=2/u sleep 1
      
      The default value is 3 or the nearest lower value that is supported.  0
      is always supported.
      
      Valid values are given by:
      
      /sys/bus/event_source/devices/intel_pt/caps/mtc_periods
      
      which contains a hexadecimal value, the bits of which represent valid
      values e.g. bit 2 set means value 2 is valid.
      
      The value is converted to the MTC frequency as:
      
      	CTC-frequency / (2 ^ value)
      
      e.g. value 3 means one eighth of CTC-frequency
      
      Where CTC is the hardware crystal clock, the frequency of which can be
      related to TSC via values provided in cpuid leaf 0x15.
      
      If an invalid value is entered, the error message will give a list of
      valid values e.g.
      
      	$ perf record -e intel_pt/mtc_period=15/u uname
      	Invalid mtc_period for intel_pt. Valid values are: 0,3,6,9
      
      tools/perf/Documentation/intel-pt.txt is updated in a later patch as
      there are a number of new features being added.
      
      For more information refer to the June 2015 or later Intel 64 and IA-32
      Architectures SDM Chapter 36 Intel Processor Trace.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/1437150840-31811-22-git-send-email-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b45fc0bf
    • A
      perf tools: Add Intel PT support for decoding MTC packets · 79b58424
      Adrian Hunter 提交于
      MTC packets provide finer grain timestamp information than TSC packets.
      MTC packets record time using the hardware crystal clock (CTC) which is
      related to TSC packets using a TMA packet.
      
      This patch just adds decoder support.
      
      Support for a default value and validation of values is provided by a
      later patch. Also documentation is updated in a separate patch.
      
      For details refer to the June 2015 or later Intel 64 and IA-32
      Architectures SDM Chapter 36 Intel Processor Trace.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/1437150840-31811-21-git-send-email-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      79b58424
    • A
      perf tools: Pass Intel PT information for decoding MTC and CYC · 11fa7cb8
      Adrian Hunter 提交于
      Record additional information in the AUXTRACE_INFO event in preparation
      for decoding MTC and CYC packets.  Pass the information to the decoder.
      
      The AUXTRACE_INFO record can be extended by using the size to indicate
      the presence of new members.
      
      The additional information includes PMU config bit positions and the TSC
      to CTC (hardware crystal clock) ratio needed to decode MTC packets.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/1437150840-31811-20-git-send-email-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      11fa7cb8
    • A
      perf tools: Add new Intel PT packet definitions · 3d498078
      Adrian Hunter 提交于
      New features have been added to Intel PT which include a number of new
      packet definitions.
      
      This patch adds packet definitions for new packets: TMA, MTC, CYC, VMCS,
      TRACESTOP and MNT.  Also another bit in PIP is defined.
      
      This patch only adds support for the definitions. Later patches add
      support for decoding TMA, MTC, CYC and TRACESTOP which is where those
      packets are explained.
      
      VMCS and the newly defined bit in PIP are used with virtualization which
      is not supported yet.  MNT is a maintenance packet which the decoder
      should ignore.
      
      For details, refer to the June 2015 or later Intel 64 and IA-32
      Architectures SDM Chapter 36 Intel Processor Trace.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/1437150840-31811-19-git-send-email-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      3d498078
    • A
      perf tools: Add Intel PT support for PSB periods · bc9b6bf0
      Adrian Hunter 提交于
      The PSB packet is a synchronization packet that provides a starting
      point for decoding or recovery from errors.
      
      This patch adds support for a new Intel PT feature that allows the
      frequency of PSB packets to be specified.
      
      Support for this feature is indicated by
      /sys/bus/event_source/devices/intel_pt/caps/psb_cyc which contains "1"
      if the feature is supported and "0" otherwise.
      
      The PSB period can be specified as a PMU config term e.g. perf record -e
      intel_pt/psb_period=2/u sleep 1
      
      The default value is 3 or the nearest lower value that is supported.  0
      is always supported.
      
      Valid values are given by:
      
      /sys/bus/event_source/devices/intel_pt/caps/psb_periods
      
      which contains a hexadecimal value, the bits of which represent valid
      values e.g. bit 2 set means value 2 is valid.
      
      The value is converted to the approximate number of trace bytes between
      PSB packets as:
      
      	2 ^ (value + 11)
      
      e.g. value 3 means 16KiB bytes between PSBs
      
      If an invalid value is entered, the error message will give a list of
      valid values e.g.
      
      	$ perf record -e intel_pt/psb_period=15/u uname
      	Invalid psb_period for intel_pt. Valid values are: 0-5
      
      tools/perf/Documentation/intel-pt.txt is updated in a later patch as
      there are a number of new features being added.
      
      For more information about PSB periods refer to the Intel 64 and IA-32
      Architectures SDM Chapter 36 Intel Processor Trace from June 2015 or
      later.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/1437150840-31811-18-git-send-email-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      bc9b6bf0
    • A
      perf tools: Fix Intel PT 'instructions' sample period · 2a21d036
      Adrian Hunter 提交于
      The period on synthesized 'instructions' samples was being set to a
      fixed value, whereas the correct value is the number of instructions
      since the last sample, which is a value that the decoder can provide.
      So do it that way.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/1437150840-31811-14-git-send-email-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      2a21d036
    • A
      perf ordered_events: Clear the progress bar at the end of a flush · 5c9ce1e6
      Arnaldo Carvalho de Melo 提交于
      We were depending on the next screen operation after a flush() being
      one that would redraw the whole screen so that the progress bar would
      be overwritten, when that didn't happen a screen artifact of, say, a
      error dialog window would be overlaid on top of the progress bar, fix
      it by calling ui_browser__finish(), that now has a TUI implementation.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-el0fyw6duemnx62lydjzhs8c@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5c9ce1e6
    • A
      perf ui tui progress: Implement the ui_progress_ops->finish() method · 1e259ad4
      Arnaldo Carvalho de Melo 提交于
      So that we can erase the progress bar after we're done with it, avoiding
      things like:
      
      -------------------------------------------------------------------
      
                ┌─Error:──────────────────────────────────────────────────────┐
                │Can't annotate unmapped_area_topdown:                        │
                │                                                             │
                │No vmlinux file with build id a826726b5ddacfab1f0bade868f1a79│
                │was found in the path.                                       │
                │                                                             │
                │Note that annotation using /proc/kcore requires CAP_SYS_RAWIO│
      ┌Processin│                                                             │──┐
      │         │Please use:                                                  │  │
      └─────────│                                                             │──┘
                │  perf buildid-cache -vu vmlinux                             │
                │                                                             │
                │or:                                                          │
                │                                                             │
                │  --vmlinux vmlinux                                          │
                │                                                             │
                │                                                             │
                │Press any key...                                             │
                └─────────────────────────────────────────────────────────────┘
      
      Can't annotate unmapped_area_topdown:
      -------------------------------------------------------------------
      
      I.e. that finished progress bar behind the error window. It is not a
      problem when we end up redrawing the whole screen, but its ugly when
      we present such error windows, provide a TUI method so that code like
      the above may avoid this situation, as will be done with the annotation
      code in the next cset.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-qvktnojzwwe37pweging058t@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      1e259ad4
    • A
      perf annotate: Reset the dso find_symbol cache when removing symbols · c0b4dffb
      Arnaldo Carvalho de Melo 提交于
      The 'annotate' tool does some filtering in the entries in a DSO but
      forgot to reset the cache done in dso__find_symbol(), cauxing a SEGV:
      
        [root@zoo ~]# perf annotate netlink_poll
        perf: Segmentation fault
        -------- backtrace --------
        perf[0x526ceb]
        /lib64/libc.so.6(+0x34960)[0x7faedfbe0960]
        perf(rb_erase+0x223)[0x499d63]
        perf[0x4213e9]
        perf[0x4bc123]
        perf[0x4bc621]
        perf[0x4bf26b]
        perf[0x4bc855]
        perf(perf_session__process_events+0x340)[0x4bddc0]
        perf(cmd_annotate+0x6bb)[0x421b5b]
        perf[0x479063]
        perf(main+0x60a)[0x42098a]
        /lib64/libc.so.6(__libc_start_main+0xf0)[0x7faedfbcbfe0]
        perf[0x420aa9]
        [0x0]
        [root@zoo ~]#
      
      Fix it by reseting the find cache when removing symbols.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Fixes: b685ac22 ("perf symbols: Add front end cache for DSO symbol lookup")
      Link: http://lkml.kernel.org/n/tip-b2y9x46y0t8yem1ive41zqyp@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      c0b4dffb
  5. 22 8月, 2015 1 次提交
  6. 21 8月, 2015 9 次提交
    • W
      perf probe: Try to use symbol table if searching debug info failed · 1c0bd0e8
      Wang Nan 提交于
      A problem can occur in a statically linked perf when vmlinux can be found:
      
       # perf probe --add sys_epoll_pwait
       probe-definition(0): sys_epoll_pwait
       symbol:sys_epoll_pwait file:(null) line:0 offset:0 return:0 lazy:(null)
       0 arguments
       Looking at the vmlinux_path (7 entries long)
       Using /lib/modules/4.2.0-rc1+/build/vmlinux for symbols
       Open Debuginfo file: /lib/modules/4.2.0-rc1+/build/vmlinux
       Try to find probe point from debuginfo.
       Symbol sys_epoll_pwait address found : ffffffff8122bd40
       Matched function: SyS_epoll_pwait
       Failed to get call frame on 0xffffffff8122bd40
       An error occurred in debuginfo analysis (-2).
         Error: Failed to add events. Reason: No such file or directory (Code: -2)
      
      The reason is caused by libdw that, if libdw is statically linked, it
      can't load libebl_{arch}.so reliable.
      
      In this case it is still possible to get the address from
      /proc/kalksyms.  However, perf tries that only when libdw returns
      -EBADF.
      
      This patch gives it another chance to utilize symbol table, even if
      libdw returns an error code other than -EBADF.
      
      After applying this patch:
      
       # perf probe -nv --add sys_epoll_pwait
       probe-definition(0): sys_epoll_pwait
       symbol:sys_epoll_pwait file:(null) line:0 offset:0 return:0 lazy:(null)
       0 arguments
       Looking at the vmlinux_path (7 entries long)
       Using /lib/modules/4.2.0-rc1+/build/vmlinux for symbols
       Open Debuginfo file: /lib/modules/4.2.0-rc1+/build/vmlinux
       Try to find probe point from debuginfo.
       Symbol sys_epoll_pwait address found : ffffffff8122bd40
       Matched function: SyS_epoll_pwait
       Failed to get call frame on 0xffffffff8122bd40
       An error occurred in debuginfo analysis (-2).
       Trying to use symbols.
       Opening /sys/kernel/debug/tracing/kprobe_events write=1
       Added new event:
       Writing event: p:probe/sys_epoll_pwait _text+2276672
         probe:sys_epoll_pwait (on sys_epoll_pwait)
      
       You can now use it in all perf tools, such as:
      
       	perf record -e probe:sys_epoll_pwait -aR sleep 1
      
      Although libdw returns an error (Failed to get call frame), perf tries
      symbol table and finally gets correct address.
      Signed-off-by: NWang Nan <wangnan0@huawei.com>
      Cc: Alexei Starovoitov <ast@plumgrid.com>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: He Kuang <hekuang@huawei.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kaixu Xia <xiakaixu@huawei.com>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1440151770-129878-2-git-send-email-wangnan0@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      1c0bd0e8
    • A
      perf tools: Initialize reference counts in map__clone() · 66671d00
      Arnaldo Carvalho de Melo 提交于
      Map clone was written before we introduced reference counts for
      maps and dsos, so all that was needed was just a copy and then we
      would insert it into the new map_groups instance.
      
      Fix it by, after copying, initializing the map->refcnt, grabbing
      a struct dso refcount and resetting pointers that may be used
      to determine if a map, when deleted, is in a rb_tree.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-pd4mr80o5b9gvk50iineacec@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      66671d00
    • A
      perf tools: Add example call-graph script · 4b715d24
      Adrian Hunter 提交于
      Add a script to produce a call-graph from data exported to a postgresql
      database and derived from a processor trace event like intel_pt or intel_bts.
      
      Refer to comments in the scripts call-graph-from-postgresql.py and
      export-to-postgresql.py for more details on how to set up the environment,
      install the required packages, etc.
      
      Committer note:
      
      From the scripts, for convenience while reading 'git log':
      
        An example of using this script with Intel PT:
      
        $ perf record -e intel_pt//u ls
        $ perf script -s ~/libexec/perf-core/scripts/python/export-to-postgresql.py pt_example branches calls
        2015-05-29 12:49:23.464364 Creating database...
        2015-05-29 12:49:26.281717 Writing to intermediate files...
        2015-05-29 12:49:27.190383 Copying to database...
        2015-05-29 12:49:28.140451 Removing intermediate files...
        2015-05-29 12:49:28.147451 Adding primary keys
        2015-05-29 12:49:28.655683 Adding foreign keys
        2015-05-29 12:49:29.365350 Done
        $ python tools/perf/scripts/python/call-graph-from-postgresql.py pt_example
        # The result is a GUI window with a tree representing a context-sensitive
        # call-graph.  Expanding a couple of levels of the tree and adjusting column
        # widths to suit will display something like:
      
                                               Call Graph: pt_example
        Call Path                        |Object     |Count|Time(ns)|Time(%)|Branch Count|Branch Count(%)
        v- ls
           v- 2638:2638
               v- _start                  ld-2.19.so    1   10074071  100.0        211135          100.0
                 |- unknown               unknown       1      13198    0.1             1            0.0
                 >- _dl_start             ld-2.19.so    1    1400980   13.9         19637            9.3
                 >- _d_linit_internal     ld-2.19.so    1     448152    4.4         11094            5.3
                 v-__libc_start_main@plt  ls            1    8211741   81.5        180397           85.4
                    >- _dl_fixup          ld-2.19.so    1       7607    0.1           108            0.1
                    >- __cxa_atexit       libc-2.19.so  1      11737    0.1            10            0.0
                    >- __libc_csu_init    ls            1      10354    0.1            10            0.0
                    |- _setjmp            libc-2.19.so  1          0    0.0             4            0.0
                    v- main               ls            1    8182043   99.6        180254           99.9
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/1437150840-31811-11-git-send-email-adrian.hunter@intel.com
      [ Added 'python-pyside qt-postgresql' to the yum cmdline installing required packages ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      4b715d24
    • A
      perf tools: Put itrace options into an asciidoc include · 60b88d87
      Adrian Hunter 提交于
      perf script, report and inject all have the same itrace options. Put
      them into an asciidoc include file.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/1437150840-31811-10-git-send-email-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      60b88d87
    • A
      perf tools: Add Intel BTS support · d0170af7
      Adrian Hunter 提交于
      Intel BTS support fits within the new auxtrace infrastructure.  Recording is
      supporting by identifying the Intel BTS PMU, parsing options and setting up
      events.
      
      Decoding is supported by queuing up trace data by thread and then decoding
      synchronously delivering synthesized event samples into the session processing
      for tools to consume.
      
      Committer note:
      
      E.g:
      
        [root@felicio ~]# perf record --per-thread -e intel_bts// ls
        anaconda-ks.cfg  apctest.output  bin  kernel-rt-3.10.0-298.rt56.171.el7.x86_64.rpm  libexec  lock_page.bpf.c  perf.data  perf.data.old
        [ perf record: Woken up 3 times to write data ]
        [ perf record: Captured and wrote 4.367 MB perf.data ]
        [root@felicio ~]# perf evlist -v
        intel_bts//: type: 6, size: 112, { sample_period, sample_freq }: 1, sample_type: IP|TID|IDENTIFIER, read_format: ID, disabled: 1, enable_on_exec: 1, sample_id_all: 1, exclude_guest: 1
        dummy:u: type: 1, size: 112, config: 0x9, { sample_period, sample_freq }: 1, sample_type: IP|TID|IDENTIFIER, read_format: ID, disabled: 1, exclude_kernel: 1, exclude_hv: 1, mmap: 1, comm: 1, enable_on_exec: 1, task: 1, sample_id_all: 1, mmap2: 1, comm_exec: 1
        [root@felicio ~]# perf script # the navigate in the pager to some interesting place:
          ls 1843 1 branches: ffffffff810a60cb flush_signal_handlers ([kernel.kallsyms]) => ffffffff8121a522 setup_new_exec ([kernel.kallsyms])
          ls 1843 1 branches: ffffffff8121a529 setup_new_exec ([kernel.kallsyms]) => ffffffff8122fa30 do_close_on_exec ([kernel.kallsyms])
          ls 1843 1 branches: ffffffff8122fa5d do_close_on_exec ([kernel.kallsyms]) => ffffffff81767ae0 _raw_spin_lock ([kernel.kallsyms])
          ls 1843 1 branches: ffffffff81767af4 _raw_spin_lock ([kernel.kallsyms]) => ffffffff8122fa62 do_close_on_exec ([kernel.kallsyms])
          ls 1843 1 branches: ffffffff8122fa8e do_close_on_exec ([kernel.kallsyms]) => ffffffff8122faf0 do_close_on_exec ([kernel.kallsyms])
          ls 1843 1 branches: ffffffff8122faf7 do_close_on_exec ([kernel.kallsyms]) => ffffffff8122fa8b do_close_on_exec ([kernel.kallsyms])
          ls 1843 1 branches: ffffffff8122fa8e do_close_on_exec ([kernel.kallsyms]) => ffffffff8122faf0 do_close_on_exec ([kernel.kallsyms])
          ls 1843 1 branches: ffffffff8122faf7 do_close_on_exec ([kernel.kallsyms]) => ffffffff8122fa8b do_close_on_exec ([kernel.kallsyms])
          ls 1843 1 branches: ffffffff8122fa8e do_close_on_exec ([kernel.kallsyms]) => ffffffff8122faf0 do_close_on_exec ([kernel.kallsyms])
          ls 1843 1 branches: ffffffff8122faf7 do_close_on_exec ([kernel.kallsyms]) => ffffffff8122fa8b do_close_on_exec ([kernel.kallsyms])
          ls 1843 1 branches: ffffffff8122fa8e do_close_on_exec ([kernel.kallsyms]) => ffffffff8122faf0 do_close_on_exec ([kernel.kallsyms])
          ls 1843 1 branches: ffffffff8122faf7 do_close_on_exec ([kernel.kallsyms]) => ffffffff8122fa8b do_close_on_exec ([kernel.kallsyms])
          ls 1843 1 branches: ffffffff8122fa8e do_close_on_exec ([kernel.kallsyms]) => ffffffff8122faf0 do_close_on_exec ([kernel.kallsyms])
          ls 1843 1 branches: ffffffff8122faf7 do_close_on_exec ([kernel.kallsyms]) => ffffffff8122fa8b do_close_on_exec ([kernel.kallsyms])
          ls 1843 1 branches: ffffffff8122fa8e do_close_on_exec ([kernel.kallsyms]) => ffffffff8122faf0 do_close_on_exec ([kernel.kallsyms])
          ls 1843 1 branches: ffffffff8122faf7 do_close_on_exec ([kernel.kallsyms]) => ffffffff8122fa8b do_close_on_exec ([kernel.kallsyms])
          ls 1843 1 branches: ffffffff8122fac9 do_close_on_exec ([kernel.kallsyms]) => ffffffff8122fad2 do_close_on_exec ([kernel.kallsyms])
          ls 1843 1 branches: ffffffff8122fadd do_close_on_exec ([kernel.kallsyms]) => ffffffff8120fc80 filp_close ([kernel.kallsyms])
          ls 1843 1 branches: ffffffff8120fcaf filp_close ([kernel.kallsyms]) => ffffffff8120fcb6 filp_close ([kernel.kallsyms])
          ls 1843 1 branches: ffffffff8120fcc2 filp_close ([kernel.kallsyms]) => ffffffff812547f0 dnotify_flush ([kernel.kallsyms])
          ls 1843 1 branches: ffffffff81254823 dnotify_flush ([kernel.kallsyms]) => ffffffff8120fcc7 filp_close ([kernel.kallsyms])
          ls 1843 1 branches: ffffffff8120fccd filp_close ([kernel.kallsyms]) => ffffffff81261790 locks_remove_posix ([kernel.kallsyms])
          ls 1843 1 branches: ffffffff812617a3 locks_remove_posix ([kernel.kallsyms]) => ffffffff812617b9 locks_remove_posix ([kernel.kallsyms])
          ls 1843 1 branches: ffffffff812617b9 locks_remove_posix ([kernel.kallsyms]) => ffffffff8120fcd2 filp_close ([kernel.kallsyms])
          ls 1843 1 branches: ffffffff8120fcd5 filp_close ([kernel.kallsyms]) => ffffffff812142c0 fput ([kernel.kallsyms])
          ls 1843 1 branches: ffffffff812142d6 fput ([kernel.kallsyms]) => ffffffff812142df fput ([kernel.kallsyms])
          ls 1843 1 branches: ffffffff8121430c fput ([kernel.kallsyms]) => ffffffff810b6580 task_work_add ([kernel.kallsyms])
          ls 1843 1 branches: ffffffff810b65ad task_work_add ([kernel.kallsyms]) => ffffffff810b65b1 task_work_add ([kernel.kallsyms])
          ls 1843 1 branches: ffffffff810b65c1 task_work_add ([kernel.kallsyms]) => ffffffff810bc710 kick_process ([kernel.kallsyms])
          ls 1843 1 branches: ffffffff810bc725 kick_process ([kernel.kallsyms]) => ffffffff810bc742 kick_process ([kernel.kallsyms])
          ls 1843 1 branches: ffffffff810bc742 kick_process ([kernel.kallsyms]) => ffffffff810b65c6 task_work_add ([kernel.kallsyms])
          ls 1843 1 branches: ffffffff810b65c9 task_work_add ([kernel.kallsyms]) => ffffffff81214311 fput ([kernel.kallsyms])
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/1437150840-31811-9-git-send-email-adrian.hunter@intel.com
      [ Merged sample->time fix for bug found after first round of testing on slightly older kernel ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d0170af7
    • D
      tools lib traceevent: Add checks for returned EVENT_ERROR type · 6f56e9cf
      Dean Nelson 提交于
      Running the following perf-stat command on an arm64 system produces the
      following result...
      
        [root@aarch64 ~]# perf stat -e kmem:mm_page_alloc -a sleep 1
          Warning: [kmem:mm_page_alloc] function sizeof not defined
          Warning: Error: expected type 4 but read 0
        Segmentation fault
        [root@aarch64 ~]#
      
      The second warning was a result of the first warning not stopping
      processing after it detected the issue.
      
      That is, code that found the issue reported the first problem, but
      because it did not exit out of the functions smoothly, it caused the
      other warning to appear and not only that, it later caused the SIGSEGV.
      Signed-off-by: NDean Nelson <dnelson@redhat.com>
      Reviewed-by: NSteven Rostedt <rostedt@goodmis.org>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/20150820151632.13927.13791.email-sent-by-dnelson@tealSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      6f56e9cf
    • A
      perf tools: Fix Intel PT timestamp handling · 81cd60cc
      Adrian Hunter 提交于
      Events that don't sample the timestamp have a timestamp value of -1.
      
      Intel PT processing wasn't taking that into account.
      
      This is particularly noticeable with Intel BTS because timestamps are
      not requested by default.
      
      Then, if the conversion of -1 to TSC results in a small number, the
      processing is unaffected.
      
      However if the conversion results in a big number, then the data is
      processed prematurely before relevant sideband data like mmap events,
      which in turn results in samples with unknown dsos.
      
      Commiter note:
      
      Since BTS wasn't upstream, I split the patch to fold the BTS part with
      the patch introducing it, to avoid having this bug in the commit
      history. PT was already upstream, so this patch contains that part.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/1440060692-5585-1-git-send-email-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      81cd60cc
    • A
      perf tools: /proc/kcore requires CAP_SYS_RAWIO message too noisy · 133de940
      Adrian Hunter 提交于
      The "/proc/kcore requires CAP_SYS_RAWIO" message comes up all the time
      for 'perf script' if vmlinux is not found and the user isn't root, even
      when the kernel is not being traced and even though the message is only
      really relevant for annotation.
      
      Change it to pr_debug and instead put a note in the message displayed if
      annotation is not possible.
      
      Also, the file being accessed might not be /proc/kcore.  Tools can be
      directed to a different location using the --kallsyms option in which
      case kcore is expected to be in the same directory.  Adjust the message
      so it is not misleading in that case.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Li Zhang <zhlcindy@linux.vnet.ibm.com>
      Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Link: http://lkml.kernel.org/r/1440065260-8802-1-git-send-email-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      133de940
    • A
      perf script: Fix segfault using --show-mmap-events · 05169df5
      Adrian Hunter 提交于
      Patch "perf script: Don't assume evsel position of tracking events"
      changed 'perf script' to use 'perf_evlist__id2evsel()'. That results
      in a segfault if there is more than 1 event and there are
      synthesized mmap events e.g.
      
      	$ perf record -e cycles,instructions -p$$ sleep 1
      	$ perf script --show-mmap-events
      	Segmentation fault (core dumped)
      
      That happens because these synthesized events have an 'id' of zero
      which does not match any 'evsel'.
      
      Currently, these synthesized events use the sample type of the first
      evsel.
      
      Change 'perf_evlist__id2evsel()' to reflect that which also makes
      it consistent with 'perf_evlist__event2evsel()'.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Fixes: 06b234ec ("perf script: Don't assume evsel position of tracking events")
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/1440059205-1765-1-git-send-email-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      05169df5
  7. 20 8月, 2015 4 次提交