10 Dec, 2017

1 commit

  • [ Upstream commit c896f85a7c15ab9d040ffac8b8003e47996602a2 ]

    Let's free the allocated rec_argv in case we return early, in order to
    avoid leaking memory.

    This adds free() at a few very similar places across the tree where it
    was missing.

    Signed-off-by: Martin Kepplinger
    Cc: Alexander Shishkin
    Cc: Martin kepplinger
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20170913191419.29806-1-martink@posteo.de
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Martin Kepplinger
     

09 Nov, 2017

1 commit

  • Otherwise 'perf trace' leaves a temporary file /tmp/perf-vdso.so-XXXXXX.

    $ perf trace -o log true
    $ ls -l /tmp/perf-vdso.*
    -rw------- 1 root root 8192 Nov 8 03:08 /tmp/perf-vdso.so-5bCpD0

    Signed-off-by: Andrei Vagin
    Reviewed-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Vasily Averin
    Link: http://lkml.kernel.org/r/20171108002246.8924-1-avagin@openvz.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Andrei Vagin
     

02 Sep, 2017

1 commit

  • So now we can use:

    # perf trace -e pkey_*
    532.784 ( 0.006 ms): pkey/16018 pkey_alloc(init_val: DISABLE_WRITE) = -1 EINVAL Invalid argument
    532.795 ( 0.004 ms): pkey/16018 pkey_mprotect(start: 0x7f380d0a6000, len: 4096, prot: READ|WRITE, pkey: -1) = 0
    532.801 ( 0.002 ms): pkey/16018 pkey_free(pkey: -1 ) = -1 EINVAL Invalid argument
    ^C[root@jouet ~]#

    Or '-e epoll*', '-e *msg*', etc.

    Combining syscall names with perf events, tracepoints, etc, continues to
    be valid, i.e. this is possible:

    # perf probe -L sys_nanosleep

    0 SYSCALL_DEFINE2(nanosleep, struct timespec __user *, rqtp,
    struct timespec __user *, rmtp)
    {
    struct timespec64 tu;

    5 if (get_timespec64(&tu, rqtp))
    6 return -EFAULT;

    if (!timespec64_valid(&tu))
    9 return -EINVAL;

    11 current->restart_block.nanosleep.type = rmtp ? TT_NATIVE : TT_NONE;
    12 current->restart_block.nanosleep.rmtp = rmtp;
    13 return hrtimer_nanosleep(&tu, HRTIMER_MODE_REL, CLOCK_MONOTONIC);
    }

    # perf probe my_probe="sys_nanosleep:12 rmtp"
    Added new event:
    probe:my_probe (on sys_nanosleep:12 with rmtp)

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

    perf record -e probe:my_probe -aR sleep 1

    #
    # perf trace -e probe:my_probe/max-stack=5/,*sleep sleep 1
    0.427 ( 0.003 ms): sleep/16690 nanosleep(rqtp: 0x7ffefc245090) ...
    0.430 ( ): probe:my_probe:(ffffffffbd112923) rmtp=0)
    sys_nanosleep ([kernel.kallsyms])
    do_syscall_64 ([kernel.kallsyms])
    return_from_SYSCALL_64 ([kernel.kallsyms])
    __nanosleep_nocancel (/usr/lib64/libc-2.25.so)
    0.427 (1000.208 ms): sleep/16690 ... [continued]: nanosleep()) = 0
    #

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

    Arnaldo Carvalho de Melo
     

29 Aug, 2017

1 commit

  • Reuse 'mprotect' beautifiers for 'pkey_mprotect'.

    System wide tracing pkey_alloc, pkey_free and pkey_mprotect calls, with
    backtraces:

    # perf trace -e pkey_alloc,pkey_mprotect,pkey_free --max-stack=5
    0.000 ( 0.011 ms): pkey/7818 pkey_alloc(init_val: DISABLE_ACCESS|DISABLE_WRITE) = -1 EINVAL Invalid argument
    syscall (/usr/lib64/libc-2.25.so)
    pkey_alloc (/home/acme/c/pkey)
    0.022 ( 0.003 ms): pkey/7818 pkey_mprotect(start: 0x7f28c3890000, len: 4096, prot: READ|WRITE, pkey: -1) = 0
    syscall (/usr/lib64/libc-2.25.so)
    pkey_mprotect (/home/acme/c/pkey)
    0.030 ( 0.002 ms): pkey/7818 pkey_free(pkey: -1 ) = -1 EINVAL Invalid argument
    syscall (/usr/lib64/libc-2.25.so)
    pkey_free (/home/acme/c/pkey)

    The tools/include/uapi/asm-generic/mman-common.h file is used to find
    the access rights defines for the pkey_alloc syscall second argument.

    Since we have the detector of changes for the tools/include header files
    versus its kernel origin (include/uapi/asm-generic/mman-common.h), we'll
    get whatever new flag appears for that argument automatically.

    This method should be used in other cases where it is easy to generate
    those flags tables because the header has properly namespaced defines
    like PKEY_DISABLE_ACCESS and PKEY_DISABLE_WRITE.

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

    Arnaldo Carvalho de Melo
     

