perf arm64: Fix mksyscalltbl when system kernel headers are ahead of the kernel
Subsystems (2)
PATCH 1/1 perf arm64: Fix mksyscalltbl when system kernel headers are ahead of the kernel
When a host system has kernel headers that are newer than a compiling kernel, mksyscalltbl fails with errors such as:
<stdin>: In function 'main':
<stdin>:271:44: error: '__NR_kexec_file_load' undeclared (first use in this function) <stdin>:271:44: note: each undeclared identifier is reported only once for each function it appears in <stdin>:272:46: error: '__NR_pidfd_send_signal' undeclared (first use in this function) <stdin>:273:43: error: '__NR_io_uring_setup' undeclared (first use in this function) <stdin>:274:43: error: '__NR_io_uring_enter' undeclared (first use in this function) <stdin>:275:46: error: '__NR_io_uring_register' undeclared (first use in this function) tools/perf/arch/arm64/entry/syscalls//mksyscalltbl: line 48: /tmp/create-table-xvUQdD: Permission denied
mksyscalltbl is compiled with default host includes, but run with compiling kernel tree includes, causing some syscall numbers being undeclared.
--- tools/perf/arch/arm64/entry/syscalls/mksyscalltbl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/arch/arm64/entry/syscalls/mksyscalltbl +1 -1
@@ -56,7 +56,7 @@ create_table() echo "};" } -$gcc -E -dM -x c $input \ +$gcc -E -dM -x c -I $incpath/include/uapi $input \ |sed -ne 's/^#define __NR_//p' \ |sort -t' ' -k2 -nu \ |create_table
Signature · 1 line
2.11.0
Em Tue, May 21, 2019 at 06:02:03AM +0300, Vitaly Chikunov escreveu:
Quoted 12 lines
When a host system has kernel headers that are newer than a compiling kernel, mksyscalltbl fails with errors such as:
<stdin>: In function 'main':
<stdin>:271:44: error: '__NR_kexec_file_load' undeclared (first use in this function) <stdin>:271:44: note: each undeclared identifier is reported only once for each function it appears in <stdin>:272:46: error: '__NR_pidfd_send_signal' undeclared (first use in this function) <stdin>:273:43: error: '__NR_io_uring_setup' undeclared (first use in this function) <stdin>:274:43: error: '__NR_io_uring_enter' undeclared (first use in this function) <stdin>:275:46: error: '__NR_io_uring_register' undeclared (first use in this function) tools/perf/arch/arm64/entry/syscalls//mksyscalltbl: line 48:/tmp/create-table-xvUQdD: Permission denied
Quoted 1 line
mksyscalltbl is compiled with default host includes, but run with
It shouldn't :-\ So with this you're making it use the ones shipped in tools/include? Good, I'll test it, thanks!
- Arnaldo
Quoted 32 lines
compiling kernel tree includes, causing some syscall numbers being undeclared.
Signed-off-by Vitaly Chikunov <[email protected]>Cc Alexander Shishkin <[email protected]>Cc Arnaldo Carvalho de Melo <[email protected]>Cc Hendrik Brueckner <[email protected]>Cc Ingo Molnar <[email protected]>Cc Jiri Olsa <[email protected]>Cc Kim Phillips <[email protected]>Cc Namhyung Kim <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Ravi Bangoria <[email protected]>--- tools/perf/arch/arm64/entry/syscalls/mksyscalltbl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/arch/arm64/entry/syscalls/mksyscalltbl +1
-1@@ -56,7 +56,7 @@ create_table() echo "};" } -$gcc -E -dM -x c $input \ +$gcc -E -dM -x c -I $incpath/include/uapi $input \ |sed -ne 's/^#define __NR_//p' \ |sort -t' ' -k2 -nu \ |create_tableSignature · 1 line
2.11.0
Signature · 1 line
- Arnaldo
Quoted 13 lines · Arnaldo Carvalho de Melo
Em Tue, May 21, 2019 at 06:02:03AM +0300, Vitaly Chikunov escreveu:
Quoted 12 lines
When a host system has kernel headers that are newer than a compiling kernel, mksyscalltbl fails with errors such as:
<stdin>: In function 'main':
<stdin>:271:44: error: '__NR_kexec_file_load' undeclared (first use in this function) <stdin>:271:44: note: each undeclared identifier is reported only once for each function it appears in <stdin>:272:46: error: '__NR_pidfd_send_signal' undeclared (first use in this function) <stdin>:273:43: error: '__NR_io_uring_setup' undeclared (first use in this function) <stdin>:274:43: error: '__NR_io_uring_enter' undeclared (first use in this function) <stdin>:275:46: error: '__NR_io_uring_register' undeclared (first use in this function) tools/perf/arch/arm64/entry/syscalls//mksyscalltbl: line 48:/tmp/create-table-xvUQdD: Permission denied
Quoted 7 lines
Quoted 1 line
mksyscalltbl is compiled with default host includes, but run with
It shouldn't :-\ So with this you're making it use the ones shipped in
tools/include? Good, I'll test it, thanks!- Arnaldo
I've hit the issue too, this patch fixes it for me. Tested.
Michael
Quoted 37 lines
Quoted 32 lines
compiling kernel tree includes, causing some syscall numbers being undeclared.
Signed-off-by Vitaly Chikunov <[email protected]>Cc Alexander Shishkin <[email protected]>Cc Arnaldo Carvalho de Melo <[email protected]>Cc Hendrik Brueckner <[email protected]>Cc Ingo Molnar <[email protected]>Cc Jiri Olsa <[email protected]>Cc Kim Phillips <[email protected]>Cc Namhyung Kim <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Ravi Bangoria <[email protected]>--- tools/perf/arch/arm64/entry/syscalls/mksyscalltbl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/arch/arm64/entry/syscalls/mksyscalltbl +1
-1@@ -56,7 +56,7 @@ create_table() echo "};" } -$gcc -E -dM -x c $input \ +$gcc -E -dM -x c -I $incpath/include/uapi $input \ |sed -ne 's/^#define __NR_//p' \ |sort -t' ' -k2 -nu \ |create_tableSignature · 1 line
2.11.0Signature · 1 line
- Arnaldo
Em Tue, May 21, 2019 at 04:34:47PM +0200, Michael Petlan escreveu:
Quoted 16 lines · Arnaldo Carvalho de Melo
Quoted 15 lines
Em Tue, May 21, 2019 at 06:02:03AM +0300, Vitaly Chikunov escreveu:
Quoted 13 lines
When a host system has kernel headers that are newer than a compiling kernel, mksyscalltbl fails with errors such as:
<stdin>: In function 'main':
<stdin>:271:44: error: '__NR_kexec_file_load' undeclared (first use in this function) <stdin>:271:44: note: each undeclared identifier is reported only once for each function it appears in <stdin>:272:46: error: '__NR_pidfd_send_signal' undeclared (first use in this function) <stdin>:273:43: error: '__NR_io_uring_setup' undeclared (first use in this function) <stdin>:274:43: error: '__NR_io_uring_enter' undeclared (first use in this function) <stdin>:275:46: error: '__NR_io_uring_register' undeclared (first use in this function) tools/perf/arch/arm64/entry/syscalls//mksyscalltbl: line 48:/tmp/create-table-xvUQdD: Permission deniedmksyscalltbl is compiled with default host includes, but run with
Quoted 8 lines
Quoted 5 lines
It shouldn't :-\ So with this you're making it use the ones shipped in
tools/include? Good, I'll test it, thanks!- Arnaldo
I've hit the issue too, this patch fixes it for me. Tested.
Thanks, I'll add your Tested-by, appreciated.
- Arnaldo
Arnaldo Carvalho de Melo
AppliedEm Tue, May 21, 2019 at 12:19:18PM -0300, Arnaldo Carvalho de Melo escreveu:
Quoted 17 lines
Em Tue, May 21, 2019 at 04:34:47PM +0200, Michael Petlan escreveu:
Quoted 15 lines · Arnaldo Carvalho de Melo
Quoted 14 lines
Em Tue, May 21, 2019 at 06:02:03AM +0300, Vitaly Chikunov escreveu:
Quoted 13 lines
When a host system has kernel headers that are newer than a compiling kernel, mksyscalltbl fails with errors such as:
<stdin>: In function 'main':
<stdin>:271:44: error: '__NR_kexec_file_load' undeclared (first use in this function) <stdin>:271:44: note: each undeclared identifier is reported only once for each function it appears in <stdin>:272:46: error: '__NR_pidfd_send_signal' undeclared (first use in this function) <stdin>:273:43: error: '__NR_io_uring_setup' undeclared (first use in this function) <stdin>:274:43: error: '__NR_io_uring_enter' undeclared (first use in this function) <stdin>:275:46: error: '__NR_io_uring_register' undeclared (first use in this function) tools/perf/arch/arm64/entry/syscalls//mksyscalltbl: line 48:/tmp/create-table-xvUQdD: Permission deniedmksyscalltbl is compiled with default host includes, but run with
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
It shouldn't :-\ So with this you're making it use the ones shipped in
tools/include? Good, I'll test it, thanks!I've hit the issue too, this patch fixes it for me. Tested.
Thanks, I'll add your Tested-by, appreciated.
Was this in a cross-build environment? Native? I'm asking because I test this on several cross build environments, like on ubuntu 19.04 cross building to aarch64:
perfbuilder@15e0b7c211c2:/git/perf$ grep PRETTY_NAME /etc/os-release PRETTY_NAME="Ubuntu 19.04" perfbuilder@15e0b7c211c2:/git/perf$ aarch64-linux-gnu-gcc -v Using built-in specs. COLLECT_GCC=aarch64-linux-gnu-gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc-cross/aarch64-linux-gnu/8/lto-wrapper Target: aarch64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 8.3.0-6ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --disable-libphobos --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=aarch64-linux-gnu --program-prefix=aarch64-linux-gnu- --includedir=/usr/aarch64-linux-gnu/include Thread model: posix gcc version 8.3.0 (Ubuntu/Linaro 8.3.0-6ubuntu1) perfbuilder@15e0b7c211c2:/git/perf$
I'm building it as:
$ make CORESIGHT=1 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- EXTRA_CFLAGS= -C /git/perf/tools/perf O=/tmp/build/perf
The end result is:
$ file /tmp/build/perf/perf /tmp/build/perf/perf: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, BuildID[sha1]=5b4fd9f0f92cc331e43e6e4da9791c473524383d, for GNU/Linux 3.7.0, with debug_info, not stripped
I.e. it didn't fail the build, but in the end these new syscalls are not there, while with your patch, they are:
perfbuilder@6e20056ed532:/git/perf$ tail /tmp/build/perf/arch/arm64/include/generated/asm/syscalls.c [292] = "io_pgetevents", [293] = "rseq", [294] = "kexec_file_load", [424] = "pidfd_send_signal", [425] = "io_uring_setup", [426] = "io_uring_enter", [427] = "io_uring_register", [428] = "syscalls", #define SYSCALLTBL_ARM64_MAX_ID 428 }; perfbuilder@6e20056ed532:/git/perf$
perfbuilder@6e20056ed532:/git/perf$ strings /tmp/build/perf/perf | egrep '^(io_uring_|pidfd_|kexec_file)' kexec_file_load pidfd_send_signal io_uring_setup io_uring_enter io_uring_register perfbuilder@6e20056ed532:/git/perf$
Thanks, applied.
- Arnaldo
Arnaldo,
Quoted 21 lines · Arnaldo Carvalho de Melo
Em Tue, May 21, 2019 at 12:19:18PM -0300, Arnaldo Carvalho de Melo escreveu:
Quoted 19 lines
Em Tue, May 21, 2019 at 04:34:47PM +0200, Michael Petlan escreveu:
Quoted 18 lines · Arnaldo Carvalho de Melo
Quoted 17 lines
Em Tue, May 21, 2019 at 06:02:03AM +0300, Vitaly Chikunov escreveu:
Quoted 12 lines
When a host system has kernel headers that are newer than a compiling kernel, mksyscalltbl fails with errors such as:
<stdin>: In function 'main':
<stdin>:271:44: error: '__NR_kexec_file_load' undeclared (first use in this function) <stdin>:271:44: note: each undeclared identifier is reported only once for each function it appears in <stdin>:272:46: error: '__NR_pidfd_send_signal' undeclared (first use in this function) <stdin>:273:43: error: '__NR_io_uring_setup' undeclared (first use in this function) <stdin>:274:43: error: '__NR_io_uring_enter' undeclared (first use in this function) <stdin>:275:46: error: '__NR_io_uring_register' undeclared (first use in this function) tools/perf/arch/arm64/entry/syscalls//mksyscalltbl: line 48:/tmp/create-table-xvUQdD: Permission deniedQuoted 1 line
mksyscalltbl is compiled with default host includes, but run with
It shouldn't :-\ So with this you're making it use the ones shipped in
tools/include? Good, I'll test it, thanks!
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
I've hit the issue too, this patch fixes it for me. Tested.
Thanks, I'll add your Tested-by, appreciated.
Was this in a cross-build environment? Native?
It was native build on aarch64 with both 'hostcc' and 'gcc' arguments of mksyscalltbl being set to gcc.
Quoted 6 lines
I'm asking because I test
this on several cross build environments, like on ubuntu 19.04 cross building to aarch64:
...
I.e. it didn't fail the build, but in the end these new syscalls are not there, while with your patch, they are:
Probably in your case system headers was older than kernel you are building so you just silently losing syscalls.
Quoted 1 line
Thanks, applied.
Thanks!
Quoted 2 lines
- Arnaldo
Em Tue, May 21, 2019 at 11:53:23PM +0300, Vitaly Chikunov escreveu:
Quoted 34 lines
Arnaldo,
Quoted 21 lines · Arnaldo Carvalho de Melo
Em Tue, May 21, 2019 at 12:19:18PM -0300, Arnaldo Carvalho de Melo escreveu:
Quoted 19 lines
Em Tue, May 21, 2019 at 04:34:47PM +0200, Michael Petlan escreveu:
Quoted 18 lines · Arnaldo Carvalho de Melo
Quoted 17 lines
Em Tue, May 21, 2019 at 06:02:03AM +0300, Vitaly Chikunov escreveu:
Quoted 12 lines
When a host system has kernel headers that are newer than a compiling kernel, mksyscalltbl fails with errors such as:
<stdin>: In function 'main':
<stdin>:271:44: error: '__NR_kexec_file_load' undeclared (first use in this function) <stdin>:271:44: note: each undeclared identifier is reported only once for each function it appears in <stdin>:272:46: error: '__NR_pidfd_send_signal' undeclared (first use in this function) <stdin>:273:43: error: '__NR_io_uring_setup' undeclared (first use in this function) <stdin>:274:43: error: '__NR_io_uring_enter' undeclared (first use in this function) <stdin>:275:46: error: '__NR_io_uring_register' undeclared (first use in this function) tools/perf/arch/arm64/entry/syscalls//mksyscalltbl: line 48:/tmp/create-table-xvUQdD: Permission deniedQuoted 1 line
mksyscalltbl is compiled with default host includes, but run with
It shouldn't :-\ So with this you're making it use the ones shipped in
tools/include? Good, I'll test it, thanks!Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
I've hit the issue too, this patch fixes it for me. Tested.
Thanks, I'll add your Tested-by, appreciated.
Was this in a cross-build environment? Native?
It was native build on aarch64 with both 'hostcc' and 'gcc' arguments of mksyscalltbl being set to gcc.
Quoted 8 lines
Quoted 6 lines
I'm asking because I test
this on several cross build environments, like on ubuntu 19.04 cross building to aarch64:
...
I.e. it didn't fail the build, but in the end these new syscalls are not there, while with your patch, they are:Probably in your case system headers was older than kernel you are
Yeah, that seems to have been the case, thanks for your patch...
Quoted 1 line
building so you just silently losing syscalls.
... now we're not losing them anymore, as intended from day one :-)
Thanks again!
Quoted 6 lines
Quoted 1 line
Thanks, applied.
Thanks!
Quoted 2 lines
- Arnaldo
Signature · 1 line
- Arnaldo
tip-bot for Vitaly Chikunov
merge botperf arm64: Fix mksyscalltbl when system kernel headers are ahead of the kernel
Commit-ID: f95d050cdc5d34f9a4417e06c392ccbf146037bb Gitweb: https://git.kernel.org/tip/f95d050cdc5d34f9a4417e06c392ccbf146037bb Author: Vitaly Chikunov <[email protected]> AuthorDate: Tue, 21 May 2019 06:02:03 +0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Tue, 28 May 2019 09:49:03 -0300
perf arm64: Fix mksyscalltbl when system kernel headers are ahead of the kernel
When a host system has kernel headers that are newer than a compiling kernel, mksyscalltbl fails with errors such as:
<stdin>: In function 'main':
<stdin>:271:44: error: '__NR_kexec_file_load' undeclared (first use in this function) <stdin>:271:44: note: each undeclared identifier is reported only once for each function it appears in <stdin>:272:46: error: '__NR_pidfd_send_signal' undeclared (first use in this function) <stdin>:273:43: error: '__NR_io_uring_setup' undeclared (first use in this function) <stdin>:274:43: error: '__NR_io_uring_enter' undeclared (first use in this function) <stdin>:275:46: error: '__NR_io_uring_register' undeclared (first use in this function) tools/perf/arch/arm64/entry/syscalls//mksyscalltbl: line 48: /tmp/create-table-xvUQdD: Permission denied
mksyscalltbl is compiled with default host includes, but run with compiling kernel tree includes, causing some syscall numbers to being undeclared.
Committer testing:
Before this patch, in my cross build environment, no build problems, but these new syscalls were not in the syscalls.c generated from the unistd.h file, which is a bug, this patch fixes it:
perfbuilder@6e20056ed532:/git/perf$ tail /tmp/build/perf/arch/arm64/include/generated/asm/syscalls.c [292] = "io_pgetevents", [293] = "rseq", [294] = "kexec_file_load", [424] = "pidfd_send_signal", [425] = "io_uring_setup", [426] = "io_uring_enter", [427] = "io_uring_register", [428] = "syscalls", }; perfbuilder@6e20056ed532:/git/perf$ strings /tmp/build/perf/perf | egrep '^(io_uring_|pidfd_|kexec_file)' kexec_file_load pidfd_send_signal io_uring_setup io_uring_enter io_uring_register perfbuilder@6e20056ed532:/git/perf$ $
Well, there is that last "syscalls" thing, but that looks like some other bug.
--- tools/perf/arch/arm64/entry/syscalls/mksyscalltbl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/arch/arm64/entry/syscalls/mksyscalltbl +1 -1
@@ -56,7 +56,7 @@ create_table() echo "};" } -$gcc -E -dM -x c $input \ +$gcc -E -dM -x c -I $incpath/include/uapi $input \ |sed -ne 's/^#define __NR_//p' \ |sort -t' ' -k2 -nu \ |create_table