1. 01 9月, 2016 2 次提交
  2. 14 7月, 2016 1 次提交
  3. 13 7月, 2016 1 次提交
    • A
      tools: Introduce str_error_r() · c8b5f2c9
      Arnaldo Carvalho de Melo 提交于
      The tools so far have been using the strerror_r() GNU variant, that
      returns a string, be it the buffer passed or something else.
      
      But that, besides being tricky in cases where we expect that the
      function using strerror_r() returns the error formatted in a provided
      buffer (we have to check if it returned something else and copy that
      instead), breaks the build on systems not using glibc, like Alpine
      Linux, where musl libc is used.
      
      So, introduce yet another wrapper, str_error_r(), that has the GNU
      interface, but uses the portable XSI variant of strerror_r(), so that
      users rest asured that the provided buffer is used and it is what is
      returned.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-d4t42fnf48ytlk8rjxs822tf@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      c8b5f2c9
  4. 01 7月, 2016 2 次提交
  5. 23 6月, 2016 1 次提交
  6. 16 6月, 2016 1 次提交
  7. 18 12月, 2015 1 次提交
  8. 14 12月, 2015 1 次提交
    • W
      perf tools: Make options always available, even if required libs not linked · 48e1cab1
      Wang Nan 提交于
      This patch keeps options of perf builtins same in all conditions. If
      one option is disabled because of compiling options, users should be
      notified.
      
      Masami suggested another implementation in [1] that, by adding a
      OPTION_NEXT_DEPENDS option before those options in the 'struct option'
      array, options parser knows an option is disabled. However, in some
      cases this array is reordered (options__order()). In addition, in
      parse-option.c that array is const, so we can't simply merge
      information in decorator option into the affacted option.
      
      This patch chooses a simpler implementation that, introducing a
      set_option_nobuild() function and two option parsing flags. Builtins
      with such options should call set_option_nobuild() before option
      parsing. The complexity of this patch is because we want some of options
      can be skipped safely. In this case their arguments should also be
      consumed.
      
      Options in 'perf record' and 'perf probe' are fixed in this patch.
      
      [1] http://lkml.kernel.org/g/50399556C9727B4D88A595C8584AAB3752627CD4@GSjpTKYDCembx32.service.hitachi.net
      
      Test result:
      
      Normal case:
      
        # ./perf probe --vmlinux /tmp/vmlinux sys_write
        Added new event:
          probe:sys_write      (on sys_write)
      
        You can now use it in all perf tools, such as:
      
      	perf record -e probe:sys_write -aR sleep 1
      
      Build with NO_DWARF=1:
      
        # ./perf probe -L sys_write
          Error: switch `L' is not available because NO_DWARF=1
      
         Usage: perf probe [<options>] 'PROBEDEF' ['PROBEDEF' ...]
            or: perf probe [<options>] --add 'PROBEDEF' [--add 'PROBEDEF' ...]
            or: perf probe [<options>] --del '[GROUP:]EVENT' ...
            or: perf probe --list [GROUP:]EVENT ...
            or: perf probe [<options>] --funcs
      
          -L, --line <FUNC[:RLN[+NUM|-RLN2]]|SRC:ALN[+NUM|-ALN2]>
                                Show source code lines.
                                (not built-in because NO_DWARF=1)
      
        # ./perf probe -k /tmp/vmlinux sys_write
          Warning: switch `k' is being ignored because NO_DWARF=1
        Added new event:
          probe:sys_write      (on sys_write)
      
        You can now use it in all perf tools, such as:
      
      	perf record -e probe:sys_write -aR sleep 1
      
        # ./perf probe --vmlinux /tmp/vmlinux sys_write
          Warning: option `vmlinux' is being ignored because NO_DWARF=1
        Added new event:
        [SNIP]
      
        # ./perf probe -l
         Usage: perf probe [<options>] 'PROBEDEF' ['PROBEDEF' ...]
            or: perf probe [<options>] --add 'PROBEDEF' [--add 'PROBEDEF' ...]
      ...
          -k, --vmlinux <file>  vmlinux pathname
                                (not built-in because NO_DWARF=1)
          -L, --line <FUNC[:RLN[+NUM|-RLN2]]|SRC:ALN[+NUM|-ALN2]>
                                Show source code lines.
                                (not built-in because NO_DWARF=1)
      ...
          -V, --vars <FUNC[@src][+OFF|%return|:RL|;PT]|SRC:AL|SRC;PT>
                                Show accessible variables on PROBEDEF
                                (not built-in because NO_DWARF=1)
              --externs         Show external variables too (with --vars only)
                                (not built-in because NO_DWARF=1)
              --no-inlines      Don't search inlined functions
                                (not built-in because NO_DWARF=1)
              --range           Show variables location range in scope (with --vars only)
                                (not built-in because NO_DWARF=1)
      Signed-off-by: NWang Nan <wangnan0@huawei.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1450089563-122430-14-git-send-email-wangnan0@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      48e1cab1
  9. 27 10月, 2015 1 次提交
  10. 03 10月, 2015 1 次提交
  11. 22 9月, 2015 1 次提交
  12. 15 9月, 2015 1 次提交
  13. 14 9月, 2015 1 次提交
  14. 04 9月, 2015 2 次提交
  15. 06 7月, 2015 1 次提交
  16. 12 5月, 2015 1 次提交
    • 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
  17. 09 5月, 2015 4 次提交
  18. 06 5月, 2015 4 次提交
  19. 04 5月, 2015 2 次提交
  20. 29 4月, 2015 1 次提交
  21. 10 4月, 2015 2 次提交
  22. 29 10月, 2014 3 次提交
  23. 18 9月, 2014 2 次提交
  24. 15 8月, 2014 1 次提交
  25. 10 6月, 2014 1 次提交
    • M
      perf probe: Show error code and description in verbose mode · b4bf1130
      Masami Hiramatsu 提交于
      Show error code and description only in verbose mode if 'perf probe'
      command failed.
      
      Current 'perf probe' shows error code with final error message, and that
      is meaningless for many users.
      
      This changes error messages to show the error code and its description
      only in verbose mode (-v option).
      
      Without this patch:
        -----
        # perf probe -a do_execve@hoge
        Probe point 'do_execve@hoge' not found.
          Error: Failed to add events. (-2)
        -----
      
      With this patch, normally the message doesn't show the misterious error
      number:
        -----
        # perf probe -a do_execve@hoge
        Probe point 'do_execve@hoge' not found.
          Error: Failed to add events.
        -----
      
      And in verbose mode, it also shows additional error messages as below:
        -----
        # perf probe -va do_execve@hoge
        probe-definition(0): do_execve@hoge
        symbol:do_execve file:hoge line:0 offset:0 return:0 lazy:(null)
        0 arguments
        Looking at the vmlinux_path (6 entries long)
        Using /lib/modules/3.15.0-rc8+/build/vmlinux for symbols
        Open Debuginfo file: /lib/modules/3.15.0-rc8+/build/vmlinux
        Try to find probe point from debuginfo.
        Probe point 'do_execve@hoge' not found.
          Error: Failed to add events. Reason: No such file or directory (Code: -2)
        -----
      Reported-by: NArnaldo Carvalho de Melo <acme@kernel.org>
      Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      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/20140606071352.6788.76943.stgit@kbuild-fedora.novalocalSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b4bf1130
  26. 18 2月, 2014 1 次提交