Re: [PATCH 17/19] perf tools: Build syscall table .c header from kernel's syscall_64.tbl
From: Arnaldo Carvalho de Melo
Date: Thu Apr 07 2016 - 17:50:40 EST
Em Thu, Apr 07, 2016 at 03:39:21PM -0600, David Ahern escreveu:
> On 4/7/16 2:58 PM, Arnaldo Carvalho de Melo wrote:
> >We used libaudit to map ids to syscall names and vice-versa, but that
> >imposes a delay in supporting new syscalls, having to wait for libaudit
> >to get those new syscalls on its tables.
> and for the distribution to get the new libaudit.
yeap
> >To remove that delay, for x86_64 initially, grab a copy of
> >arch/x86/entry/syscalls/syscall_64.tbl and use it to generate those
> >tables.
>
> Now that's a benefit for perf in the kernel tree. What happens for out of
> tree perf builds? Are the requisite files included in the tarball?
> (apparently no, since the manifest file is not updated or perhaps I missed
> it)
Well, we're removing references to files outside tools/, so what was
done in this case was to copy the files:
[acme@jouet linux]$ ls -la tools/perf/arch/x86/entry/syscalls/
total 28
drwxrwxr-x. 2 acme acme 4096 Apr 7 16:59 .
drwxrwxr-x. 3 acme acme 4096 Apr 7 16:59 ..
-rw-rw-r--. 1 acme acme 12972 Apr 7 16:59 syscall_64.tbl
-rwxrwxr-x. 1 acme acme 596 Apr 7 16:59 syscalltbl.sh
[acme@jouet linux]$
Then we have logic for when the kernel one gets out of sync, to be
warned about, see:
tools/perf/arch/x86/Makefile
E.g.:
[acme@jouet linux]$ git diff
diff --git a/arch/x86/entry/syscalls/syscall_64.tbl b/arch/x86/entry/syscalls/syscall_64.tbl
index 2e5b565adacc..e8af21d804f8 100644
--- a/arch/x86/entry/syscalls/syscall_64.tbl
+++ b/arch/x86/entry/syscalls/syscall_64.tbl
@@ -333,6 +333,7 @@
324 common membarrier sys_membarrier
325 common mlock2 sys_mlock2
326 common copy_file_range sys_copy_file_range
+327 common leftpad sys_leftpad
#
# x32-specific system call numbers start at 512 to avoid cache impact
[acme@jouet linux]$
[acme@jouet linux]$ rm -rf /tmp/build/perf ; mkdir -p /tmp/build/perf ; m
make: Entering directory '/home/acme/git/linux/tools/perf'
[acme@jouet linux]$ make -C tools/perf build-test
make: Entering directory '/home/acme/git/linux/tools/perf'
- tarpkg: ./tests/perf-targz-src-pkg .
BUILD: Doing 'make -j4' parallel build
Auto-detecting system features:
... dwarf: [ on ]
<SNIP>
GEN /tmp/build/perf/common-cmds.h
Warning: x86_64's syscall_64.tbl differs from kernel
CC /tmp/build/perf/fixdep.o
LD /tmp/build/perf/fixdep-in.o
---------------------------------------
Looking at it now it needs some more polish, i.e. it should have a GEN ...
line, but that can be done on top of this patchkit :-)
For completeness:
[acme@jouet linux]$ diff -u tools/perf/arch/x86/entry/syscalls/syscall_64.tbl arch/x86/entry/syscalls/syscall_64.tbl
--- tools/perf/arch/x86/entry/syscalls/syscall_64.tbl 2016-04-07 16:59:44.938061779 -0300
+++ arch/x86/entry/syscalls/syscall_64.tbl 2016-04-07 18:43:51.543992781 -0300
@@ -333,6 +333,7 @@
324 common membarrier sys_membarrier
325 common mlock2 sys_mlock2
326 common copy_file_range sys_copy_file_range
+327 common leftpad sys_leftpad
#
# x32-specific system call numbers start at 512 to avoid cache impact
[acme@jouet linux]$
And 'make -C tools/perf build-test' does the tarball creation and out-of-tree
build as its first step, to make sure it continues working, so all that is
needed is there :-)
[acme@jouet linux]$ make -C tools/perf build-test
make: Entering directory '/home/acme/git/linux/tools/perf'
- tarpkg: ./tests/perf-targz-src-pkg .
- /home/acme/git/linux/tools/perf/BUILD_TEST_FEATURE_DUMP: cd . && make FEATURE_DUMP_COPY=/home/acme/git/linux/tools/perf/BUILD_TEST_FEATURE_DUMP feature-dump
cd . && make FEATURE_DUMP_COPY=/home/acme/git/linux/tools/perf/BUILD_TEST_FEATURE_DUMP feature-dump
make_minimal_O: cd . && make NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1 NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1 NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1 NO_LIBBPF=1 NO_LIBCRYPTO=1 FEATURES_DUMP=/home/acme/git/linux/tools/perf/BUILD_TEST_FEATURE_DUMP -j4 O=/tmp/tmp.6KCw8TRjm7 DESTDIR=/tmp/tmp.6yw98RESmd
<SNIP>
Best regards,
- Arnaldo