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.
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(-)
diff --git a/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl b/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
index c88fd32563eb..459469b7222c 100755
--- a/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
+++ b/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
@@ -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
--
2.11.0
Em Tue, May 21, 2019 at 06:02:03AM +0300, Vitaly Chikunov escreveu:
> 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
It shouldn't :-\ So with this you're making it use the ones shipped in
tools/include? Good, I'll test it, thanks!
- Arnaldo
> 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(-)
>
> diff --git a/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl b/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
> index c88fd32563eb..459469b7222c 100755
> --- a/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
> +++ b/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
> @@ -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
> --
> 2.11.0
--
- Arnaldo
On Tue, 21 May 2019, Arnaldo Carvalho de Melo wrote:
> Em Tue, May 21, 2019 at 06:02:03AM +0300, Vitaly Chikunov escreveu:
> > 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
>
> 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
> > 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(-)
> >
> > diff --git a/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl b/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
> > index c88fd32563eb..459469b7222c 100755
> > --- a/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
> > +++ b/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
> > @@ -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
> > --
> > 2.11.0
>
> --
>
> - Arnaldo
>
Em Tue, May 21, 2019 at 04:34:47PM +0200, Michael Petlan escreveu:
> On Tue, 21 May 2019, Arnaldo Carvalho de Melo wrote:
> > Em Tue, May 21, 2019 at 06:02:03AM +0300, Vitaly Chikunov escreveu:
> > > 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
> >
> > 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
Em Tue, May 21, 2019 at 12:19:18PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Tue, May 21, 2019 at 04:34:47PM +0200, Michael Petlan escreveu:
> > On Tue, 21 May 2019, Arnaldo Carvalho de Melo wrote:
> > > Em Tue, May 21, 2019 at 06:02:03AM +0300, Vitaly Chikunov escreveu:
> > > > 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
> > > 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,
On Tue, May 21, 2019 at 03:03:54PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Tue, May 21, 2019 at 12:19:18PM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Tue, May 21, 2019 at 04:34:47PM +0200, Michael Petlan escreveu:
> > > On Tue, 21 May 2019, Arnaldo Carvalho de Melo wrote:
> > > > Em Tue, May 21, 2019 at 06:02:03AM +0300, Vitaly Chikunov escreveu:
> > > > > 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
>
> > > > 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?
It was native build on aarch64 with both 'hostcc' and 'gcc' arguments of
mksyscalltbl being set to gcc.
> 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.
> Thanks, applied.
Thanks!
>
> - Arnaldo
Em Tue, May 21, 2019 at 11:53:23PM +0300, Vitaly Chikunov escreveu:
> Arnaldo,
>
> On Tue, May 21, 2019 at 03:03:54PM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Tue, May 21, 2019 at 12:19:18PM -0300, Arnaldo Carvalho de Melo escreveu:
> > > Em Tue, May 21, 2019 at 04:34:47PM +0200, Michael Petlan escreveu:
> > > > On Tue, 21 May 2019, Arnaldo Carvalho de Melo wrote:
> > > > > Em Tue, May 21, 2019 at 06:02:03AM +0300, Vitaly Chikunov escreveu:
> > > > > > 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
> >
> > > > > 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?
>
> It was native build on aarch64 with both 'hostcc' and 'gcc' arguments of
> mksyscalltbl being set to gcc.
>
> > 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...
> building so you just silently losing syscalls.
... now we're not losing them anymore, as intended from day one :-)
Thanks again!
> > Thanks, applied.
>
> Thanks!
>
> >
> > - Arnaldo
--
- Arnaldo
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.
Signed-off-by: Vitaly Chikunov <[email protected]>
Tested-by: Arnaldo Carvalho de Melo <[email protected]>
Tested-by: Michael Petlan <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Hendrik Brueckner <[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]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/perf/arch/arm64/entry/syscalls/mksyscalltbl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl b/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
index c88fd32563eb..459469b7222c 100755
--- a/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
+++ b/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
@@ -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