linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf arm64: Fix mksyscalltbl when system kernel headers are ahead of the kernel
@ 2019-05-21  3:02 Vitaly Chikunov
  2019-05-21 13:28 ` Arnaldo Carvalho de Melo
  2019-05-28 21:22 ` [tip:perf/urgent] " tip-bot for Vitaly Chikunov
  0 siblings, 2 replies; 8+ messages in thread
From: Vitaly Chikunov @ 2019-05-21  3:02 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, linux-kernel
  Cc: Alexander Shishkin, Hendrik Brueckner, Jiri Olsa, Kim Phillips,
	Namhyung Kim, Ravi Bangoria

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 <vt@altlinux.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Hendrik Brueckner <brueckner@linux.ibm.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Kim Phillips <kim.phillips@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
---
 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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] perf arm64: Fix mksyscalltbl when system kernel headers are ahead of the kernel
  2019-05-21  3:02 [PATCH] perf arm64: Fix mksyscalltbl when system kernel headers are ahead of the kernel Vitaly Chikunov
@ 2019-05-21 13:28 ` Arnaldo Carvalho de Melo
  2019-05-21 14:34   ` Michael Petlan
  2019-05-28 21:22 ` [tip:perf/urgent] " tip-bot for Vitaly Chikunov
  1 sibling, 1 reply; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-05-21 13:28 UTC (permalink / raw)
  To: Vitaly Chikunov
  Cc: Peter Zijlstra, Ingo Molnar, linux-kernel, Alexander Shishkin,
	Hendrik Brueckner, Jiri Olsa, Kim Phillips, Namhyung Kim,
	Ravi Bangoria

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 <vt@altlinux.org>
> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
> Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
> Cc: Hendrik Brueckner <brueckner@linux.ibm.com>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Jiri Olsa <jolsa@redhat.com>
> Cc: Kim Phillips <kim.phillips@arm.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
> ---
>  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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] perf arm64: Fix mksyscalltbl when system kernel headers are ahead of the kernel
  2019-05-21 13:28 ` Arnaldo Carvalho de Melo
@ 2019-05-21 14:34   ` Michael Petlan
  2019-05-21 15:19     ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Petlan @ 2019-05-21 14:34 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Vitaly Chikunov, Peter Zijlstra, Ingo Molnar, linux-kernel,
	Alexander Shishkin, Hendrik Brueckner, Jiri Olsa, Kim Phillips,
	Namhyung Kim, Ravi Bangoria

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 <vt@altlinux.org>
> > Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
> > Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
> > Cc: Hendrik Brueckner <brueckner@linux.ibm.com>
> > Cc: Ingo Molnar <mingo@redhat.com>
> > Cc: Jiri Olsa <jolsa@redhat.com>
> > Cc: Kim Phillips <kim.phillips@arm.com>
> > Cc: Namhyung Kim <namhyung@kernel.org>
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Cc: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
> > ---
> >  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
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] perf arm64: Fix mksyscalltbl when system kernel headers are ahead of the kernel
  2019-05-21 14:34   ` Michael Petlan
@ 2019-05-21 15:19     ` Arnaldo Carvalho de Melo
  2019-05-21 18:03       ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-05-21 15:19 UTC (permalink / raw)
  To: Michael Petlan
  Cc: Arnaldo Carvalho de Melo, Vitaly Chikunov, Peter Zijlstra,
	Ingo Molnar, linux-kernel, Alexander Shishkin, Hendrik Brueckner,
	Jiri Olsa, Kim Phillips, Namhyung Kim, Ravi Bangoria

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] perf arm64: Fix mksyscalltbl when system kernel headers are ahead of the kernel
  2019-05-21 15:19     ` Arnaldo Carvalho de Melo
@ 2019-05-21 18:03       ` Arnaldo Carvalho de Melo
  2019-05-21 20:53         ` Vitaly Chikunov
  0 siblings, 1 reply; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-05-21 18:03 UTC (permalink / raw)
  To: Vitaly Chikunov
  Cc: Michael Petlan, Peter Zijlstra, Ingo Molnar, linux-kernel,
	Alexander Shishkin, Hendrik Brueckner, Jiri Olsa, Kim Phillips,
	Namhyung Kim, Ravi Bangoria

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] perf arm64: Fix mksyscalltbl when system kernel headers are ahead of the kernel
  2019-05-21 18:03       ` Arnaldo Carvalho de Melo
@ 2019-05-21 20:53         ` Vitaly Chikunov
  2019-05-22  0:29           ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 8+ messages in thread
From: Vitaly Chikunov @ 2019-05-21 20:53 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Michael Petlan, Peter Zijlstra, Ingo Molnar, linux-kernel,
	Alexander Shishkin, Hendrik Brueckner, Jiri Olsa, Kim Phillips,
	Namhyung Kim, Ravi Bangoria

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] perf arm64: Fix mksyscalltbl when system kernel headers are ahead of the kernel
  2019-05-21 20:53         ` Vitaly Chikunov
@ 2019-05-22  0:29           ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-05-22  0:29 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Michael Petlan, Peter Zijlstra,
	Ingo Molnar, linux-kernel, Alexander Shishkin, Hendrik Brueckner,
	Jiri Olsa, Kim Phillips, Namhyung Kim, Ravi Bangoria

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [tip:perf/urgent] perf arm64: Fix mksyscalltbl when system kernel headers are ahead of the kernel
  2019-05-21  3:02 [PATCH] perf arm64: Fix mksyscalltbl when system kernel headers are ahead of the kernel Vitaly Chikunov
  2019-05-21 13:28 ` Arnaldo Carvalho de Melo
@ 2019-05-28 21:22 ` tip-bot for Vitaly Chikunov
  1 sibling, 0 replies; 8+ messages in thread
From: tip-bot for Vitaly Chikunov @ 2019-05-28 21:22 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, kim.phillips, tglx, mpetlan, peterz, acme,
	jolsa, namhyung, alexander.shishkin, ravi.bangoria, brueckner,
	mingo, vt

Commit-ID:  f95d050cdc5d34f9a4417e06c392ccbf146037bb
Gitweb:     https://git.kernel.org/tip/f95d050cdc5d34f9a4417e06c392ccbf146037bb
Author:     Vitaly Chikunov <vt@altlinux.org>
AuthorDate: Tue, 21 May 2019 06:02:03 +0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
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 <vt@altlinux.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Tested-by: Michael Petlan <mpetlan@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Hendrik Brueckner <brueckner@linux.ibm.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Kim Phillips <kim.phillips@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/20190521030203.1447-1-vt@altlinux.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-05-28 21:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-21  3:02 [PATCH] perf arm64: Fix mksyscalltbl when system kernel headers are ahead of the kernel Vitaly Chikunov
2019-05-21 13:28 ` Arnaldo Carvalho de Melo
2019-05-21 14:34   ` Michael Petlan
2019-05-21 15:19     ` Arnaldo Carvalho de Melo
2019-05-21 18:03       ` Arnaldo Carvalho de Melo
2019-05-21 20:53         ` Vitaly Chikunov
2019-05-22  0:29           ` Arnaldo Carvalho de Melo
2019-05-28 21:22 ` [tip:perf/urgent] " tip-bot for Vitaly Chikunov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).