All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Kim Phillips <kim.phillips@arm.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>,
	Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Hendrik Brueckner <brueckner@linux.vnet.ibm.com>,
	Jiri Olsa <jolsa@redhat.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Namhyung Kim <namhyung@kernel.org>,
	Thomas Richter <tmricht@linux.vnet.ibm.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/3] perf arm64: Generate system call table from asm/unistd.h
Date: Mon, 23 Jul 2018 15:59:05 -0300	[thread overview]
Message-ID: <20180723185905.GA13220@kernel.org> (raw)
In-Reply-To: <20180720150653.GD4329@kernel.org>

Em Fri, Jul 20, 2018 at 12:06:53PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Wed, Jul 18, 2018 at 12:57:52PM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Fri, Jul 06, 2018 at 04:34:43PM -0500, Kim Phillips escreveu:
> > > This should speed up accessing new system calls introduced with the
> > > kernel rather than waiting for libaudit updates to include them.
> > > 
> > > Using the existing other arch scripts resulted in this error:
> > > 
> > > tools/perf/arch/arm64/entry/syscalls//mksyscalltbl: 25: printf: __NR3264_ftruncate: expected numeric value
> > > 
> > > because, unlike other arches, asm-generic's unistd.h does things like:
> > > 
> > >  #define __NR_ftruncate __NR3264_ftruncate
> > > 
> > > Turning the scripts printf's %d into a %s resulted in this in the
> > > generated syscalls.c file:
> > > 
> > >     static const char *syscalltbl_arm64[] = {
> > >             [__NR3264_ftruncate] = "ftruncate",
> > > 
> > > So we use the host C compiler to fold the macros, and print them out
> > > from within a temporary C program, in order to get the correct output:
> > > 
> > >     static const char *syscalltbl_arm64[] = {
> > >             [46] = "ftruncate",
> > > 
> > 
> > One of my containers, ubuntu:14.04.4-x-linaro-arm64, that build perf in
> > a cross-build env, failed to build, please take a look if what is in the
> > output below is enough for you to find the problem, perhaps you forgot
> > to add the new files grabbed from the kernel sources to the
> > tools/perf/MANIFEST file that is used to create the tarball that is then
> > used to test build it? I'll check that later, in a hurry right now.
> 

So it fails with:

perfbuilder@7dbfe2fe9bef:/git/perf$ tools/perf/arch/arm64/entry/syscalls/mksyscalltbl /gcc-linaro-5.4.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc gcc tools/arch/arm64/include/uapi/asm/unistd.h
static const char *syscalltbl_arm64[] = {
<stdin>: In function 'main':
<stdin>:257:38: error: '__NR_getrandom' undeclared (first use in this function)
<stdin>:257:38: note: each undeclared identifier is reported only once for each function it appears in
<stdin>:258:41: error: '__NR_memfd_create' undeclared (first use in this function)
<stdin>:259:32: error: '__NR_bpf' undeclared (first use in this function)
<stdin>:260:37: error: '__NR_execveat' undeclared (first use in this function)
tools/perf/arch/arm64/entry/syscalls/mksyscalltbl: 47: tools/perf/arch/arm64/entry/syscalls/mksyscalltbl: /tmp/create-table-60liya: Permission denied

Because it uses as input this file
tools/arch/arm64/include/uapi/asm/unistd.h, that basically just does:

perfbuilder@1015f8b85ded:/git/perf$ cat tools/arch/arm64/include/uapi/asm/unistd.h
#define __ARCH_WANT_RENAMEAT

#include <asm-generic/unistd.h>
perfbuilder@1015f8b85ded:/git/perf$

And this ends up getting the system's asm-generic/unistd.h file, not the one
shipped in tools/, so:

perfbuilder@1015f8b85ded:/git/perf$ grep bpf /usr/include/asm-generic/unistd.h 
perfbuilder@1015f8b85ded:/git/perf$ grep _NR_ /usr/include/asm-generic/unistd.h  | tail -4
#define __NR_mmap2 __NR3264_mmap
#define __NR_fadvise64_64 __NR3264_fadvise64
#define __NR_stat64 __NR3264_stat
#define __NR_lstat64 __NR3264_lstat
perfbuilder@1015f8b85ded:/git/perf$ 

A quick hack is to do this instead:

diff --git a/tools/perf/arch/arm64/Makefile b/tools/perf/arch/arm64/Makefile
index 85fdf4949db3..f013b115dc86 100644
--- a/tools/perf/arch/arm64/Makefile
+++ b/tools/perf/arch/arm64/Makefile
@@ -11,7 +11,7 @@ PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1
 
 out    := $(OUTPUT)arch/arm64/include/generated/asm
 header := $(out)/syscalls.c
-sysdef := $(srctree)/tools/arch/arm64/include/uapi/asm/unistd.h
+sysdef := $(srctree)/tools/include/uapi/asm-generic/unistd.h
 sysprf := $(srctree)/tools/perf/arch/arm64/entry/syscalls/
 systbl := $(sysprf)/mksyscalltbl
 
diff --git a/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl b/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
index c21023509960..52e197317d3e 100755
--- a/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
+++ b/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
@@ -28,6 +28,7 @@ create_table_from_c()
 
 	cat <<-_EoHEADER
 		#include <stdio.h>
+		#define __ARCH_WANT_RENAMEAT
 		#include "$input"
 		int main(int argc, char *argv[])
 		{

  reply	other threads:[~2018-07-23 18:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-06 21:34 [PATCH v3 2/3] perf arm64: Generate system call table from asm/unistd.h Kim Phillips
2018-07-18 15:57 ` Arnaldo Carvalho de Melo
2018-07-20 15:06   ` Arnaldo Carvalho de Melo
2018-07-23 18:59     ` Arnaldo Carvalho de Melo [this message]
2018-07-23 19:01       ` Arnaldo Carvalho de Melo
2018-08-06 22:28         ` [PATCH] perf arm64: Fix include path for asm-generic/unistd.h Kim Phillips
2018-08-07 13:20           ` Arnaldo Carvalho de Melo
2018-09-06 13:04           ` [tip:perf/core] " tip-bot for Kim Phillips
2018-07-25 20:48 ` [tip:perf/core] perf arm64: Generate system call table from asm/unistd.h tip-bot for Kim Phillips

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180723185905.GA13220@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=brueckner@linux.vnet.ibm.com \
    --cc=jolsa@redhat.com \
    --cc=kim.phillips@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=mpe@ellerman.id.au \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=ravi.bangoria@linux.vnet.ibm.com \
    --cc=tmricht@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.