1. 23 6月, 2016 1 次提交
  2. 16 6月, 2016 1 次提交
  3. 18 12月, 2015 1 次提交
  4. 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
  5. 27 10月, 2015 1 次提交
  6. 03 10月, 2015 1 次提交
  7. 22 9月, 2015 1 次提交
  8. 15 9月, 2015 1 次提交
  9. 14 9月, 2015 1 次提交
  10. 04 9月, 2015 2 次提交
  11. 06 7月, 2015 1 次提交
  12. 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
  13. 09 5月, 2015 4 次提交
  14. 06 5月, 2015 4 次提交
  15. 04 5月, 2015 2 次提交
  16. 29 4月, 2015 1 次提交
  17. 10 4月, 2015 2 次提交
  18. 29 10月, 2014 3 次提交
  19. 18 9月, 2014 2 次提交
  20. 15 8月, 2014 1 次提交
  21. 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
  22. 18 2月, 2014 1 次提交
  23. 17 1月, 2014 1 次提交
  24. 26 12月, 2013 2 次提交
    • M
      perf probe: Support basic dwarf-based operations on uprobe events · fb7345bb
      Masami Hiramatsu 提交于
      Support basic dwarf(debuginfo) based operations for uprobe events.  With
      this change, perf probe can analyze debuginfo of user application binary
      to set up new uprobe event.
      
      This allows perf-probe --add(with local variables, line numbers) and
      --line works with -x option.  (Actually, --vars has already accepted -x
      option)
      
      For example, the following command shows the probe-able lines of a given
      user space function. Something that so far was only available in the
      'perf probe' tool for kernel space functions:
      
        # ./perf probe -x perf --line map__load
        <map__load@/home/fedora/ksrc/linux-2.6/tools/perf/util/map.c:0>
              0  int map__load(struct map *map, symbol_filter_t filter)
              1  {
              2         const char *name = map->dso->long_name;
                        int nr;
      
              5         if (dso__loaded(map->dso, map->type))
              6                 return 0;
      
              8         nr = dso__load(map->dso, map, filter);
              9         if (nr < 0) {
             10                 if (map->dso->has_build_id) {
      
      And this shows the available variables at the given line of the
      function.
      
        # ./perf probe -x perf --vars map__load:8
        Available variables at map__load:8
                @<map__load+96>
                        char*   name
                        struct map*     map
                        symbol_filter_t filter
                @<map__find_symbol+112>
                        char*   name
                        symbol_filter_t filter
                @<map__find_symbol_by_name+136>
                        char*   name
                        symbol_filter_t filter
                @<map_groups__find_symbol_by_name+176>
                        char*   name
                        struct map*     map
                        symbol_filter_t filter
      
      And lastly, we can now define probe(s) with all available
      variables on the given line:
      
        # ./perf probe -x perf --add 'map__load:8 $vars'
      
        Added new events:
          probe_perf:map__load (on map__load:8 with $vars)
          probe_perf:map__load_1 (on map__load:8 with $vars)
          probe_perf:map__load_2 (on map__load:8 with $vars)
          probe_perf:map__load_3 (on map__load:8 with $vars)
      
        You can now use it in all perf tools, such as:
      
                perf record -e probe_perf:map__load_3 -aR sleep 1
      
        Changes from previous version:
         - Add examples in the patch description.
         - Use .text section start address and dwarf symbol address
           for calculating the offset of given symbol, instead of
           searching the symbol in symtab again.
           With this change, we can safely handle multiple local
           function instances (e.g. scnprintf in perf).
      Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: David A. Long <dave.long@linaro.org>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: systemtap@sourceware.org
      Cc: yrl.pp-manager.tt@hitachi.com
      Link: http://lkml.kernel.org/r/20131226054152.22364.47021.stgit@kbuild-fedora.novalocalSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      fb7345bb
    • M
      perf probe: Expand given path to absolute path · 8a613d40
      Masami Hiramatsu 提交于
      Expand given path to absolute path in the option parser, except for a
      module name.
      
      Since realpath at later stage in processing several probe point, can be
      called several times (even if currently doesn't, it can happen when we
      expands the feature), it is waste of the performance.
      
      Processing it once at the early stage can avoid that.
      
      Changes from previous one:
       - Fix not to print null string.
       - Allocate memory for given path/module name everytime.
      Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: "David A. Long" <dave.long@linaro.org>
      Cc: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: systemtap@sourceware.org
      Cc: yrl.pp-manager.tt@hitachi.com
      Link: http://lkml.kernel.org/r/20131226054150.22364.12187.stgit@kbuild-fedora.novalocal
      [ Clarified the pr_warning message as per David Ahern's suggestion ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      8a613d40
  25. 17 12月, 2013 1 次提交
    • B
      tools/: Convert to new topic libraries · 553873e1
      Borislav Petkov 提交于
      Move debugfs.* to api/fs/. We have a common tools/lib/api/ place where
      the Makefile lives and then we place the headers in subdirs.
      
      For example, all the fs-related stuff goes to tools/lib/api/fs/ from
      which we get libapikfs.a (acme got almost the naming he wanted :-)) and
      we link it into the tools which need it - in this case perf and
      tools/vm/page-types.
      
      acme:
      
      "Looking at the implementation, I think some tools can even link
      directly to the .o files, avoiding the .a file altogether.
      
      But that is just an optimization/finer granularity tools/lib/
      cherrypicking that toolers can make use of."
      
      Fixup documentation cleaning target while at it.
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Acked-by: NIngo Molnar <mingo@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Robert Richter <rric@kernel.org>
      Cc: Stanislav Fomichev <stfomichev@yandex-team.ru>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Link: http://lkml.kernel.org/r/1386605664-24041-2-git-send-email-bp@alien8.deSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      553873e1
  26. 15 11月, 2013 1 次提交
  27. 09 10月, 2013 1 次提交