18 Aug, 2017

1 commit

  • We need to consider the null terminator, oops, fix it.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Fixes: 017037ff3d0b ("perf trace: Allow specifying list of syscalls and events in -e/--expr/--event")
    Link: http://lkml.kernel.org/n/tip-j79jpqqe91gvxqmsgxgfn2ni@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

01 Aug, 2017

1 commit

  • By using the _IOC_(DIR,NR,TYPE,SIZE) macros to lookup a 'type' keyed
    table that then gets indexed by 'nr', falling back to a notation similar
    to the one used by 'strace', only more compact, i.e.:

    474.356 ( 0.007 ms): gnome-shell/22401 ioctl(fd: 8, cmd: (READ|WRITE, 0x64, 0xae, 0x1c), arg: 0x7ffc934f7880) = 0
    474.369 ( 0.053 ms): gnome-shell/22401 ioctl(fd: 8, cmd: (READ|WRITE, 0x64, 0xb0, 0x18), arg: 0x7ffc934f77d0) = 0
    505.055 ( 0.014 ms): gnome-shell/22401 ioctl(fd: 8, cmd: (READ|WRITE, 0x64, 0xaf, 0x4), arg: 0x7ffc934f741c) = 0

    This also moves it out of builtin-trace.c and into trace/beauty/ioctl.c
    to better compartimentalize all these formatters.

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

    Arnaldo Carvalho de Melo
     

21 Jul, 2017

1 commit

  • Avoiding a loop, so now its quite convenient to ssh to a machine and
    then simply do:

    # perf trace

    To trace all syscalls without causing a loop.

    This was possible using --filter-pids, i.e. once you noticed the loop,
    get the sshd pid and add it to --filter-pids, restarting the 'perf
    trace'.

    Now to figure out how to do that in a X terminal, the other common
    scenario, which is way more involved, as there are multiple processes
    communicating to process terminal activity...

    Using --filter-pids + '-e \!syscall,names,you,dont,need' may be a good
    approximation when having to do syswide tracing on your workstation.

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

    Arnaldo Carvalho de Melo
     

20 Jul, 2017

