mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-09 19:39:56 +00:00
[ Upstream commit ccafc38f1c ]
This 'perf test' case fails on s390x. The 'touch' command on s390x uses
the 'openat' system call to open the file named on the command line:
[root@s35lp76 perf]# perf probe -l
probe:vfs_getname (on getname_flags:72@fs/namei.c with pathname)
[root@s35lp76 perf]# perf trace -e open touch /tmp/abc
0.400 ( 0.015 ms): touch/27542 open(filename:
/usr/lib/locale/locale-archive, flags: CLOEXEC) = 3
[root@s35lp76 perf]#
There is no 'open' system call for file '/tmp/abc'. Instead the 'openat'
system call is used:
[root@s35lp76 perf]# strace touch /tmp/abc
execve("/usr/bin/touch", ["touch", "/tmp/abc"], 0x3ffd547ec98
/* 30 vars */) = 0
[...]
openat(AT_FDCWD, "/tmp/abc", O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK, 0666) = 3
[...]
On s390x the 'egrep' command does not find a matching pattern and
returns an error.
Fix this for s390x create a platform dependent command line to enable
the 'perf probe' call to listen to the 'openat' system call and get the
expected output.
Signed-off-by: Thomas-Mich Richter <tmricht@linux.vnet.ibm.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Cc: Thomas-Mich Richter <tmricht@linux.vnet.ibm.com>
LPU-Reference: 20171114071847.2381-1-tmricht@linux.vnet.ibm.com
Link: http://lkml.kernel.org/n/tip-3qf38jk0prz54rhmhyu871my@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
38 lines
1.1 KiB
Bash
Executable File
38 lines
1.1 KiB
Bash
Executable File
# Check open filename arg using perf trace + vfs_getname
|
|
|
|
# Uses the 'perf test shell' library to add probe:vfs_getname to the system
|
|
# then use it with 'perf trace' using 'touch' to write to a temp file, then
|
|
# checks that that was captured by the vfs_getname was used by 'perf trace',
|
|
# that already handles "probe:vfs_getname" if present, and used in the
|
|
# "open" syscall "filename" argument beautifier.
|
|
|
|
# Arnaldo Carvalho de Melo <acme@kernel.org>, 2017
|
|
|
|
. $(dirname $0)/lib/probe.sh
|
|
|
|
skip_if_no_perf_probe || exit 2
|
|
|
|
. $(dirname $0)/lib/probe_vfs_getname.sh
|
|
|
|
file=$(mktemp /tmp/temporary_file.XXXXX)
|
|
|
|
trace_open_vfs_getname() {
|
|
test "$(uname -m)" = s390x && { svc="openat"; txt="dfd: +CWD, +"; }
|
|
|
|
perf trace -e ${svc:-open} touch $file 2>&1 | \
|
|
egrep " +[0-9]+\.[0-9]+ +\( +[0-9]+\.[0-9]+ ms\): +touch\/[0-9]+ ${svc:-open}\(${txt}filename: +${file}, +flags: CREAT\|NOCTTY\|NONBLOCK\|WRONLY, +mode: +IRUGO\|IWUGO\) += +[0-9]+$"
|
|
}
|
|
|
|
|
|
add_probe_vfs_getname || skip_if_no_debuginfo
|
|
err=$?
|
|
if [ $err -ne 0 ] ; then
|
|
exit $err
|
|
fi
|
|
|
|
trace_open_vfs_getname
|
|
err=$?
|
|
rm -f ${file}
|
|
cleanup_probe_vfs_getname
|
|
exit $err
|