• Arnaldo Carvalho de Melo's avatar
    perf trace: Associate vfs_getname()'ed pathname with fd returned from 'openat' · 6a648b53
    Arnaldo Carvalho de Melo authored
    When the vfs_getname() wannabe tracepoint is in place:
    
      # perf probe -l
        probe:vfs_getname    (on getname_flags:73@acme/git/linux/fs/namei.c with pathname)
      #
    
    'perf trace' will use it to get the pathname when it is copied from
    userspace to the kernel, right after syscalls:sys_enter_open, copied
    in the 'probe:vfs_getname', stash it somewhere and then, at
    syscalls:sys_exit_open time, if the 'open' return is not -1, i.e. a
    successfull open syscall, associate that pathname to this return, i.e.
    the fd.
    
    We were not doing this for the 'openat' syscall, which would cause 'perf
    trace' to fallback to using /proc to get the fd, change it so that we
    use what we got from probe:vfs_getname, reducing the 'openat'
    beautification process cost, ditching the syscalls performed to read
    procfs state and avoiding some possible races in the process.
    
    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: https://lkml.kernel.org/n/tip-xnp44ao3bkb6ejeczxfnjwsh@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    6a648b53
builtin-trace.c 89.8 KB