perf tools broken for s/390
Arnaldo Carvalho de Melo
maintainerHi,
While preparing a pull request to Ingo for this merge window, I
noticed a regression in one of my cross build containers, specifically:
ubuntu:16.04-x-s390: FAIL
LINK /tmp/build/perf/plugin_jbd2.so
In file included from util/perf_regs.h:27:0,
from util/event.h:11,
from util/symbol.h:16,
from util/block-range.h:5,
from util/block-range.c:2:
/git/linux/tools/perf/arch/s390/include/perf_regs.h:6:62: fatal error: ../../../../arch/s390/include/uapi/asm/perf_regs.h: No such file or directory
compilation terminated.
In file included from util/perf_regs.h:27:0,
from util/event.h:11,
from util/symbol.h:16,
from util/sort.h:12,
from util/annotate.c:14:/git/linux/tools/perf/arch/s390/include/perf_regs.h:6:62: fatal error: ../../../../arch/s390/include/uapi/asm/perf_regs.h: No such file or directory compilation terminated.
LINK /tmp/build/perf/plugin_hrtimer.so
mv: cannot stat '/tmp/build/perf/util/.annotate.o.tmp': No such file or directory
mv: cannot stat '/tmp/build/perf/util/.block-range.o.tmp': No such file or directory /git/linux/tools/build/Makefile.build:96: recipe for target '/tmp/build/perf/util/block-range.o' failed
make[4]: *** [/tmp/build/perf/util/block-range.o] Error 1
make[4]: *** Waiting for unfinished jobs....
/git/linux/tools/build/Makefile.build:96: recipe for target '/tmp/build/perf/util/annotate.o' failed
make[4]: *** [/tmp/build/perf/util/annotate.o] Error 1
/git/linux/tools/build/Makefile.build:139: recipe for target 'util' failed
make[3]: *** [util] Error 2
Makefile.perf:619: recipe for target '/tmp/build/perf/libperf-in.o' failed
make[2]: *** [/tmp/build/perf/libperf-in.o] Error 2
make[2]: *** Waiting for unfinished jobs....
I bisected it to the following commit:
commit f704ef44602fbf403e6722c7ed13f62d17e8cb20
Author: Heiko Carstens <[email protected]> AuthorDate: Tue Jan 19 11:23:38 2016 +0100 Commit: Martin Schwidefsky <[email protected]> CommitDate: Thu Nov 16 15:06:12 2017 +0100
s390/perf: add support for perf_regs and libdw
With support for perf_regs and libdw, you can record and report call graphs for user space programs. Simply invoke perf with the --call-graph=dwarf command line option.
----------------------
It adds this new file:
tools/perf/arch/s390/include/perf_regs.h new file +6 -0
@@ -0,0 +1,63 @@ +#ifndef ARCH_PERF_REGS_H +#define ARCH_PERF_REGS_H + +#include <stdlib.h> +#include <linux/types.h> +#include <../../../../arch/s390/include/uapi/asm/perf_regs.h>
------------------------------------------
That will try to include a file from the kernel sources, directly, something we long decided to be verbotten to avoid disturbing kernel development (and perf's and other tools/) when, say, a kernel hacker adds something, tests everything but tools/ and have tools/ build broken.
So, in this case:
[acme@jouet linux]$ find tools/arch/ -name perf_regs.h tools/arch/arm/include/uapi/asm/perf_regs.h tools/arch/powerpc/include/uapi/asm/perf_regs.h tools/arch/x86/include/uapi/asm/perf_regs.h tools/arch/arm64/include/uapi/asm/perf_regs.h [acme@jouet linux]$
probably its just a matter of doing the usual copy from arch/ to tools/arch/ and add a line to tools/perf/check_headers.sh to make sure we notice when the kernel original changes, possibly meaning needed changes in tooling, but not necessarily.
[acme@jouet linux]$ diff -u arch/arm64/include/uapi/asm/perf_regs.h tools/arch/arm64/include/uapi/asm/perf_regs.h [acme@jouet linux]$ diff -u arch/x86/include/uapi/asm/perf_regs.h tools/arch/x86/include/uapi/asm/perf_regs.h [acme@jouet linux]$ diff -u arch/powerpc/include/uapi/asm/perf_regs.h tools/arch/powerpc/include/uapi/asm/perf_regs.h [acme@jouet linux]$ diff -u arch/arm/include/uapi/asm/perf_regs.h tools/arch/arm/include/uapi/asm/perf_regs.h [acme@jouet linux]$
[acme@jouet linux]$ cp arch/s390/include/uapi/asm/perf_regs.h tools/arch/s390/include/uapi/asm/perf_regs.h [acme@jouet linux]$ ls -la tools/arch/s390/include/uapi/asm/
total 44
drwxrwxr-x. 2 acme acme 4096 Nov 28 11:01 .
drwxrwxr-x. 3 acme acme 4096 Nov 23 15:29 ..
-rw-rw-r--. 1 acme acme 292 Nov 28 10:50 bitsperlong.h
-rw-rw-r--. 1 acme acme 7747 Nov 28 10:50 kvm.h
-rw-rw-r--. 1 acme acme 671 Nov 28 10:50 kvm_perf.h -rw-rw-r--. 1 acme acme 267 Nov 28 10:50 mman.h -rw-rw-r--. 1 acme acme 824 Nov 28 11:01 perf_regs.h
-rw-rw-r--. 1 acme acme 9470 Nov 28 10:50 sie.h
[acme@jouet linux]$
And:
[acme@jouet linux]$ grep perf_regs\.h tools/perf/arch/*/include/perf_regs.h tools/perf/arch/arm64/include/perf_regs.h:#include <asm/perf_regs.h> tools/perf/arch/arm/include/perf_regs.h:#include <asm/perf_regs.h> tools/perf/arch/powerpc/include/perf_regs.h:#include <asm/perf_regs.h> tools/perf/arch/s390/include/perf_regs.h:#include <../../../../arch/s390/include/uapi/asm/perf_regs.h> tools/perf/arch/x86/include/perf_regs.h:#include <asm/perf_regs.h>
[acme@jouet linux]$
Fixing the s390 case we get:
[acme@jouet linux]$ git diff
tools/perf/arch/s390/include/perf_regs.h +1 -1
@@ -3,7 +3,7 @@#include <stdlib.h> #include <linux/types.h> -#include <../../../../arch/s390/include/uapi/asm/perf_regs.h> +#include <asm/perf_regs.h> void perf_regs_load (u64 *regs);
[acme@jouet linux]$
And the container builds ok again:
../tmp/perf: ELF 64-bit MSB shared object, IBM S/390, version 1 (SYSV), dynamically linked, interpreter /lib/ld64.so.1, for GNU/Linux 3.2.0, BuildID[sha1]=640f0477b0df899497855430154ad63d666cbc9d, with debug_info, not stripped
# dm ubuntu:16.04-x-s390 1 ubuntu:16.04-x-s390: Ok s390x-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609 #
In the future, please send patches that touch tools/perf/ to me,
The resulting patch is at:
Best regards,
- Arnaldo
Quoted 22 lines · Arnaldo Carvalho de Melo
Hi,
While preparing a pull request to Ingo for this merge window, I
noticed a regression in one of my cross build containers, specifically:ubuntu:16.04-x-s390: FAIL
LINK
/tmp/build/perf/plugin_jbd2.so
In file included fromutil/perf_regs.h:27:0,from util/event.h:11, from util/symbol.h:16, from util/block-range.h:5, from util/block-range.c:2: /git/linux/tools/perf/arch/s390/include/perf_regs.h:6:62: fatal error: ../../../../arch/s390/include/uapi/asm/perf_regs.h: No such file or directory compilation terminated. In file included from util/perf_regs.h:27:0, from util/event.h:11, from util/symbol.h:16, from util/sort.h:12, from util/annotate.c:14:/git/linux/tools/perf/arch/s390/include/perf_regs.h:6:62: fatal error:
../../../../arch/s390/include/uapi/asm/perf_regs.h: No such file or directory compilation terminated.
...
Quoted 9 lines
tools/perf/arch/s390/include/perf_regs.h new file +6
-1+#ifndef ARCH_PERF_REGS_H +#define ARCH_PERF_REGS_H + +#include <stdlib.h> +#include <linux/types.h> +#include <../../../../arch/s390/include/uapi/asm/perf_regs.h> ------------------------------------------
Quoted 5 lines
That will try to include a file from the kernel sources, directly, something we long decided to be verbotten to avoid disturbing kernel development (and perf's and other
tools/) when, say, a kernel hacker adds something, tests everything buttools/and havetools/build broken.
...
Sorry about that, and thanks for fixing it!
Quoted 5 lines
In the future, please send patches that touch
tools/perf/to me,The resulting patch is at:
Will do. Thanks!