19 Jul, 2017

2 commits

  • Teach buildid-cache how to add, remove, and update binary objects from
    other mount namespaces. Allow probe events tracing binaries in
    different namespaces to add their objects to the probe and build-id
    caches too. As a handy side effect, this also lets us access SDT probes
    in binaries from alternate mount namespaces.

    Signed-off-by: Krister Johansen
    Tested-by: Brendan Gregg
    Cc: Alexander Shishkin
    Cc: Peter Zijlstra
    Cc: Thomas-Mich Richter
    Link: http://lkml.kernel.org/r/1499305693-1599-5-git-send-email-kjlx@templeofstupid.com
    [ Add util/namespaces.c to tools/perf/util/python-ext-sources, to fix the python binding 'perf test' ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Krister Johansen
     
  • Teaches perf how to place a uprobe on a file that's in a different mount
    namespace. The user must add the probe using the --target-ns argument
    to perf probe. Once it has been placed, it may be recorded against
    without further namespace-specific commands.

    Signed-off-by: Krister Johansen
    Cc: Alexander Shishkin
    Cc: Brendan Gregg
    Cc: Peter Zijlstra
    Cc: Ravi Bangoria
    [ PPC build fixed by Ravi: ]
    Link: http://lkml.kernel.org/r/1500287542-6219-1-git-send-email-ravi.bangoria@linux.vnet.ibm.com
    Cc: Thomas-Mich Richter
    [ Fix !HAVE_DWARF_SUPPORT build ]
    Link: http://lkml.kernel.org/r/1499305693-1599-4-git-send-email-kjlx@templeofstupid.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Krister Johansen
     

03 May, 2017

1 commit

  • Pull trivial tree updates from Jiri Kosina.

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial:
    tty: fix comment for __tty_alloc_driver()
    init/main: properly align the multi-line comment
    init/main: Fix double "the" in comment
    Fix dead URLs to ftp.kernel.org
    drivers: Clean up duplicated email address
    treewide: Fix typo in xml/driver-api/basics.xml
    tools/testing/selftests/powerpc: remove redundant CFLAGS in Makefile: "-Wall -O2 -Wall" -> "-O2 -Wall"
    selftests/timers: Spelling s/privledges/privileges/
    HID: picoLCD: Spelling s/REPORT_WRTIE_MEMORY/REPORT_WRITE_MEMORY/
    net: phy: dp83848: Fix Typo
    UBI: Fix typos
    Documentation: ftrace.txt: Correct nice value of 120 priority
    net: fec: Fix typo in error msg and comment
    treewide: Fix typos in printk

    Linus Torvalds
     

27 Mar, 2017

1 commit

  • We got it from the git sources but never used it for anything, with the
    place where this would be somehow used remaining:

    static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
    {
    prefix = NULL;
    if (p->option & RUN_SETUP)
    prefix = NULL; /* setup_perf_directory(); */

    Ditch it.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-uw5swz05vol0qpr32c5lpvus@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

24 Mar, 2017

1 commit

  • This patch fix some spelling typos found in printk.

    [jkosina@suse.cz: drop arch/arm64/kernel/hibernate.c that was already
    in place]
    Signed-off-by: Masanari Iida
    Acked-by: Randy Dunlap
    Signed-off-by: Jiri Kosina

    Masanari Iida
     

21 Mar, 2017

1 commit

  • On old perf, when using 'perf probe -d' to delete an inexistent event,
    it returns errno, eg,

    -bash-4.3# perf probe -d xxx || echo $?
    Info: Event "*:xxx" does not exist.
    Error: Failed to delete events.
    255

    But now perf_del_probe_events() will always set ret = 0, different from
    previous del_perf_probe_events(). After this, it returns errno again,
    eg,

    -bash-4.3# ./perf probe -d xxx || echo $?
    "xxx" does not hit any event.
    Error: Failed to delete events.
    254

    And it is more appropriate to return -ENOENT instead of -EPERM.

    Signed-off-by: Kefeng Wang
    Acked-by: Masami Hiramatsu
    Cc: Hanjun Guo
    Cc: Jiri Olsa
    Cc: Peter Zijlstra
    Cc: Wang Nan
    Fixes: dddc7ee32fa1 ("perf probe: Fix an error when deleting probes successfully")
    Link: http://lkml.kernel.org/r/1489738592-61011-1-git-send-email-wangkefeng.wang@huawei.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Kefeng Wang
     

08 Feb, 2017

1 commit

  • perf probe makes use of debug symbols, so add --symfs as the other
    commands have.

    Signed-off-by: Uwe Kleine-König
    Cc: Alexander Shishkin
    Cc: Jiri Olsa
    Cc: Peter Zijlstra
    Cc: kernel@pengutronix.de
    Link: http://lkml.kernel.org/r/1469094512-13440-2-git-send-email-u.kleine-koenig@pengutronix.de
    Signed-off-by: Arnaldo Carvalho de Melo

    Uwe Kleine-König
     

01 Sep, 2016

3 commits

  • Ignore vmlinux build-id when user gives offline vmlinux if the command
    does not affect running kernel.

    perf-probe has several actions some of them does not change the running
    kernel, like --lines, --vars, and --funcs.

    e.g.
    -----
    $ ./perf probe -k ./vmlinux-arm -V do_sys_open:14
    Available variables at do_sys_open:14
    @
    char* filename
    int dfd
    int fd
    int flags
    struct filename* tmp
    struct open_flags op
    umode_t mode
    -----

    Signed-off-by: Masami Hiramatsu
    Cc: Jiri Olsa
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/147222347320.5088.2582658035296667520.stgit@devbox
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     
  • Ignore the buildid of running kernel when both of --definition and
    --vmlinux is given because that kernel should be off-line.

    This also skips post-processing of kprobe event for relocating symbol
    and checking blacklist, because it can not be done on off-line kernel.

    E.g. without this fix perf shows an error as below
    ----
    $ perf probe --vmlinux=./vmlinux-arm --definition do_sys_open
    ./vmlinux-arm with build id 7a1f76dd56e9c4da707cd3d6333f50748141434b not found, continuing without symbols
    Failed to find symbol do_sys_open in kernel
    Error: Failed to add events.
    ----
    with this fix, we can get the definition
    ----
    $ perf probe --vmlinux=./vmlinux-arm --definition do_sys_open
    p:probe/do_sys_open do_sys_open+0
    ----

    Signed-off-by: Masami Hiramatsu
    Cc: Jiri Olsa
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/147214228193.23638.12581984840822162131.stgit@devbox
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     
  • Add --definition/-D option for showing the trace-event definition in
    stdout. This can be useful in debugging or combined with a shell script.

    e.g.
    ----
    # perf probe --definition 'do_sys_open $params'
    p:probe/do_sys_open _text+2261728 dfd=%di:s32 filename=%si:u64 flags=%dx:s32 mode=%cx:u16
    ----

    Suggested-and-Tested-by: Arnaldo Carvalho de Melo
    Signed-off-by: Masami Hiramatsu
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/147214226712.23638.2240534040014013658.stgit@devbox
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     

14 Jul, 2016

1 commit

  • Make "perf probe --cache --list" show only available cached events by
    checking build-id validity.

    E.g. without this patch:
    ----
    $ ./perf probe --cache --add oldevent=cmd_probe
    $ make #(to update ./perf)
    $ ./perf probe --cache --add newevent=cmd_probe
    $ ./perf probe --cache --list
    /home/mhiramat/ksrc/linux/tools/perf/perf (061e90539bac69
    probe_perf:newevent=cmd_probe
    /home/mhiramat/ksrc/linux/tools/perf/perf (c2e44d614e33e1
    probe_perf:oldevent=cmd_probe
    ----
    It shows both of old and new events but user can not use old one.
    With this;
    ----
    $ ./perf probe --cache -l
    /home/mhiramat/ksrc/linux/tools/perf/perf (061e90539bac69
    probe_perf:newevent=cmd_probe
    ----

    This shows only new events which are on the existing binary.

    Signed-off-by: Masami Hiramatsu
    Signed-off-by: Masami Hiramatsu
    Cc: Ananth N Mavinakayanahalli
    Cc: Brendan Gregg
    Cc: Hemant Kumar
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/146831789417.17065.17896487479879669610.stgit@devbox
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     

13 Jul, 2016

1 commit

  • 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
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-d4t42fnf48ytlk8rjxs822tf@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

01 Jul, 2016

2 commits

  • 'perf probe --del' removes caches when '--cache' is given. Note that
    the delete pattern is not the same as for normal events.

    If you cached probes with event name, --del "eventname" works as
    expected. However, if you skipped it, the cached probes doesn't have
    actual event name. In that case --del "probe-desc" is required (wildcard
    is acceptable). For example a cache entry has the probe-desc "vfs_read
    $params", you can remove it with --del 'vfs_read*'.

    -----
    # perf probe --cache --list
    /[kernel.kallsyms] (1466a0a250b5d0070c6d0f03c5fed30b237970a1):
    vfs_read $params
    /usr/lib64/libc-2.17.so (c31ffe7942bfd77b2fca8f9bd5709d387a86d3bc):
    getaddrinfo $params

    # perf probe --cache --del vfs_read\*
    Removed cached event: probe:vfs_read

    # perf probe --cache --list
    /[kernel.kallsyms] (1466a0a250b5d0070c6d0f03c5fed30b237970a1):
    /usr/lib64/libc-2.17.so (c31ffe7942bfd77b2fca8f9bd5709d387a86d3bc):
    getaddrinfo $params
    -----

    Signed-off-by: Masami Hiramatsu
    Signed-off-by: Masami Hiramatsu
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Ananth N Mavinakayanahalli
    Cc: Brendan Gregg
    Cc: Hemant Kumar
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/146736021651.27797.10250879847070772920.stgit@devbox
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     
  • perf probe --list shows all cached probes when --cache is given. Each
    caches are shown with on which binary that probed. E.g.:

    -----
    # perf probe --cache vfs_read \$params
    # perf probe --cache -x /lib64/libc-2.17.so getaddrinfo \$params
    # perf probe --cache --list
    [kernel.kallsyms] (1466a0a250b5d0070c6d0f03c5fed30b237970a1):
    vfs_read $params
    /usr/lib64/libc-2.17.so (c31ffe7942bfd77b2fca8f9bd5709d387a86d3bc):
    getaddrinfo $params
    -----

    Note that $params requires debuginfo.

    Signed-off-by: Masami Hiramatsu
    Signed-off-by: Masami Hiramatsu
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Ananth N Mavinakayanahalli
    Cc: Brendan Gregg
    Cc: Hemant Kumar
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/146736020674.27797.13488316780383460180.stgit@devbox
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     

23 Jun, 2016

1 commit


16 Jun, 2016

1 commit

  • Add --cache option to cache the probe definitions. This just saves the
    result of the dwarf analysis to probe cache.

    Signed-off-by: Masami Hiramatsu
    Signed-off-by: Masami Hiramatsu
    Cc: Ananth N Mavinakayanahalli
    Cc: Brendan Gregg
    Cc: Hemant Kumar
    Cc: Masami Hiramatsu
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20160615032840.31330.44412.stgit@devbox
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     

18 Dec, 2015

1 commit

  • Move the subcommand-related files from perf to a new library named
    libsubcmd.a.

    Since we're moving files anyway, go ahead and rename 'exec_cmd.*' to
    'exec-cmd.*' to be consistent with the naming of all the other files.

    Signed-off-by: Josh Poimboeuf
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/c0a838d4c878ab17fee50998811612b2281355c1.1450193761.git.jpoimboe@redhat.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Josh Poimboeuf
     

14 Dec, 2015

1 commit

  • 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 [] 'PROBEDEF' ['PROBEDEF' ...]
    or: perf probe [] --add 'PROBEDEF' [--add 'PROBEDEF' ...]
    or: perf probe [] --del '[GROUP:]EVENT' ...
    or: perf probe --list [GROUP:]EVENT ...
    or: perf probe [] --funcs

    -L, --line
    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 [] 'PROBEDEF' ['PROBEDEF' ...]
    or: perf probe [] --add 'PROBEDEF' [--add 'PROBEDEF' ...]
    ...
    -k, --vmlinux vmlinux pathname
    (not built-in because NO_DWARF=1)
    -L, --line
    Show source code lines.
    (not built-in because NO_DWARF=1)
    ...
    -V, --vars
    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: Wang Nan
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Alexei Starovoitov
    Cc: Jiri Olsa
    Cc: Masami Hiramatsu
    Cc: Namhyung Kim
    Cc: Zefan Li
    Cc: pi3orama@163.com
    Link: http://lkml.kernel.org/r/1450089563-122430-14-git-send-email-wangnan0@huawei.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Wang Nan
     

27 Oct, 2015

1 commit

  • Now usage_with_options() setup a pager before printing message so normal
    printf() or pr_err() will not be shown. The usage_with_options_msg()
    can be used to print some help message before usage strings.

    Signed-off-by: Namhyung Kim
    Acked-by: Masami Hiramatsu
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1445701767-12731-4-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     

03 Oct, 2015

1 commit

  • Allow probing on kernel modules when 'perf' is built without debuginfo
    support.

    Currently perf-probe --module requires linking with libdw, but this
    doesn't make sense.

    E.g.
    ----
    # make NO_DWARF=1
    # ./perf probe -m pcspkr pcspkr_event%return
    Error: unknown switch `m'
    ----

    With this patch
    ----
    # ./perf probe -m pcspkr pcspkr_event%return
    Added new event:
    probe:pcspkr_event (on pcspkr_event%return in pcspkr)

    You can now use it in all perf tools, such as:

    perf record -e probe:pcspkr_event -aR sleep 1
    ----

    Signed-off-by: Masami Hiramatsu
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/r/20151002125832.18617.78721.stgit@localhost.localdomain
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     

22 Sep, 2015

1 commit

  • Fix a segfault bug and a small mistake in perf probe -d.

    Since the "ulist" in perf_del_probe_events is never initialized,
    strlist__add(ulist, *) always causes a segfault when removing
    uprobe events by perf probe -d.

    Also, the "str" local variable is never released if fail to
    allocate the "klist". This fixes it too.

    This has been introduced by the commit e607f1426b58 ("perf probe:
    Print deleted events in cmd_probe()").

    Reported-by: Milian Wolff
    Signed-off-by: Masami Hiramatsu
    Cc: Namhyung Kim
    Link: http://lkml.kernel.org/r/20150916125241.4446.44805.stgit@localhost.localdomain
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     

15 Sep, 2015

1 commit

  • The init/exit_symbols_maps() functions are to setup and cleanup
    necessary info for probe events. But they need to be called from out of
    the probe code now, so this patch exports them.

    However the names are too generic, so change them to have 'probe'. :)

    Signed-off-by: Namhyung Kim
    Acked-by: Masami Hiramatsu
    Cc: Jiri Olsa
    Cc: Peter Zijlstra
    Cc: Wang Nan
    Link: http://lkml.kernel.org/r/1441852026-28974-2-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     

14 Sep, 2015

1 commit


04 Sep, 2015

2 commits

  • Showing actual trace event when deleteing perf events is only needed in
    perf probe command. But the add functionality itself can be used by
    other places. So move the printing code into the cmd_probe().

    The output is not changed.

    Signed-off-by: Namhyung Kim
    Cc: Jiri Olsa
    Cc: Masami Hiramatsu
    Cc: Peter Zijlstra
    Cc: Wang Nan
    Cc: pi3orama@163.com
    Link: http://lkml.kernel.org/r/1441368963-11565-5-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • Showing actual trace event when adding perf events is only needed in
    perf probe command. But the add functionality itself can be used by
    other places. So move the printing code into the cmd_probe().

    Also it combines the output if more than one event is added.

    Before:
    $ sudo perf probe -a do_fork -a do_exit
    Added new event:
    probe:do_fork (on do_fork)

    You can now use it in all perf tools, such as:

    perf record -e probe:do_fork -aR sleep 1

    Added new events:
    probe:do_exit (on do_exit)
    probe:do_exit_1 (on do_exit)

    You can now use it in all perf tools, such as:

    perf record -e probe:do_exit_1 -aR sleep 1

    After:
    $ sudo perf probe -a do_fork -a do_exit
    Added new events:
    probe:do_fork (on do_fork)
    probe:do_exit (on do_exit)
    probe:do_exit_1 (on do_exit)

    You can now use it in all perf tools, such as:

    perf record -e probe:do_exit_1 -aR sleep 1

    Signed-off-by: Namhyung Kim
    Tested-by: Arnaldo Carvalho de Melo
    Acked-by: Masami Hiramatsu
    Cc: Jiri Olsa
    Cc: Peter Zijlstra
    Cc: Wang Nan
    Cc: pi3orama@163.com
    Link: http://lkml.kernel.org/r/1441368963-11565-3-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     

06 Jul, 2015

1 commit

  • The strfilter__delete() function tests whether its argument is NULL and
    then returns immediately. Thus the test around the call is not needed.

    This issue was detected by using the Coccinelle software.

    Signed-off-by: Markus Elfring
    Acked-by: Masami Hiramatsu
    Cc: Julia Lawall
    Cc: Peter Zijlstra
    Cc: kernel-janitors@vger.kernel.org
    Link: http://lkml.kernel.org/r/5597751A.5000506@users.sourceforge.net
    Signed-off-by: Arnaldo Carvalho de Melo

    Markus Elfring
     

12 May, 2015

1 commit

  • 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():


    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
    @
    [INV] ssize_t written @
    [INV] struct address_space_operations* a_ops @
    [VAL] (unknown_type) fsdata @
    [VAL] loff_t pos @
    [VAL] long int status @
    [VAL] long unsigned int bytes @
    [VAL] struct address_space* mapping @
    [VAL] struct iov_iter* i @
    [VAL] struct page* page @

    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: He Kuang
    Acked-by: Masami Hiramatsu
    Cc: Jiri Olsa
    Cc: Peter Zijlstra
    Cc: Wang Nan
    Link: http://lkml.kernel.org/r/1431336304-16863-2-git-send-email-hekuang@huawei.com
    Signed-off-by: Arnaldo Carvalho de Melo

    He Kuang
     

09 May, 2015

4 commits

  • Add --no-inlines(--inlines) option to avoid searching inline functions.

    Searching all functions which matches glob pattern can take a long time
    and find a lot of inline functions.

    With this option perf-probe searches target on the non-inlined
    functions.

    Signed-off-by: Masami Hiramatsu
    Cc: Ananth N Mavinakayanahalli
    Cc: David Ahern
    Cc: Hemant Kumar
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20150508010333.24812.86568.stgit@localhost.localdomain
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     
  • Introduce probe_conf global configuration parameters for probe-event and
    probe-finder, and removes related parameters from APIs.

    Signed-off-by: Masami Hiramatsu
    Cc: Ananth N Mavinakayanahalli
    Cc: David Ahern
    Cc: Hemant Kumar
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20150508010330.24812.21095.stgit@localhost.localdomain
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     
  • Use perf_probe_event.target field for the target binary instead of
    passing it as an argument.

    Signed-off-by: Masami Hiramatsu
    Cc: Ananth N Mavinakayanahalli
    Cc: David Ahern
    Cc: Hemant Kumar
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20150508010328.24812.67887.stgit@localhost.localdomain
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     
  • Fix to return 0 when positive value returned from probe command.

    At least --vars can returns a positive value if it found a point.
    ----
    # perf probe --vars vfs_read && echo succeeded! || echo failed!
    Available variables at vfs_read
    @
    char* buf
    loff_t* pos
    size_t count
    struct file* file
    failed!
    ----

    This fixes above problem.
    ----
    # perf probe --vars vfs_read && echo succeeded! || echo failed!
    Available variables at vfs_read
    @
    char* buf
    loff_t* pos
    size_t count
    struct file* file
    succeeded!
    ----

    Signed-off-by: Masami Hiramatsu
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Ananth N Mavinakayanahalli
    Cc: David Ahern
    Cc: Hemant Kumar
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20150506124645.4961.56973.stgit@localhost.localdomain
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     

06 May, 2015

4 commits

  • To simplify the 'perf probe' command code, consolidate some similar
    functions and use command short-name for command classification, instead
    of separate booleans.

    Signed-off-by: Masami Hiramatsu
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20150505152257.18790.41548.stgit@localhost.localdomain
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     
  • Since params.filter will be released in cleanup_params, we don't need to
    clear it in each command.

    Signed-off-by: Masami Hiramatsu
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20150505022952.23399.58072.stgit@localhost.localdomain
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     
  • This allows the user to pass the filter pattern directly to the --funcs
    option as below:

    ----
    # ./perf probe -F *kmalloc
    __kmalloc
    devm_kmalloc
    mempool_kmalloc
    sg_kmalloc
    sock_kmalloc
    ----

    We previously needed to use the --filter option for that.

    Signed-off-by: Masami Hiramatsu
    Tested-by: Arnaldo Carvalho de Melo
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20150505022950.23399.22435.stgit@localhost.localdomain
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     
  • This makes perf-probe --del option to accept filter rules
    not only simple glob pattern. This simplifies the code and
    improve the flexibility.

    E.g. if we remove 2 different pattern events, we need 2
    -d options.
    ----
    # ./perf probe -d vfs\* -d malloc
    Removed event: probe_libc:malloc
    Removed event: probe:vfs_read
    ----

    This allows you to joint the 2 patterns with '|'.

    ----
    # ./perf probe -d 'vfs*|malloc'
    Removed event: probe:vfs_read
    Removed event: probe_libc:malloc
    ----

    Signed-off-by: Masami Hiramatsu
    Tested-by: Arnaldo Carvalho de Melo
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20150505022948.23399.4197.stgit@localhost.localdomain
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     

04 May, 2015

2 commits

  • Currently, perf-probe --list option ignores given event filter.
    ----
    # ./perf probe -l vfs\*
    probe:vfs_read (on vfs_read@ksrc/linux-3/fs/read_write.c)
    probe_libc:malloc (on __libc_malloc@malloc/malloc.c in /usr/lib64/libc-2.17.so)
    ----

    This changes --list option to accept the event filter argument as below.
    ----
    # ./perf probe -l vfs\*
    probe:vfs_read (on vfs_read@ksrc/linux-3/fs/read_write.c)
    # ./perf probe -l \*libc:\*
    probe_libc:malloc (on __libc_malloc@malloc/malloc.c in /usr/lib64/libc-2.17.so)
    ----

    Signed-off-by: Masami Hiramatsu
    Tested-by: Arnaldo Carvalho de Melo
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20150424094750.23967.53868.stgit@localhost.localdomain
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     
  • Accept multiple filter options. Each filters are combined by logical-or.
    E.g. --filter abc* --filter *def is same as --filter abc*|*def

    Signed-off-by: Masami Hiramatsu
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20150424094748.23967.63355.stgit@localhost.localdomain
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     

29 Apr, 2015

1 commit

  • The --funcs option should be given exclusively. This adds
    PARSE_OPT_EXCUSIVE flag on --funcs (-F) option.

    Without this, 'perf probe --funcs -l' just shows the list of probes.

    With this, it shows error message correctly.

    This also fixes the help message and the documentation.

    Signed-off-by: Masami Hiramatsu
    Tested-by: Arnaldo Carvalho de Melo
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20150423134612.26128.58189.stgit@localhost.localdomain
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     

10 Apr, 2015

2 commits

  • To avoid probing in unintended binary, the orphaned -x option must be
    checked and warned.

    Without this patch, following command sets up the probe in the kernel.

    -----
    # perf probe -a strcpy -x ./perf
    Added new event:
    probe:strcpy (on strcpy)

    You can now use it in all perf tools, such as:

    perf record -e probe:strcpy -aR sleep 1
    -----

    But in this case, it seems that the user may want to probe in the perf
    binary. With this patch, perf-probe correctly handles the orphaned -x.

    -----
    # perf probe -a strcpy -x ./perf
    Error: -x/-m must follow the probe definitions.
    ...
    -----

    Reported-by: Jiri Olsa
    Acked-by: Jiri Olsa
    Cc: David Ahern
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20150401102541.17137.75477.stgit@localhost.localdomain
    Signed-off-by: Masami Hiramatsu
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu
     
  • Support multiple probes on different binaries with just
    one command.

    In the result, this example sets up the probes on icmp_rcv in
    kernel, on main and set_target in perf, and on pcspkr_event
    in pcspker.ko driver.
    -----
    # perf probe -a icmp_rcv -x ./perf -a main -a set_target \
    -m /lib/modules/4.0.0-rc5+/kernel/drivers/input/misc/pcspkr.ko \
    -a pcspkr_event
    Added new event:
    probe:icmp_rcv (on icmp_rcv)

    You can now use it in all perf tools, such as:

    perf record -e probe:icmp_rcv -aR sleep 1

    Added new event:
    probe_perf:main (on main in /home/mhiramat/ksrc/linux-3/tools/perf/perf)

    You can now use it in all perf tools, such as:

    perf record -e probe_perf:main -aR sleep 1

    Added new event:
    probe_perf:set_target (on set_target in /home/mhiramat/ksrc/linux-3/tools/perf/perf)

    You can now use it in all perf tools, such as:

    perf record -e probe_perf:set_target -aR sleep 1

    Added new event:
    probe:pcspkr_event (on pcspkr_event in pcspkr)

    You can now use it in all perf tools, such as:

    perf record -e probe:pcspkr_event -aR sleep 1
    -----

    Reported-by: Arnaldo Carvalho de Melo
    Signed-off-by: Masami Hiramatsu
    Tested-by: Arnaldo Carvalho de Melo
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20150401102539.17137.46454.stgit@localhost.localdomain
    Signed-off-by: Arnaldo Carvalho de Melo

    Masami Hiramatsu