1. 29 8月, 2015 7 次提交
  2. 28 8月, 2015 3 次提交
    • S
      tools lib traceeveent: Allow for negative numbers in print format · 1d945012
      Steven Rostedt 提交于
      It was reported that "%-8s" does not parse well when used in the printk
      format. The '-' is what is throwing it off. Allow that to be included.
      
      Reporter note:
      
      Example before:
      
        transhuge-stres-10730 [004]  5897.713989: mm_compaction_finished: node=0
        zone=>-<8s order=-2119871790 ret=
      
      Example after:
      
        transhuge-stres-4235  [000]   453.149280: mm_compaction_finished: node=0
        zone=ffffffff81815d7a order=9 ret=
      
      (I will send patches to fix the string handling in the tracepoints so
      it's on par with in-kernel printing via trace_pipe:)
      
        transhuge-stres-10921 [007] ...1  6307.140205: mm_compaction_finished: node=0
        zone=Normal   order=9 ret=partial
      Reported-by: NVlastimil Babka <vbabka@suse.cz>
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      Tested-by: NVlastimil Babka <vbabka@suse.cz>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lkml.kernel.org/r/20150827094601.46518bcc@gandalf.local.homeSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      1d945012
    • M
      perf script: Add --[no-]-demangle/--[no-]-demangle-kernel · 77e0070d
      Mark Drayton 提交于
      Sometimes when post-processing output from `perf script` one does not
      want to demangle C++ symbol names. Add an option to allow this.
      
      Also add --[no-]demangle-kernel to be consistent with top/report/probe.
      Signed-off-by: NMark Drayton <mbd@fb.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Link: http://lkml.kernel.org/r/1440616695-32340-1-git-send-email-scientist@fb.comSigned-off-by: NYannick Brosseau <scientist@fb.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      77e0070d
    • I
      Merge tag 'perf-core-for-mingo' of... · d1ee8bc1
      Ingo Molnar 提交于
      Merge tag 'perf-core-for-mingo' 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:
      
      User visible changes:
      
        - Add support for using several Intel PT features (CYC, MTC packets), the
          relevant documentation was updated: tools/perf/Documentation/intel-pt.txt,
          briefly describing those packets, its purposes, how to configure them in
          the event config terms and relevant external documentation for further
          reading. (Adrian Hunter)
      
        - Introduce support for probing at an absolute address, for user and kernel
          'perf probe's, useful when one have the symbol maps on a developer machine
          but not on an embedded system. (Wang Nan)
      
        - Fix 'perf probe' list results when a symbol can't be found or the
          address is zero and when an offset is provided without a function (Wang Nan)
      
        - Do not print '0x (null)' in uprobes when offset is zero (Wang Nan)
      
        - Clear the progress bar at the end of a ordered_events flush, fixing
          an UI artifact when, after ordering the events the screen doesn't get
          completely redraw, for instance, when an error window covers just the
          center of the screen and waits for user input. (Arnaldo Carvalho de Melo)
      
        - Fix 'annotate' segfault by resetting the dso find_symbol cache when removing
          symbols. (Arnaldo Carvalho de Melo)
      
      Infrastructure changes:
      
        - Allow duplicate objects in the object list, just like it is possible to have
          things like this, in the kernel:
      
            drivers/Makefile:obj-$(CONFIG_PCI)        += usb/
            drivers/Makefile:obj-$(CONFIG_USB_GADGET) += usb/
      
          (Jiri Olsa)
      
        - Fix Intel PT 'instructions' sample period. (Adrian Hunter)
      
        - Prevent segfault when reading probe point with absolute address. (Wang Nan)
      
      Build fixes:
      
        - Fix tarball build broken by pt/bts. (Adrian Hunter)
      
        - Remove export.h from MANIFEST, fixing the perf tarball make target. (Jiri Olsa)
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      d1ee8bc1
  3. 26 8月, 2015 8 次提交
  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 2 次提交
  6. 21 8月, 2015 7 次提交
    • 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