8 commits

  • No change in functionality, just to make clearer that what we want when
    filtering the tracer pid in a system wide tracing session is to avoid a
    feedback loop.

    This also paves the way for a more interesting loop avoidance algorithm,
    one that tries to figure out if we are in a ssh session, xterm, etc.

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

    Arnaldo Carvalho de Melo
     
  • Now, syswide tracing, selected entries:

    # trace -e clone
    24417.203 ( 0.158 ms): bash/11323 clone(flags: CHILD_CLEARTID|CHILD_SETTID|0x11, child_stack: 0, parent_tidptr: 0, child_tidptr: 0x7f0778e5c9d0, tls: 0x7f0778e5c700) = 11325 (bash)
    ? ( ? ): bash/11325 ... [continued]: clone()) = 0
    24419.355 ( 0.093 ms): bash/10586 clone(flags: CHILD_CLEARTID|CHILD_SETTID|0x11, child_stack: 0, parent_tidptr: 0, child_tidptr: 0x7f0778e5c9d0, tls: 0x7f0778e5c700) = 11326 (bash)
    ? ( ? ): bash/11326 ... [continued]: clone()) = 0
    24419.744 ( 0.102 ms): bash/11326 clone(flags: CHILD_CLEARTID|CHILD_SETTID|0x11, child_stack: 0, parent_tidptr: 0, child_tidptr: 0x7f0778e5c9d0, tls: 0x7f0778e5c700) = 11327 (bash)
    ? ( ? ): bash/11327 ... [continued]: clone()) = 0
    24420.138 ( 0.105 ms): bash/11327 clone(flags: CHILD_CLEARTID|CHILD_SETTID|0x11, child_stack: 0, parent_tidptr: 0, child_tidptr: 0x7f0778e5c9d0, tls: 0x7f0778e5c700) = 11328 (bash)
    ? ( ? ): bash/11328 ... [continued]: clone()) = 0
    35747.722 ( 0.044 ms): gpg-agent/18087 clone(flags: VM|FS|FILES|SIGHAND|THREAD|SYSVSEM|SETTLS|PARENT_SETTID|CHILD_CLEARTID, child_stack: 0x7ff0755f6ff0, parent_tidptr: 0x7ff0755f79d0, child_tidptr: 0x7ff0755f79d0, tls: 0x7ff0755f7700) = 11329 (gpg-agent)
    ? ( ? ): gpg-agent/11329 ... [continued]: clone()) = 0
    35748.359 ( 0.022 ms): gpg-agent/18087 clone(flags: VM|FS|FILES|SIGHAND|THREAD|SYSVSEM|SETTLS|PARENT_SETTID|CHILD_CLEARTID, child_stack: 0x7ff075df7ff0, parent_tidptr: 0x7ff075df89d0, child_tidptr: 0x7ff075df89d0, tls: 0x7ff075df8700) = 11330 (gpg-agent)
    ? ( ? ): gpg-agent/11330 ... [continued]: clone()) = 0
    35781.422 ( 0.452 ms): NetworkManager/1112 clone(flags: VM|FS|FILES|SIGHAND|THREAD|SYSVSEM|SETTLS|PARENT_SETTID|CHILD_CLEARTID, child_stack: 0x7f2f1fffedb0, parent_tidptr: 0x7f2f1ffff9d0, child_tidptr: 0x7f2f1ffff9d0, tls: 0x7f2f1ffff700) = 11331 (NetworkManager)
    ? ( ? ): NetworkManager/11331 ... [continued]: clone()) = 0

    Need to improve the formatting of the second return, to the child, this
    cset only focused on the argument formatting.

    If we trace just one pid:

    # trace -e clone -p 19863
    0.349 ( 0.025 ms): Chrome_IOThrea/19863 clone(flags: VM|FS|FILES|SIGHAND|THREAD|SYSVSEM|SETTLS|PARENT_SETTID|CHILD_CLEARTID, child_stack: 0x7ffb84eaac70, parent_tidptr: 0x7ffb84eab9d0, child_tidptr: 0x7ffb84eab9d0, tls: 0x7ffb84eab700) = 11637 (Chrome_IOThread)
    0.392 ( 0.013 ms): Chrome_IOThrea/19863 clone(flags: VM|FS|FILES|SIGHAND|THREAD|SYSVSEM|SETTLS|PARENT_SETTID|CHILD_CLEARTID, child_stack: 0x7ffb664b8c70, parent_tidptr: 0x7ffb664b99d0, child_tidptr: 0x7ffb664b99d0, tls: 0x7ffb664b9700) = 11638 (Chrome_IOThread)
    0.573 ( 0.015 ms): Chrome_IOThrea/19863 clone(flags: VM|FS|FILES|SIGHAND|THREAD|SYSVSEM|SETTLS|PARENT_SETTID|CHILD_CLEARTID, child_stack: 0x7ffb6046cc70, parent_tidptr: 0x7ffb6046d9d0, child_tidptr: 0x7ffb6046d9d0, tls: 0x7ffb6046d700) = 11639 (Chrome_IOThread)
    0.617 ( 0.014 ms): Chrome_IOThrea/19863 clone(flags: VM|FS|FILES|SIGHAND|THREAD|SYSVSEM|SETTLS|PARENT_SETTID|CHILD_CLEARTID, child_stack: 0x7ffb730dcc70, parent_tidptr: 0x7ffb730dd9d0, child_tidptr: 0x7ffb730dd9d0, tls: 0x7ffb730dd700) = 11640 (Chrome_IOThread)
    4.350 ( 0.065 ms): Chrome_IOThrea/19863 clone(flags: VM|FS|FILES|SIGHAND|THREAD|SYSVSEM|SETTLS|PARENT_SETTID|CHILD_CLEARTID, child_stack: 0x7ffb720d9c70, parent_tidptr: 0x7ffb720da9d0, child_tidptr: 0x7ffb720da9d0, tls: 0x7ffb720da700) = 11642 (Chrome_IOThread)
    5.642 ( 0.079 ms): Chrome_IOThrea/19863 clone(flags: VM|FS|FILES|SIGHAND|THREAD|SYSVSEM|SETTLS|PARENT_SETTID|CHILD_CLEARTID, child_stack: 0x7ffb718d8c70, parent_tidptr: 0x7ffb718d99d0, child_tidptr: 0x7ffb718d99d0, tls: 0x7ffb718d9700) = 11643 (Chrome_IOThread)
    ^C#

    We'll also have to fix the argument ordering in different arches,
    probably having multiple syscall_fmt entries with each possible order
    and then use perf_evsel__env_arch() (if dealing with a perf.data file)
    or the current system info, for live sessions.

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

    Arnaldo Carvalho de Melo
     
  • For tracepointless syscalls, like clone, otherwise get them from the
    tracepoint's /format file.

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

    Arnaldo Carvalho de Melo
     
  • When we don't have syscalls:sys_{enter,exit}_NAME, we had to resort to
    dumping all the 6 syscall arguments, fix it by providing that info for
    such syscalls, like 'clone'.

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

    Arnaldo Carvalho de Melo
     
  • All callers now can use syscall__arg_val(arg, idx), be it to iterate
    thru the syscall arguments while taking into account alignment, or to
    get values for other arguments that affect how the current argument
    should be formatted (think of fcntl's 'cmd' and 'arg' arguments).

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

    Arnaldo Carvalho de Melo
     
  • Previously we only used the syscall_fmt when we had sc->tp_format set,
    i.e. when we found the (enter, exit) pair in tracefs/events/syscalls/.

    But we really only need to use what is in sc->arg_fmt to apply the arg
    beautifiers to the syscall argument values, so do it.

    With this we will be able to provide formatters to the "clone" syscall,
    which doesn't have entries in tracefs/events/syscalls/.

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

    Arnaldo Carvalho de Melo
     
  • At least "clone" doesn't have (enter, exit) entries tracefs/events/syscalls/,
    but we can provide a syscall_fmt and use it instead, as will be done for
    "clone" in the next cset.

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

    Arnaldo Carvalho de Melo
     
  • We lost it recently, put it back.

    Before:

    789.499 ( 0.001 ms): libvirtd/1175 lseek(fd: 22, whence: CUR) 4328

    After:

    789.499 ( 0.001 ms): libvirtd/1175 lseek(fd: 22, whence: CUR) = 4328

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Fixes: 1f63139c3f8a ("perf trace beauty: Simplify syscall return formatting")
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

19 Jul, 2017

17 commits

  • Removing syscall_fmt::err_msg and instead always formatting negative
    returns as errno values.

    With this we can remove a lot of entries that have no special handling
    besides the ones we can do by looking at the tracefs format files, i.e.
    the types for the fields (e.g. pid_t), well known names (e.g. fd).

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

    Arnaldo Carvalho de Melo
     
  • Before:

    77059.513 ( 0.005 ms): bash/6649 fcntl(fd: 1, arg: 10) = 10

    After:

    77059.513 ( 0.005 ms): bash/6649 fcntl(fd: 1, cmd: DUPFD, arg: 10) = 10

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

    Arnaldo Carvalho de Melo
     
  • The 'perf trace' tool is suppressing args set to zero, with the
    exception of string tables (strarrays), which are kinda like enums, i.e.
    we have maps to go from numbers to strings.

    But the 'cmd' fcntl arg requires more specialized treatment, as its
    value will regulate if the next fcntl syscall arg, 'arg', should be
    ignored (not used) and also how to format the syscall return (fd, file
    flags, etc), so add a 'show_zero" bool to struct syscall_arg_fmt, to
    regulate this more explicitely.

    Will be used in a following patch with fcntl, here is just the
    mechanism.

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

    Arnaldo Carvalho de Melo
     
  • Instead of having syscall_fmt.{arg_scnprintf,arg_parm}, introduce
    struct syscall_arg_fmt and have these two, paving the way for more
    state to change the formatting algorithms.

    For instance, in the 'fcntl' 'cmd' case it is better not to suppress
    it when being zero, showing instead its name "DUPFD".

    We had that in an ad-hoc way just for strarrays, but with more involved
    cases like fcntl, that can't be done with just a strarray, we'll need
    a ".show_zero" arg in the 'cmd' syscall_arg_fmt.

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

    Arnaldo Carvalho de Melo
     
  • Like will be done with fcntl(fd, F_GETLEASE, F_RDLCK|F_WRLCK|F_UNLCK)

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

    Arnaldo Carvalho de Melo
     
  • Now that the beautifiers are being split into multiple source and object
    files, we will need more of them exported, do it for the 'fd' one, will
    be used to augment the return of some syscalls that may return an 'fd',
    such as fcntl(fd, F_DUPFD).

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

    Arnaldo Carvalho de Melo
     
  • We need the current thread and the trace internal state so that we can
    use the fd beautifier to augment syscall returns, so use struct
    syscall_arg with some fields that make sense on returns (val, thread,
    trace).

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

    Arnaldo Carvalho de Melo
     
  • Things like fcntl will use this to set the right formatter based on its
    'cmd' argument.

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

    Arnaldo Carvalho de Melo
     
  • Those introduced by the commit c75b1d9421f8 ("fs: add fcntl() interface for
    setting/getting write life time hints"), tested using the proggie in that
    commit comment:

    # perf trace -e fcntl ./write_hint write_hint.c
    fcntl: F_GET_RW_HINT: Invalid argument
    0.000 ( 0.006 ms): write_hint/7576 fcntl(fd: 3, cmd: GET_RW_HINT, arg: 0x7ffc6c918da0) = -1 EINVAL Invalid argument
    0.014 ( 0.004 ms): write_hint/7576 fcntl(fd: 4, cmd: GETFL) = 33794
    # perf trace -e fcntl ./write_hint write_hint.c 1
    fcntl: F_SET_RW_HINT: Invalid argument
    0.000 ( 0.007 ms): write_hint/7578 fcntl(fd: 3, cmd: SET_RW_HINT, arg: 0x7fff03866d70) = -1 EINVAL Invalid argument
    0.019 ( 0.002 ms): write_hint/7578 fcntl(fd: 4, cmd: GETFL) = 33794
    #

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

    Arnaldo Carvalho de Melo
     
  • Sometimes it should be printed as an hex number, like with F_SETLK,
    F_SETLKW and F_GETLK, that treat 'arg' as a struct flock pointer, in
    other cases it is just an integer.

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

    Arnaldo Carvalho de Melo
     
  • Will be used in the fcntl arg beautifier, that nowadays formats as '%ld'
    because there is no explicit arg beautifier attached, but as we will
    have to first decide what beautifier to use (i.e. it may be a pointer,
    etc) then we need to have this exported as a separate beautifier to be
    called from there.

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

    Arnaldo Carvalho de Melo
     
  • The most basic ones, for pointers, unaugmented fds, etc, to be used
    in the initial fcntl 'arg' beautifier.

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

    Arnaldo Carvalho de Melo
     
  • For instance, fcntl's upcoming 'arg' formatter needs to look at the
    'cmd' value to decide how to format its value, sometimes it is a file
    flags, sometimes an fd, a pointer to a structure, etc.

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

    Arnaldo Carvalho de Melo
     
  • A series of fcntl cmds ignore the third argument, so mask it.

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

    Arnaldo Carvalho de Melo
     
  • As we'll call it from the fcntl cmd scnprintf method, that needs to look
    at the cmd to mask the next fcntl argument when it is ignored.

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

    Arnaldo Carvalho de Melo
     
  • We were only beautifying (transforming from an integer to its name) the
    non-linux specific fcntl syscall cmd args, fix it:

    Before:

    # perf trace -e fcntl -p 2472
    0.000 ( 0.017 ms): gnome-terminal/2472 fcntl(fd: 55, cmd: 1030) = 56
    ^C#

    After:

    # trace -e fcntl -p 2472
    0.000 ( 0.015 ms): gnome-terminal/2472 fcntl(fd: 55, cmd: DUPFD_CLOEXEC) = 56
    ^C#

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

    Arnaldo Carvalho de Melo
     
  • The initial ones already had that "F_" prefix stripped to make things
    shorter, some hadn't, do it now.

    We do this to make the 'perf trace' output more compact. At some point
    perhaps the best thing to do is to have the tool do this stripping
    automatically, letting the user also decide if this is to be done or
    not. For now, be consistent.

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

    Arnaldo Carvalho de Melo
     

01 Jun, 2017

1 commit

  • The s390 architecture maps sys_mmap (nr 90) into sys_old_mmap. For this
    reason perf trace can't find the proper syscall event to get args format
    from and displays it wrongly as 'continued'.

    To fix that fill the "alias" field with "old_mmap" for trace's mmap record
    to get the correct translation.

    Before:
    0.042 ( 0.011 ms): vest/43052 fstat(statbuf: 0x3ffff89fd90 ) = 0
    0.042 ( 0.028 ms): vest/43052 ... [continued]: mmap()) = 0x3fffd6e2000
    0.072 ( 0.025 ms): vest/43052 read(buf: 0x3fffd6e2000, count: 4096 ) = 6

    After:
    0.045 ( 0.011 ms): fstat(statbuf: 0x3ffff8a0930 ) = 0
    0.057 ( 0.018 ms): mmap(arg: 0x3ffff8a0858 ) = 0x3fffd14a000
    0.076 ( 0.025 ms): read(buf: 0x3fffd14a000, count: 4096 ) = 6

    Signed-off-by: Jiri Olsa
    Cc: David Ahern
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20170531113557.19175-1-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     

26 Apr, 2017

1 commit


25 Apr, 2017

1 commit


21 Apr, 2017

1 commit


20 Apr, 2017

4 commits