1. 16 5月, 2015 1 次提交
  2. 15 5月, 2015 1 次提交
  3. 14 5月, 2015 2 次提交
    • N
      perf report: Fix some option handling on --stdio · 4fd113b5
      Namhyung Kim 提交于
      There's a bug that perf report sometimes ignore some options on --stdio
      output.  This bug is triggered only if a related config variable is set.
      For example, let's assume we have a following config file.
      
        $ cat ~/.perfconfig
        [call-graph]
          print-type = graph
        [hist]
          percentage = absolute
      
      Then, following perf config will not honor some options.
      
        $ perf record -ag sleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.199 MB perf.data (77 samples) ]
      
        $ perf report -g none --stdio
        # To display the perf.data header info, please use --header/--header-only options.
        #
        # Samples: 77  of event 'cycles'
        # Event count (approx.): 25425383
        #
        # Overhead  Command          Shared Object            Symbol
        # ........  ...............  .......................  ..............
        #
            16.34%  swapper          [kernel.vmlinux]         [k] intel_idle
                            |
                            ---intel_idle
                               cpuidle_enter_state
                               cpuidle_enter
                               cpu_startup_entry
         ...
      
      With '-g none' option, it should not show callchains, but it still shows
      callchains.  However it works as expected on --tui output.
      
      Similarly, '--percentage relative' option is not work and still shows a
      absolute percentage values.
      
      Looking at the source, I found that those setting were overwritten by
      config variables when setup_pager() called.  The setup_pager() is to
      start a pager process so that it can manage long lines of output on the
      stdio mode.  But as it calls the perf_config() after parsing arguments,
      the settings were overwritten regardless of command line options.
      
      The reason it calls perf_config() is to find the 'pager_program' which
      might be set by a config variable, I guess.  However current perf code
      does not provide the config variable for it, so it's just meaningless
      IMHO.  Eliminating the call makes the option working as expected.
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Taeung Song <treeze.taeung@gmail.com>
      Link: http://lkml.kernel.org/r/1431529406-6762-1-git-send-email-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      4fd113b5
    • N
      perf probe: Ignore tail calls to probed functions · d4c537e6
      Naveen N. Rao 提交于
      perf probe currently errors out if there are any tail calls to probed
      functions:
      
      [root@rhel71be]# perf probe do_fork
      Failed to find probe point in any functions.
        Error: Failed to add events.
      
      Fix this by teaching perf to ignore tail calls.
      
      Without patch:
      
        [root@rhel71be perf]# ./perf probe -v do_fork
        probe-definition(0): do_fork symbol:do_fork file:(null) line:0 offset:0
        return:0 lazy:(null)
        0 arguments
        Looking at the vmlinux_path (7 entries long)
        symsrc__init: build id mismatch for /boot/vmlinux.
        Using /usr/lib/debug/lib/modules/3.10.0-201.el7.ppc64/vmlinux for symbols
        Open Debuginfo file:
        /usr/lib/debug/lib/modules/3.10.0-201.el7.ppc64/vmlinux
        Try to find probe point from debuginfo.
        found inline addr: 0xc0000000000bb9b0
        Probe point found: do_fork+0
        found inline addr: 0xc0000000000bbe20
        Probe point found: kernel_thread+48
        found inline addr: 0xc0000000000bbe5c
        Probe point found: sys_fork+28
        found inline addr: 0xc0000000000bbfac
        Probe point found: sys_vfork+44
        found inline addr: 0xc0000000000bc27c
        Failed to find probe point in any functions.
        An error occurred in debuginfo analysis (-2).
        Error: Failed to add events. Reason: No such file or directory (Code: -2)
      
      With patch:
      
        [root@rhel71be perf]# ./perf probe -v do_fork
        probe-definition(0): do_fork symbol:do_fork file:(null) line:0 offset:0
        return:0 lazy:(null)
        0 arguments
        Looking at the vmlinux_path (7 entries long)
        symsrc__init: build id mismatch for /boot/vmlinux.
        Using /usr/lib/debug/lib/modules/3.10.0-201.el7.ppc64/vmlinux for symbols
        Open Debuginfo file:
        /usr/lib/debug/lib/modules/3.10.0-201.el7.ppc64/vmlinux
        Try to find probe point from debuginfo.
        found inline addr: 0xc0000000000bb9b0
        Probe point found: do_fork+0
        found inline addr: 0xc0000000000bbe20
        Probe point found: kernel_thread+48
        found inline addr: 0xc0000000000bbe5c
        Probe point found: sys_fork+28
        found inline addr: 0xc0000000000bbfac
        Probe point found: sys_vfork+44
        found inline addr: 0xc0000000000bc27c
        Ignoring tail call from SyS_clone
        Found 4 probe_trace_events.
        Opening /sys/kernel/debug/tracing/kprobe_events write=1
        No kprobe blacklist support, ignored
        Added new events:
        Writing event: p:probe/do_fork _text+768432
        Failed to write event: Invalid argument
          Error: Failed to add events. Reason: Invalid argument (Code: -22)
      
      [Ignore the error about failure to write event - this kernel is missing
      a patch to resolve _text properly]
      
      The reason to ignore tail calls is that the address does not belong to
      any function frame. In the example above, the address in SyS_clone is
      0xc0000000000bc27c, but looking at the debug-info:
      
       <1><830081>: Abbrev Number: 133 (DW_TAG_subprogram)
          <830083>   DW_AT_external    : 1
          <830083>   DW_AT_name        : (indirect string, offset: 0x3cea3): SyS_clone
          <830087>   DW_AT_decl_file   : 7
          <830088>   DW_AT_decl_line   : 1689
          <83008a>   DW_AT_prototyped  : 1
          <83008a>   DW_AT_type        : <0x8110eb>
          <83008e>   DW_AT_low_pc      : 0xc0000000000bc270
          <830096>   DW_AT_high_pc     : 0xc
          <83009e>   DW_AT_frame_base  : 1 byte block: 9c 	(DW_OP_call_frame_cfa)
          <8300a0>   DW_AT_GNU_all_call_sites: 1
          <8300a0>   DW_AT_sibling     : <0x830178>
      <snip>
       <3><830147>: Abbrev Number: 125 (DW_TAG_GNU_call_site)
          <830148>   DW_AT_low_pc      : 0xc0000000000bc27c
          <830150>   DW_AT_GNU_tail_call: 1
          <830150>   DW_AT_abstract_origin: <0x82e7e1>
      
      The frame ends at 0xc0000000000bc27c. I suppose this is why this
      particular call is a "tail" call. FWIW, systemtap seems to ignore these
      as well and requires users to explicitly place probes at these call
      sites if necessary. I print out the caller so that users know.
      Signed-off-by: NNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Acked-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Link: http://lkml.kernel.org/r/1430394151-15928-1-git-send-email-naveen.n.rao@linux.vnet.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d4c537e6
  4. 12 5月, 2015 4 次提交
    • A
      perf machine: No need to keep a refcnt for last_match · 0ceb8f6e
      Arnaldo Carvalho de Melo 提交于
      Since it is all associated with the refcount for keeping the thread
      in the rbtree, it is excessive and unecessarily complex to hold a
      refcont when changing machine->last_match.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Don Zickus <dzickus@redhat.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-98kuesmfwtvhsrzx7ttyb0kt@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0ceb8f6e
    • H
      perf probe: Show better error message when failed to find variable · 7d5eaba9
      He Kuang 提交于
      Indicate to check variable location range in error message when we got
      failed to find the variable.
      
      Before this patch:
      
        $ perf probe --add 'generic_perform_write+118 bytes'
        Failed to find the location of bytes at this address.
         Perhaps, it has been optimized out.
          Error: Failed to add events.
      
      After this patch:
      
        $ perf probe --add 'generic_perform_write+118 bytes'
        Failed to find the location of the 'bytes' variable at this address.
         Perhaps it has been optimized out.
         Use -V with the --range option to show 'bytes' location range.
          Error: Failed to add events.
      Signed-off-by: NHe Kuang <hekuang@huawei.com>
      Acked-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1431336304-16863-3-git-send-email-hekuang@huawei.com
      [ Improve the error message based on lkml thread ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      7d5eaba9
    • H
      perf probe: Add --range option to show a variable's location range · 349e8d26
      He Kuang 提交于
      It is not easy for users to get the accurate byte offset or the line
      number where a local variable can be probed.
      
      With '--range' option, local variables in the scope of the probe point
      are showed with a byte offset range, and can be added according to this
      range information.
      
      For example, there are some variables in the function
      generic_perform_write():
      
        <generic_perform_write@mm/filemap.c:0>
        0  ssize_t generic_perform_write(struct file *file,
        1                                 struct iov_iter *i, loff_t pos)
        2  {
        3          struct address_space *mapping = file->f_mapping;
        4          const struct address_space_operations *a_ops = mapping->a_ops;
        ...
        42                 status = a_ops->write_begin(file, mapping, pos, bytes, flags,
                                                     &page, &fsdata);
        44                 if (unlikely(status < 0))
      
      But we fail when we try to probe the variable 'a_ops' at line 42 or 44.
      
        $ perf probe --add 'generic_perform_write:42 a_ops'
        Failed to find the location of a_ops at this address.
          Perhaps, it has been optimized out.
      
      This is because the source code do not match the assembly, so a variable
      may not be available in the source code line where it appears.
      
      After this patch, we can lookup the accurate byte offset range of a
      variable, 'INV' indicates that this variable is not valid at the given
      point, but available in the scope:
      
        $ perf probe --vars 'generic_perform_write:42' --range
        Available variables at generic_perform_write:42
          @<generic_perform_write+141>
             [INV] ssize_t written @<generic_perform_write+[324-331]>
             [INV] struct address_space_operations*        a_ops   @<generic_perform_write+[55-61,170-176,223-246]>
             [VAL] (unknown_type)  fsdata  @<generic_perform_write+[70-307,346-411]>
             [VAL] loff_t  pos     @<generic_perform_write+[0-286,286-336,346-411]>
             [VAL] long int        status  @<generic_perform_write+[83-342,346-411]>
             [VAL] long unsigned int       bytes   @<generic_perform_write+[122-311,320-338,346-403,403-411]>
             [VAL] struct address_space*   mapping @<generic_perform_write+[35-344,346-411]>
             [VAL] struct iov_iter*        i       @<generic_perform_write+[0-340,346-411]>
             [VAL] struct page*    page    @<generic_perform_write+[70-307,346-411]>
      
      Then it is more clear for us to add a probe with this variable:
      
        $ perf probe --add 'generic_perform_write+170 a_ops'
        Added new event:
          probe:generic_perform_write (on generic_perform_write+170 with a_ops)
      Signed-off-by: NHe Kuang <hekuang@huawei.com>
      Acked-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1431336304-16863-2-git-send-email-hekuang@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      349e8d26
    • H
      perf probe: Remove length limitation for showing available variables · fb9596d1
      He Kuang 提交于
      Use struct strbuf instead of bare char[] to remove the length limitation
      of variables in variable_list, so they will not disappear due to
      overlength, and make preparation for adding more description for
      variables.
      Signed-off-by: NHe Kuang <hekuang@huawei.com>
      Acked-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1431336304-16863-1-git-send-email-hekuang@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      fb9596d1
  5. 09 5月, 2015 11 次提交
  6. 06 5月, 2015 11 次提交
  7. 05 5月, 2015 2 次提交
  8. 04 5月, 2015 8 次提交