On Mon, 11 Dec 2017, Arnaldo Carvalho de Melo wrote:
It is not working here:
Hmm, I think I got it.
The following construction:
evts=`perf list syscalls:sys_enter_open* |& egrep 'open(at)? ' | sed -r 's/.*sys_enter_(.*) +\[.*/-e \1/'`
... expands to:
"-e open -e openat"
... which is a format that perf-trace does not seem to accept.
It simply overrides the first event with the second, thus it
only traces "openat". It worked for me, since I tested it on
aarch64 where $evts expanded to only one "-e" parameter.
Attaching a patch for perf-trace that should address it. It
seems to work, so perf-trace accepts "-e open -e openat".
However, one weak point is there:
"-e open,openat -e stat" works, while
"-e open -e openat,stat" does not.
In case you don't like the patch for perf-trace, the test's
patch would need to expand events to something else (which is
of course possible).
Also, on my system (x86_64, 4.15.0-rc1), I needed another
patch for the test (perf_test_shell_fix_filename_arg.patch),
because the variable name changed...
quoted hunk ↗ jump to hunk
[root@jouet mnt]# perf test -v 62
62: Check open filename arg using perf trace + vfs_getname:
test child forked, pid 4919
Added new event:
probe:vfs_getname (on getname_flags:72 with pathname=result->name:string)
You can now use it in all perf tools, such as:
perf record -e probe:vfs_getname -aR sleep 1
test child finished with -1
---- end ----
Check open filename arg using perf trace + vfs_getname: FAILED!
[root@jouet mnt]#
and when I run this with strace -e open to see if it is picking the
right script, it is:
open("/home/acme/libexec/perf-core/tests/shell/record+script_probe_vfs_getname.sh", O_RDONLY) = 4
open("/home/acme/libexec/perf-core/tests/shell/trace+probe_libc_inet_pton.sh", O_RDONLY) = 4
open("/home/acme/libexec/perf-core/tests/shell/trace+probe_vfs_getname.sh", O_RDONLY) = 4
62: Check open filename arg using perf trace + vfs_getname:test child forked, pid 4947
Added new event:
probe:vfs_getname (on getname_flags:72 with pathname=result->name:string)
You can now use it in all perf tools, such as:
perf record -e probe:vfs_getname -aR sleep 1
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=4947, si_uid=0, si_status=255, si_utime=0, si_stime=0} ---test child finished with -1
---- end ----
Check open filename arg using perf trace + vfs_getname: FAILED!
open("/home/acme/libexec/perf-core/tests/shell/probe_vfs_getname.sh", O_RDONLY) = 4[root@jouet mnt]#
[acme@jouet linux]$ diff -u /home/acme/libexec/perf-core/tests/shell/probe_vfs_getname.sh tools/perf/tests/shell/probe_vfs_getname.sh
[acme@jouet linux]$ git log --oneline -1
0553ba305e4e (HEAD -> perf/core) perf test shell: Fix check open filename arg using 'perf trace
[acme@jouet linux]$
So can you please check if the file you're using is the one in this
patch submission?
So attaching all three patches to be sure. I have tested them on
two environments:
* x86_64 with 4.15.0-rc1
* aarch64 with 4.14.0
Both work with all three patches applied, applying on perf/core's
head (commit 26ea2ece7802f8fdaaacf321dbfb22de3271ab82).
- Arnaldo
Thanks for your patience :)
Cheers,
Michael