perf report: Support s390 diag event display on x86
Perf report fails to display s390 specific event numbered bd000
on an x86 platform. For example on s390 this works without error:
[root@m35lp76 perf]# uname -m
s390x
[root@m35lp76 perf]# ./perf record -e rbd000 -- find / >/dev/null
[ perf record: Woken up 3 times to write data ]
[ perf record: Captured and wrote 0.549 MB perf.data ]
[root@m35lp76 perf]# ./perf report -D --stdio > /dev/null
[root@m35lp76 perf]#
Transfering this perf.data file to an x86 platform and executing
the same report command produces:
[root@f29 perf]# uname -m
x86_64
[root@f29 perf]# ./perf report -i ~/perf.data.m35lp76 --stdio
interpreting bpf_prog_info from systems with endianity is not yet supported
interpreting btf from systems with endianity is not yet supported
0x8c890 [0x8]: failed to process type: 68
Error:
failed to process sample
Event bd000 generates auxiliary data which is stored in big endian
format in the perf data file.
This error is caused by missing endianess handling on the x86 platform
when the data is displayed. Fix this by handling s390 auxiliary event
data depending on the local platform endianness.
Output after on x86:
[root@f29 perf]# ./perf report -D -i ~/perf.data.m35lp76 --stdio > /dev/null
interpreting bpf_prog_info from systems with endianity is not yet supported
interpreting btf from systems with endianity is not yet supported
[root@f29 perf]#
Committer notes:
Fix build breakage on older systems, such as CentOS:6 where using
nesting calls to the endian.h macros end up redefining local variables:
util/s390-cpumsf.c: In function 's390_cpumsf_trailer_show':
util/s390-cpumsf.c:333: error: declaration of '__v' shadows a previous local
util/s390-cpumsf.c:333: error: shadowed declaration is here
util/s390-cpumsf.c:333: error: declaration of '__x' shadows a previous local
util/s390-cpumsf.c:333: error: shadowed declaration is here
util/s390-cpumsf.c:334: error: declaration of '__v' shadows a previous local
util/s390-cpumsf.c:334: error: shadowed declaration is here
util/s390-cpumsf.c:334: error: declaration of '__x' shadows a previous local
util/s390-cpumsf.c:334: error: shadowed declaration is here
[perfbuilder@
455a63ef60dc perf]$ gcc -v |& tail -1
gcc version 4.4.7
20120313 (Red Hat 4.4.7-23) (GCC)
[perfbuilder@
455a63ef60dc perf]$
Since there are several uses of
be64toh(te->flags)
Introduce a variable to hold that and then use it, avoiding this case
that causes the above problems:
- local.bsdes = be16toh((be64toh(te->flags) >> 16 & 0xffff));
+ local.bsdes = be16toh((flags >> 16 & 0xffff));
Its the same construct used in s390_cpumsf_diag_show() where we have a
'word' variable that is used just once, s390_cpumsf_basic_show() has
lots of uses and also uses a variable to hold the result of be16toh().
Some of those temp variables needed to be converted from 'unsigned long'
to 'unsigned long long' so as to build on 32-bit arches such as
debian:experimental-x-mipsel, the android NDK ones and
fedora:24-x-ARC-uClibc.
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Link: http://lkml.kernel.org/r/20190522064325.25596-1-tmricht@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>