[lkml]   [2017]   [Nov]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patches in this message
Subject[FIX] perf tools broken for s/390

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/
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/
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/ 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/ recipe for target '/tmp/build/perf/util/annotate.o' failed
make[4]: *** [/tmp/build/perf/util/annotate.o] Error 1
/git/linux/tools/build/ 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 <>
AuthorDate: Tue Jan 19 11:23:38 2016 +0100
Commit: Martin Schwidefsky <>
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.

Signed-off-by: Heiko Carstens <>
[brueckner: added dwfl_thread_state_register_pc() call]
Signed-off-by: Hendrik Brueckner <>
Reviewed-and-tested-by: Thomas Richter <>
Signed-off-by: Martin Schwidefsky <>


It adds this new file:

diff --git a/tools/perf/arch/s390/include/perf_regs.h b/tools/perf/arch/s390/include/perf_regs.h
new file mode 100644
index 000000000000..ac4b8c8c49e2
--- /dev/null
+++ b/tools/perf/arch/s390/include/perf_regs.h
@@ -0,0 +1,63 @@
+#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

So, in this case:

[acme@jouet linux]$ find tools/arch/ -name 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/ 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]$


[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
diff --git a/tools/perf/arch/s390/include/perf_regs.h b/tools/perf/arch/s390/include/perf_regs.h
index d2df54a6bc5a..bcfbaed78cc2 100644
--- a/tools/perf/arch/s390/include/perf_regs.h
+++ b/tools/perf/arch/s390/include/perf_regs.h
@@ -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/, 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

 \ /
  Last update: 2017-11-28 15:47    [W:0.046 / U:3.000 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site