perf/urgent fixes for 5.2
Subsystems (2)
Arnaldo Carvalho de Melo
maintainerHi Ingo,
Please consider pulling, that is a trimmed down set from
yesterday's pull req, with just fixes.
The other stuff, mostly acting on the warnings for the UAPI
changes are being packaged into a perf/core pull request I'll send for 5.3.
I had it mostly done earlier, but then I noticed the fix for
the syscall numbers, and backtracked to avoid sending yet another pull req, got too late in the -rc game, so 5.3 they go.
I'm not reposting them, the only change was adding an Acked-by
for one of the UAPI syncs, the drm.h one.
I did all the tests again, find them below, after the new signed
tag.
Best regards,
- Arnaldo
Test results at the end of this message, as usual.
The following changes since commit 5bdd9ad875b6edf213f54ec3986ed9e8640c5cf9:
Merge tag 'kbuild-fixes-v5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild (2019-05-20 17:22:17 -0700)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-urgent-for-mingo-5.2-20190528
for you to fetch changes up to a7350998a25ac10cdca5b33dee1d343a74debbfe:
tools headers UAPI: Sync kvm.h headers with the kernel sources (2019-05-28 09:52:23 -0300)
----------------------------------------------------------------
perf/urgent fixes:
BPF:
Jiri Olsa:
- Fixup determination of end of kernel map, to avoid having BPF programs, that are after the kernel headers and just before module texts mixed up in the kernel map.
tools UAPI header copies:
Arnaldo Carvalho de Melo:
- Update copy of files related to new fspick, fsmount, fsconfig, fsopen, move_mount and open_tree syscalls.
- Sync cpufeatures.h, sched.h, fs.h, drm.h, i915_drm.h and kvm.h headers.
Namespaces:
Namhyung Kim:
- Add missing byte swap ops for namespace events when processing records from perf.data files that could have been recorded in a arch with a different endianness.
- Fix access to the thread namespaces list by using the namespaces_lock.
perf data:
Shawn Landden:
- Fix 'strncat may truncate' build failure with recent gcc.
s/390
Thomas Richter:
- Fix s390 missing module symbol and warning for non-root users in 'perf record'.
arm64:
Vitaly Chikunov:
- Fix mksyscalltbl when system kernel headers are ahead of the kernel.
----------------------------------------------------------------
Arnaldo Carvalho de Melo (8):
tools include UAPI: Update copy of files related to new fspick, fsmount, fsconfig, fsopen, move_mount and open_tree syscalls tools arch x86: Sync asm/cpufeatures.h with the with the kernel
tools headers UAPI: Sync linux/sched.h with the kernel
tools headers UAPI: Sync linux/fs.h with the kernel
tools headers UAPI: Sync drm/i915_drm.h with the kernel
tools headers UAPI: Sync drm/drm.h with the kernel
perf test vmlinux-kallsyms: Ignore aliases to _etext when searching on kallsyms
tools headers UAPI: Sync kvm.h headers with the kernel sources
Jiri Olsa (1):
perf machine: Read also the end of the kernel
Namhyung Kim (2):
perf namespace: Protect reading thread's namespace perf session: Add missing swap ops for namespace events
Shawn Landden (1):
perf data: Fix 'strncat may truncate' build failure with recent gcc
Thomas Richter (1):
perf record: Fix s390 missing module symbol and warning for non-root users
Vitaly Chikunov (1):
perf arm64: Fix mksyscalltbl when system kernel headers are ahead of the kernel
tools/arch/arm64/include/uapi/asm/kvm.h | 43 ++++ tools/arch/powerpc/include/uapi/asm/kvm.h | 46 ++++ tools/arch/s390/include/uapi/asm/kvm.h | 4 +- tools/arch/x86/include/asm/cpufeatures.h | 3 + tools/include/uapi/asm-generic/unistd.h | 14 +- tools/include/uapi/drm/drm.h | 37 ++++ tools/include/uapi/drm/i915_drm.h | 254 +++++++++++++++------- tools/include/uapi/linux/fcntl.h | 2 + tools/include/uapi/linux/fs.h | 3 + tools/include/uapi/linux/kvm.h | 15 +- tools/include/uapi/linux/mount.h | 62 ++++++ tools/include/uapi/linux/sched.h | 1 + tools/perf/arch/arm64/entry/syscalls/mksyscalltbl | 2 +- tools/perf/arch/s390/util/machine.c | 9 +- tools/perf/arch/x86/entry/syscalls/syscall_64.tbl | 6 + tools/perf/tests/vmlinux-kallsyms.c | 9 +- tools/perf/util/data-convert-bt.c | 2 +- tools/perf/util/machine.c | 27 ++- tools/perf/util/session.c | 21 ++ tools/perf/util/thread.c | 15 +- 20 files changed, 481 insertions(+), 94 deletions(-)
Test results:
The first ones are container based builds of tools/perf with and without libelf support. Where clang is available, it is also used to build perf with/without libelf, and building with LIBCLANGLLVM=1 (built-in clang) with gcc and clang when clang and its devel libraries are installed.
The objtool and samples/bpf/ builds are disabled now that I'm switching from using the sources in a local volume to fetching them from a http server to build it inside the container, to make it easier to build in a container cluster. Those will come back later.
Several are cross builds, the ones with -x-ARCH and the android one, and those may not have all the features built, due to lack of multi-arch devel packages, available and being used so far on just a few, like debian:experimental-x-{arm64,mipsel}.
The 'perf test' one will perform a variety of tests exercising tools/perf/util/, tools/lib/{bpf,traceevent,etc}, as well as run perf commands with a variety of command line event specifications to then intercept the sys_perf_event syscall to check that the perf_event_attr fields are set up as expected, among a variety of other unit tests.
Then there is the 'make -C tools/perf build-test' ones, that build tools/perf/ with a variety of feature sets, exercising the build with an incomplete set of features as well as with a complete one. It is planned to have it run on each of the containers mentioned above, using some container orchestration infrastructure. Get in contact if interested in helping having this in place.
$ export PERF_TARBALL=http://192.168.124.1/perf/perf-5.2.0-rc1.tar.xz $ dm 1 alpine:3.4 : Ok gcc (Alpine 5.3.0) 5.3.0 2 alpine:3.5 : Ok gcc (Alpine 6.2.1) 6.2.1 20160822 3 alpine:3.6 : Ok gcc (Alpine 6.3.0) 6.3.0 4 alpine:3.7 : Ok gcc (Alpine 6.4.0) 6.4.0 5 alpine:3.8 : Ok gcc (Alpine 6.4.0) 6.4.0 6 alpine:3.9 : Ok gcc (Alpine 8.3.0) 8.3.0 7 alpine:edge : Ok gcc (Alpine 8.3.0) 8.3.0 8 amazonlinux:1 : Ok gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28) 9 amazonlinux:2 : Ok gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5) 10 android-ndk:r12b-arm : Ok arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease) 11 android-ndk:r15c-arm : Ok arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease) 12 centos:5 : Ok gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-55) 13 centos:6 : Ok gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23) 14 centos:7 : Ok gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36) 15 clearlinux:latest : Ok gcc (Clear Linux OS for Intel Architecture) 9.0.1 20190501 (prerelease) gcc-8-branch@270761 16 debian:8 : Ok gcc (Debian 4.9.2-10+deb8u2) 4.9.2 17 debian:9 : Ok gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516 18 debian:experimental : Ok gcc (Debian 8.3.0-7) 8.3.0 19 debian:experimental-x-arm64 : Ok aarch64-linux-gnu-gcc (Debian 8.3.0-7) 8.3.0 20 debian:experimental-x-mips : Ok mips-linux-gnu-gcc (Debian 8.3.0-7) 8.3.0 21 debian:experimental-x-mips64 : Ok mips64-linux-gnuabi64-gcc (Debian 8.3.0-7) 8.3.0 22 debian:experimental-x-mipsel : Ok mipsel-linux-gnu-gcc (Debian 8.3.0-7) 8.3.0 23 fedora:20 : Ok gcc (GCC) 4.8.3 20140911 (Red Hat 4.8.3-7) 24 fedora:22 : Ok gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6) 25 fedora:23 : Ok gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6) 26 fedora:24 : Ok gcc (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1) 27 fedora:24-x-ARC-uClibc : Ok arc-linux-gcc (ARCompact ISA Linux uClibc toolchain 2017.09-rc2) 7.1.1 20170710 28 fedora:25 : Ok gcc (GCC) 6.4.1 20170727 (Red Hat 6.4.1-1) 29 fedora:26 : Ok gcc (GCC) 7.3.1 20180130 (Red Hat 7.3.1-2) 30 fedora:27 : Ok gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-6) 31 fedora:28 : Ok gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2) 32 fedora:29 : Ok gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2) 33 fedora:30 : Ok gcc (GCC) 9.1.1 20190503 (Red Hat 9.1.1-1) 34 fedora:30-x-ARC-glibc : Ok arc-linux-gcc (ARC HS GNU/Linux glibc toolchain 2019.03-rc1) 8.3.1 20190225 35 fedora:30-x-ARC-uClibc : Ok arc-linux-gcc (ARCv2 ISA Linux uClibc toolchain 2019.03-rc1) 8.3.1 20190225 36 fedora:rawhide : Ok gcc (GCC) 9.0.1 20190418 (Red Hat 9.0.1-0.14) 37 gentoo-stage3-amd64:latest : Ok gcc (Gentoo 8.3.0-r1 p1.1) 8.3.0 38 mageia:5 : Ok gcc (GCC) 4.9.2 39 mageia:6 : Ok gcc (Mageia 5.5.0-1.mga6) 5.5.0 40 opensuse:15.0 : Ok gcc (SUSE Linux) 7.4.0 41 opensuse:15.1 : Ok gcc (SUSE Linux) 7.4.0 42 opensuse:42.3 : Ok gcc (SUSE Linux) 4.8.5 43 opensuse:tumbleweed : Ok gcc (SUSE Linux) 9.1.1 20190520 [gcc-9-branch revision 271396] 44 oraclelinux:6 : Ok gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23.0.1) 45 oraclelinux:7 : Ok gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36.0.1) 46 ubuntu:12.04.5 : Ok gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 47 ubuntu:14.04.4 : Ok gcc (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4 48 ubuntu:16.04 : Ok gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609 49 ubuntu:16.04-x-arm : Ok arm-linux-gnueabihf-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 50 ubuntu:16.04-x-arm64 : Ok aarch64-linux-gnu-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 51 ubuntu:16.04-x-powerpc : Ok powerpc-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 52 ubuntu:16.04-x-powerpc64 : Ok powerpc64-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 53 ubuntu:16.04-x-powerpc64el : Ok powerpc64le-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 54 ubuntu:16.04-x-s390 : Ok s390x-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 55 ubuntu:17.10 : Ok gcc (Ubuntu 7.2.0-8ubuntu3.2) 7.2.0 56 ubuntu:18.04 : Ok gcc (Ubuntu 7.4.0-1ubuntu1~18.04) 7.4.0 57 ubuntu:18.04-x-arm : Ok arm-linux-gnueabihf-gcc (Ubuntu/Linaro 7.4.0-1ubuntu1~18.04) 7.4.0 58 ubuntu:18.04-x-arm64 : Ok aarch64-linux-gnu-gcc (Ubuntu/Linaro 7.4.0-1ubuntu1~18.04) 7.4.0 59 ubuntu:18.04-x-m68k : Ok m68k-linux-gnu-gcc (Ubuntu 7.4.0-1ubuntu1~18.04) 7.4.0 60 ubuntu:18.04-x-powerpc : Ok powerpc-linux-gnu-gcc (Ubuntu 7.4.0-1ubuntu1~18.04) 7.4.0 61 ubuntu:18.04-x-powerpc64 : Ok powerpc64-linux-gnu-gcc (Ubuntu 7.4.0-1ubuntu1~18.04) 7.4.0 62 ubuntu:18.04-x-powerpc64el : Ok powerpc64le-linux-gnu-gcc (Ubuntu 7.4.0-1ubuntu1~18.04) 7.4.0 63 ubuntu:18.04-x-riscv64 : Ok riscv64-linux-gnu-gcc (Ubuntu 7.4.0-1ubuntu1~18.04) 7.4.0 64 ubuntu:18.04-x-s390 : Ok s390x-linux-gnu-gcc (Ubuntu 7.4.0-1ubuntu1~18.04) 7.4.0 65 ubuntu:18.04-x-sh4 : Ok sh4-linux-gnu-gcc (Ubuntu 7.4.0-1ubuntu1~18.04) 7.4.0 66 ubuntu:18.04-x-sparc64 : Ok sparc64-linux-gnu-gcc (Ubuntu 7.4.0-1ubuntu1~18.04) 7.4.0 67 ubuntu:18.10 : Ok gcc (Ubuntu 8.3.0-6ubuntu1~18.10) 8.3.0 68 ubuntu:19.04 : Ok gcc (Ubuntu 8.3.0-6ubuntu1) 8.3.0 69 ubuntu:19.04-x-alpha : Ok alpha-linux-gnu-gcc (Ubuntu 8.3.0-6ubuntu1) 8.3.0 70 ubuntu:19.04-x-arm64 : Ok aarch64-linux-gnu-gcc (Ubuntu/Linaro 8.3.0-6ubuntu1) 8.3.0 71 ubuntu:19.04-x-hppa : Ok hppa-linux-gnu-gcc (Ubuntu 8.3.0-6ubuntu1) 8.3.0 #
# uname -a
Linux quaco 5.2.0-rc1+ #1 SMP Thu May 23 10:37:55 -03 2019 x86_64 x86_64 x86_64 GNU/Linux
# git log --oneline -1
a7350998a25a tools headers UAPI: Sync kvm.h headers with the kernel sources
# perf version --build-options
perf version 5.2.rc1.ga735099
dwarf: [ on ] # HAVE_DWARF_SUPPORT
dwarf_getlocations: [ on ] # HAVE_DWARF_GETLOCATIONS_SUPPORT
glibc: [ on ] # HAVE_GLIBC_SUPPORT
gtk2: [ on ] # HAVE_GTK2_SUPPORT
syscall_table: [ on ] # HAVE_SYSCALL_TABLE_SUPPORT
libbfd: [ on ] # HAVE_LIBBFD_SUPPORT
libelf: [ on ] # HAVE_LIBELF_SUPPORT
libnuma: [ on ] # HAVE_LIBNUMA_SUPPORT
numa_num_possible_cpus: [ on ] # HAVE_LIBNUMA_SUPPORT
libperl: [ on ] # HAVE_LIBPERL_SUPPORT
libpython: [ on ] # HAVE_LIBPYTHON_SUPPORT
libslang: [ on ] # HAVE_SLANG_SUPPORT
libcrypto: [ on ] # HAVE_LIBCRYPTO_SUPPORT
libunwind: [ on ] # HAVE_LIBUNWIND_SUPPORT
libdw-dwarf-unwind: [ on ] # HAVE_DWARF_SUPPORT
zlib: [ on ] # HAVE_ZLIB_SUPPORT
lzma: [ on ] # HAVE_LZMA_SUPPORT
get_cpuid: [ on ] # HAVE_AUXTRACE_SUPPORT
bpf: [ on ] # HAVE_LIBBPF_SUPPORT
aio: [ on ] # HAVE_AIO_SUPPORT
zstd: [ on ] # HAVE_ZSTD_SUPPORT
# perf test
1: vmlinux symtab matches kallsyms : Ok
2: Detect openat syscall event : Ok
3: Detect openat syscall event on all cpus : Ok
4: Read samples using the mmap interface : Ok
5: Test data source output : Ok
6: Parse event definition strings : Ok
7: Simple expression parser : Ok
8: PERF_RECORD_* events & perf_sample fields : Ok
9: Parse perf pmu format : Ok
10: DSO data read : Ok
11: DSO data cache : Ok
12: DSO data reopen : Ok
13: Roundtrip evsel->name : Ok
14: Parse sched tracepoints fields : Ok
15: syscalls:sys_enter_openat event fields : Ok
16: Setup struct perf_event_attr : Ok
17: Match and link multiple hists : Ok
18: 'import perf' in python : Ok
19: Breakpoint overflow signal handler : Ok
20: Breakpoint overflow sampling : Ok
21: Breakpoint accounting : Ok
22: Watchpoint :
22.1: Read Only Watchpoint : Skip
22.2: Write Only Watchpoint : Ok
22.3: Read / Write Watchpoint : Ok
22.4: Modify Watchpoint : Ok
23: Number of exit events of a simple workload : Ok
24: Software clock events period values : Ok
25: Object code reading : Ok
26: Sample parsing : Ok
27: Use a dummy software event to keep tracking : Ok
28: Parse with no sample_id_all bit set : Ok
29: Filter hist entries : Ok
30: Lookup mmap thread : Ok
31: Share thread mg : Ok
32: Sort output of hist entries : Ok
33: Cumulate child hist entries : Ok
34: Track with sched_switch : Ok
35: Filter fds with revents mask in a fdarray : Ok
36: Add fd to a fdarray, making it autogrow : Ok
37: kmod_path__parse : Ok
38: Thread map : Ok
39: LLVM search and compile :
39.1: Basic BPF llvm compile : Ok
39.2: kbuild searching : Ok
39.3: Compile source for BPF prologue generation : Ok
39.4: Compile source for BPF relocation : Ok
40: Session topology : Ok
41: BPF filter :
41.1: Basic BPF filtering : Ok
41.2: BPF pinning : Ok
41.3: BPF prologue generation : Ok
41.4: BPF relocation checker : Ok
42: Synthesize thread map : Ok
43: Remove thread map : Ok
44: Synthesize cpu map : Ok
45: Synthesize stat config : Ok
46: Synthesize stat : Ok
47: Synthesize stat round : Ok
48: Synthesize attr update : Ok
49: Event times : Ok
50: Read backward ring buffer : Ok
51: Print cpu map : Ok
52: Probe SDT events : Ok
53: is_printable_array : Ok
54: Print bitmap : Ok
55: perf hooks : Ok
56: builtin clang support : Skip (not compiled in)
57: unit_number__scnprintf : Ok
58: mem2node : Ok
59: x86 rdpmc : Ok
60: Convert perf time to TSC : Ok
61: DWARF unwind : Ok
62: x86 instruction decoder - new instructions : Ok
63: x86 bp modify : Ok
64: probe libc's inet_pton & backtrace it with ping : Ok
65: Use vfs_getname probe to get syscall args filenames : Ok
66: Add vfs_getname probe to get syscall args filenames : Ok
67: Check open filename arg using perf trace + vfs_getname: Ok
68: Zstd perf.data compression/decompression : Ok
# $ make -C tools/perf build-test
make: Entering directory '/home/acme/git/perf/tools/perf'
- tarpkg: ./tests/perf-targz-src-pkg .
make_install_O: make install
make_no_libnuma_O: make NO_LIBNUMA=1
make_no_libelf_O: make NO_LIBELF=1
make_no_ui_O: make NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
make_clean_all_O: make clean all
make_tags_O: make tags
make_with_clangllvm_O: make LIBCLANGLLVM=1
make_minimal_O: 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 NO_SDT=1 NO_JVMTI=1 NO_LIBZSTD=1
make_cscope_O: make cscope
make_no_gtk2_O: make NO_GTK2=1
make_no_libbpf_O: make NO_LIBBPF=1
make_help_O: make help
make_no_demangle_O: make NO_DEMANGLE=1
make_no_auxtrace_O: make NO_AUXTRACE=1
make_no_slang_O: make NO_SLANG=1
make_install_prefix_slash_O: make install prefix=/tmp/krava/
make_static_O: make LDFLAGS=-static
make_no_libperl_O: make NO_LIBPERL=1
make_no_scripts_O: make NO_LIBPYTHON=1 NO_LIBPERL=1
make_debug_O: make DEBUG=1
make_perf_o_O: make perf.o
make_with_babeltrace_O: make LIBBABELTRACE=1
make_no_libpython_O: make NO_LIBPYTHON=1
make_install_prefix_O: make install prefix=/tmp/krava
make_pure_O: make
make_no_libaudit_O: make NO_LIBAUDIT=1
make_util_map_o_O: make util/map.o
make_no_newt_O: make NO_NEWT=1
make_no_libunwind_O: make NO_LIBUNWIND=1
make_no_libdw_dwarf_unwind_O: make NO_LIBDW_DWARF_UNWIND=1
make_no_libbionic_O: make NO_LIBBIONIC=1
make_no_backtrace_O: make NO_BACKTRACE=1
make_util_pmu_bison_o_O: make util/pmu-bison.o
make_doc_O: make doc
make_install_bin_O: make install-bin
OK
make: Leaving directory '/home/acme/git/perf/tools/perf'
$ Arnaldo Carvalho de Melo
maintainerPATCH 1/14 perf data: Fix 'strncat may truncate' build failure with recent gcc
From: Shawn Landden <[email protected]>
This strncat() is safe because the buffer was allocated with zalloc(), however gcc doesn't know that. Since the string always has 4 non-null bytes, just use memcpy() here.
CC /home/shawn/linux/tools/perf/util/data-convert-bt.o
In file included from /usr/include/string.h:494,
from /home/shawn/linux/tools/lib/traceevent/event-parse.h:27,
from util/data-convert-bt.c:22:
In function ‘strncat’,
inlined from ‘string_set_value’ at util/data-convert-bt.c:274:4:
/usr/include/powerpc64le-linux-gnu/bits/string_fortified.h:136:10: error: ‘__builtin_strncat’ output may be truncated copying 4 bytes from a string of length 4 [-Werror=stringop-truncation]
136 | return __builtin___strncat_chk (__dest, __src, __len, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~LPU-Reference: [email protected]
--- tools/perf/util/data-convert-bt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/data-convert-bt.c +1 -1
@@ -271,7 +271,7 @@ static int string_set_value(struct bt_ctf_field *field, const char *string)if (i >0 )strncpy (buffer, string, i); } -strncat (buffer + p, numstr,4 ); +memcpy (buffer + p, numstr,4 ); p +=3 ; } }
Signature · 1 line
2.20.1
Arnaldo Carvalho de Melo
maintainerPATCH 2/14 perf arm64: Fix mksyscalltbl when system kernel headers are ahead of the kernel
In reply to Arnaldo Carvalho de MeloFrom: Vitaly Chikunov <[email protected]>
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
Signature · 1 line
2.20.1
Arnaldo Carvalho de Melo
maintainerPATCH 3/14 tools include UAPI: Update copy of files related to new fspick, fsmount, fsconfig, fsopen, move_mount and open_tree syscalls
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Copy the headers changed by these csets:
d8076bdb56af ("uapi: Wire up the mount API syscalls on non-x86 arches [ver #2]") 9c8ad7a2ff0b ("uapi, x86: Fix the syscall numbering of the mount API syscalls [ver #2]") cf3cba4a429b ("vfs: syscall: Add fspick() to select a superblock for reconfiguration") 93766fbd2696 ("vfs: syscall: Add fsmount() to create a mount for a superblock") ecdab150fddb ("vfs: syscall: Add fsconfig() for configuring and managing a context") 24dcb3d90a1f ("vfs: syscall: Add fsopen() to prepare for superblock creation") 2db154b3ea8e ("vfs: syscall: Add move_mount(2) to move mounts around") a07b20004793 ("vfs: syscall: Add open_tree(2) to reference or clone a mount")
We need to create tables for all the flags argument in the new syscalls, in followup patches.
This silences these perf build warnings:
Warning: Kernel ABI header at 'tools/include/uapi/linux/mount.h' differs from latest version at 'include/uapi/linux/mount.h' diff -u tools/include/uapi/linux/mount.h include/uapi/linux/mount.h
Warning: Kernel ABI header at 'tools/perf/arch/x86/entry/syscalls/syscall_64.tbl' differs from latest version at 'arch/x86/entry/syscalls/syscall_64.tbl' diff -u tools/perf/arch/x86/entry/syscalls/syscall_64.tbl arch/x86/entry/syscalls/syscall_64.tbl
Warning: Kernel ABI header at 'tools/include/uapi/asm-generic/unistd.h' differs from latest version at 'include/uapi/asm-generic/unistd.h' diff -u tools/include/uapi/asm-generic/unistd.h include/uapi/asm-generic/unistd.h
--- tools/include/uapi/asm-generic/unistd.h | 14 ++++- tools/include/uapi/linux/fcntl.h | 2 + tools/include/uapi/linux/mount.h | 62 +++++++++++++++++++ .../arch/x86/entry/syscalls/syscall_64.tbl | 6 ++ 4 files changed, 83 insertions(+), 1 deletion(-)
tools/include/uapi/asm-generic/unistd.h +13 -1
@@ -832,9 +832,21 @@ __SYSCALL(__NR_io_uring_setup, sys_io_uring_setup) __SYSCALL(__NR_io_uring_enter, sys_io_uring_enter)#define __NR_io_uring_register 427 __SYSCALL(__NR_io_uring_register, sys_io_uring_register) +#define __NR_open_tree 428 +__SYSCALL(__NR_open_tree, sys_open_tree) +#define __NR_move_mount 429 +__SYSCALL(__NR_move_mount, sys_move_mount) +#define __NR_fsopen 430 +__SYSCALL(__NR_fsopen, sys_fsopen) +#define __NR_fsconfig 431 +__SYSCALL(__NR_fsconfig, sys_fsconfig) +#define __NR_fsmount 432 +__SYSCALL(__NR_fsmount, sys_fsmount) +#define __NR_fspick 433 +__SYSCALL(__NR_fspick, sys_fspick)#undef __NR_syscalls -#define __NR_syscalls 428 +#define __NR_syscalls 434/* * 32 bit systems traditionally used different
tools/include/uapi/linux/fcntl.h +2 -0
@@ -91,5 +91,7 @@#define AT_STATX_FORCE_SYNC 0x2000/* - Force the attributes to be sync'd with the server */ #define AT_STATX_DONT_SYNC 0x4000/* - Don't sync attributes with the server */ +#define AT_RECURSIVE 0x8000/* Apply to the entire subtree */ +#endif /* _UAPI_LINUX_FCNTL_H */
tools/include/uapi/linux/mount.h +62 -0
66 lines not on this page · raw message
tools/perf/arch/x86/entry/syscalls/syscall_64.tbl +6 -0
@@ -349,6 +349,12 @@ 425 common io_uring_setup __x64_sys_io_uring_setup 426 common io_uring_enter __x64_sys_io_uring_enter 427 common io_uring_register __x64_sys_io_uring_register +428 common open_tree __x64_sys_open_tree +429 common move_mount __x64_sys_move_mount +430 common fsopen __x64_sys_fsopen +431 common fsconfig __x64_sys_fsconfig +432 common fsmount __x64_sys_fsmount +433 common fspick __x64_sys_fspick # # x32-specific system call numbers start at 512 to avoid cache impact
Signature · 1 line
2.20.1
Arnaldo Carvalho de Melo
maintainerPATCH 4/14 tools arch x86: Sync asm/cpufeatures.h with the with the kernel
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
To pick up the changes in:
ed5194c2732c ("x86/speculation/mds: Add basic bug infrastructure for MDS") e261f209c366 ("x86/speculation/mds: Add BUG_MSBDS_ONLY")
That don't affect anything in tools/.
This silences this perf build warning:
Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h' diff -u tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h
--- tools/arch/x86/include/asm/cpufeatures.h | 3 +++ 1 file changed, 3 insertions(+)
tools/arch/x86/include/asm/cpufeatures.h +3 -0
@@ -344,6 +344,7 @@/* Intel-defined CPU features, CPUID level 0x00000007:0 (EDX), word 18 */ #define X86_FEATURE_AVX512_4VNNIW (18*32+ 2)/* AVX-512 Neural Network Instructions */ #define X86_FEATURE_AVX512_4FMAPS (18*32+ 3)/* AVX-512 Multiply Accumulation Single precision */ +#define X86_FEATURE_MD_CLEAR (18*32+10)/* VERW clears CPU buffers */ #define X86_FEATURE_TSX_FORCE_ABORT (18*32+13)/* "" TSX_FORCE_ABORT */ #define X86_FEATURE_PCONFIG (18*32+18)/* Intel PCONFIG */ #define X86_FEATURE_SPEC_CTRL (18*32+26)/* "" Speculation Control (IBRS + IBPB) */
@@ -382,5 +383,7 @@#define X86_BUG_SPECTRE_V2 X86_BUG(16)/* CPU is affected by Spectre variant 2 attack with indirect branches */ #define X86_BUG_SPEC_STORE_BYPASS X86_BUG(17)/* CPU is affected by speculative store bypass attack */ #define X86_BUG_L1TF X86_BUG(18)/* CPU is affected by L1 Terminal Fault */ +#define X86_BUG_MDS X86_BUG(19)/* CPU is affected by Microarchitectural data sampling */ +#define X86_BUG_MSBDS_ONLY X86_BUG(20)/* CPU is only affected by the MSDBS variant of BUG_MDS */ #endif /* _ASM_X86_CPUFEATURES_H */
Signature · 1 line
2.20.1
Arnaldo Carvalho de Melo
maintainerPATCH 5/14 tools headers UAPI: Sync linux/sched.h with the kernel
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
To pick up the change in:
b3e583825266 ("clone: add CLONE_PIDFD")
This requires changes in the 'perf trace' beautification routines for the 'clone' syscall args, which is done in a followup patch.
This silences the following perf build warning:
Warning: Kernel ABI header at 'tools/include/uapi/linux/sched.h' differs from latest version at 'include/uapi/linux/sched.h' diff -u tools/include/uapi/linux/sched.h include/uapi/linux/sched.h
--- tools/include/uapi/linux/sched.h | 1 + 1 file changed, 1 insertion(+)
tools/include/uapi/linux/sched.h +1 -0
@@ -10,6 +10,7 @@#define CLONE_FS 0x00000200/* set if fs info shared between processes */ #define CLONE_FILES 0x00000400/* set if open files shared between processes */ #define CLONE_SIGHAND 0x00000800/* set if signal handlers and blocked signals shared */ +#define CLONE_PIDFD 0x00001000/* set if a pidfd should be placed in parent */ #define CLONE_PTRACE 0x00002000/* set if we want to let tracing continue on the child too */ #define CLONE_VFORK 0x00004000/* set if the parent wants the child to wake it up on mm_release */ #define CLONE_PARENT 0x00008000/* set if we want to have the same parent as the cloner */
Signature · 1 line
2.20.1
Re: [PATCH 05/14] tools headers UAPI: Sync linux/sched.h with the kernel
Quoted 40 lines · Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <[email protected]>
To pick up the change in:
b3e583825266("clone: addCLONE_PIDFD")This requires changes in the 'perf trace' beautification routines for the 'clone' syscall args, which is done in a followup patch.
This silences the following perf build warning:
Warning: Kernel ABI header at '
tools/include/uapi/linux/sched.h' differs from latest version at 'include/uapi/linux/sched.h'
diff -utools/include/uapi/linux/sched.hinclude/uapi/linux/sched.hCc: Adrian Hunter <[email protected]>
Cc: Brendan Gregg <[email protected]>
Cc: Christian Brauner <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Luis Cláudio Gonçalves <[email protected]>
Cc: Namhyung Kim <[email protected]>
Link:
https://lkml.kernel.org/n/[email protected]Signed-off-by Arnaldo Carvalho de Melo <[email protected]>---
tools/include/uapi/linux/sched.h| 1 +1 file changed, 1 insertion(+)tools/include/uapi/linux/sched.h +0
-0@@ -10,6 +10,7 @@#define CLONE_FS 0x00000200/* set if fs info shared between processes */ #define CLONE_FILES 0x00000400/* set if open files shared between processes */
#defineCLONE_SIGHAND0x00000800/* set if signal handlers and blocked
signals shared */
Quoted 8 lines
+#define
CLONE_PIDFD0x00001000/* set if a pidfd should be placed in
parent */
#defineCLONE_PTRACE0x00002000/* set if we want to let tracing
continue on the child too */
#defineCLONE_VFORK0x00004000/* set if the parent wants the child to
wake it up onmm_release*/
#defineCLONE_PARENT0x00008000/* set if we want to have the same
parent as the cloner */
Thanks for doing that!
Arnaldo Carvalho de Melo
maintainerPATCH 6/14 tools headers UAPI: Sync linux/fs.h with the kernel
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
To pick up the changes in:
c553ea4fdf27 ("fs/sync.c: sync_file_range(2) may use WB_SYNC_ALL writeback")
That should be used to beautify the 'sync_file_range' syscall 'flags' arg.
This silences this perf build warning:
Warning: Kernel ABI header at 'tools/include/uapi/linux/fs.h' differs from latest version at 'include/uapi/linux/fs.h' diff -u tools/include/uapi/linux/fs.h include/uapi/linux/fs.h
--- tools/include/uapi/linux/fs.h | 3 +++ 1 file changed, 3 insertions(+)
tools/include/uapi/linux/fs.h +3 -0
@@ -320,6 +320,9 @@ struct fscrypt_key {#define SYNC_FILE_RANGE_WAIT_BEFORE 1#define SYNC_FILE_RANGE_WRITE 2#define SYNC_FILE_RANGE_WAIT_AFTER 4 +#define SYNC_FILE_RANGE_WRITE_AND_WAIT (SYNC_FILE_RANGE_WRITE | \ + SYNC_FILE_RANGE_WAIT_BEFORE | \ + SYNC_FILE_RANGE_WAIT_AFTER)/* * Flags for preadv2/pwritev2:
Signature · 1 line
2.20.1
Arnaldo Carvalho de Melo
maintainerPATCH 7/14 tools headers UAPI: Sync drm/i915_drm.h with the kernel
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
To pick up the changes from:
d1172ab3d443 ("drm/i915: Introduce struct class_instance for engines across the uAPI") 96fd2c6633b0 ("drm/i915: Drop new chunks of context creation ABI (for now)") ea593dbba4c8 ("drm/i915: Allow contexts to share a single timeline across all engines") b91715417244 ("drm/i915: Extend CONTEXT_CREATE to set parameters upon construction") e0695db7298e ("drm/i915: Create/destroy VM (ppGTT) for use with contexts") 9d1305ef80b9 ("drm/i915: Introduce the i915_user_extension_method") c8b502422bfe ("drm/i915: Remove last traces of exec-id (GEM_BUSY)") d90c06d57027 ("drm/i915: Fix I915_EXEC_RING_MASK")
e88619646971 ("drm/i915: Use HW semaphores for inter-engine synchronisation on gen8+") be03564bd7b6 ("drm/i915: Include reminders about leaving no holes in uAPI enums") ba4fda620a5f ("drm/i915: Optionally disable automatic recovery after a GPU reset")
We still don't take into account the _IOC_SIZE() to differentiate ioctl cmds, so more work is needed to support the extension mechanism that is being used here so that we can differentiate DRM_IOCTL_I915_GEM_CONTEXT_CREATE from the newly introduced DRM_IOCTL_I915_GEM_CONTEXT_CREATE_EXT cmd.
This silences this perf build warning:
Warning: Kernel ABI header at 'tools/include/uapi/drm/i915_drm.h' differs from latest version at 'include/uapi/drm/i915_drm.h' diff -u tools/include/uapi/drm/i915_drm.h include/uapi/drm/i915_drm.h
--- tools/include/uapi/drm/i915_drm.h | 254 +++++++++++++++++++++--------- 1 file changed, 181 insertions(+), 73 deletions(-)
tools/include/uapi/drm/i915_drm.h +181 -73
@@ -62,6 +62,28 @@ extern "C" {#define I915_ERROR_UEVENT "ERROR"#define I915_RESET_UEVENT "RESET" +/* +* i915_user_extension: Base class for defining a chain of extensions +* +* Many interfaces need to grow over time. In most cases we can simply +* extend the struct and have userspace pass in more data. Another option, +* as demonstrated by Vulkan's approach to providing extensions for forward +* and backward compatibility, is to use a list of optional structs to +* provide those extra details. +* +* The key advantage to using an extension chain is that it allows us to +* redefine the interface more easily than an ever growing struct of +* increasing complexity, and for large parts of that interface to be +* entirely optional. The downside is more pointer chasing; chasing across +* the __user boundary with pointers encapsulated inside u64. +*/ +struct i915_user_extension { +__u64 next_extension; +__u32 name; +__u32 flags;/* All undefined bits must be zero. */ +__u32 rsvd[4 ];/* Reserved for future use; must be zero. */ +}; +/* * MOCS indexes used for GPU surfaces, defining the cacheability of the * surface data and the coherency for this data wrt. CPU vs. GPU accesses.
@@ -99,9 +121,23 @@ enum drm_i915_gem_engine_class {I915_ENGINE_CLASS_VIDEO =2 ,I915_ENGINE_CLASS_VIDEO_ENHANCE =3 , +/* should be kept compact */ + I915_ENGINE_CLASS_INVALID = -1 }; +/* +* There may be more than one engine fulfilling any role within the system. +* Each engine of a class is given a unique instance number and therefore +* any engine can be specified by its class:instance tuplet. APIs that allow +* access to any engine in the system will use struct i915_engine_class_instance +* for this identification. +*/ +struct i915_engine_class_instance { +__u16 engine_class;/* see enum drm_i915_gem_engine_class */ +__u16 engine_instance; +}; +/** * DOC: perf_events exposed by i915 through /sys/bus/event_sources/drivers/i915 *
@@ -319,6 +355,7 @@ typedef struct _drm_i915_sarea {#define DRM_I915_PERF_ADD_CONFIG 0x37#define DRM_I915_PERF_REMOVE_CONFIG 0x38#define DRM_I915_QUERY 0x39 +/* Must be kept compact -- no holes */ #define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH)
@@ -367,6 +404,7 @@ typedef struct _drm_i915_sarea {#define DRM_IOCTL_I915_GET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey)#define DRM_IOCTL_I915_GEM_WAIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_WAIT, struct drm_i915_gem_wait)#define DRM_IOCTL_I915_GEM_CONTEXT_CREATE DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_CREATE, struct drm_i915_gem_context_create) +#define DRM_IOCTL_I915_GEM_CONTEXT_CREATE_EXT DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_CREATE, struct drm_i915_gem_context_create_ext)#define DRM_IOCTL_I915_GEM_CONTEXT_DESTROY DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_DESTROY, struct drm_i915_gem_context_destroy)#define DRM_IOCTL_I915_REG_READ DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_REG_READ, struct drm_i915_reg_read)#define DRM_IOCTL_I915_GET_RESET_STATS DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GET_RESET_STATS, struct drm_i915_reset_stats)
@@ -476,6 +514,7 @@ typedef struct drm_i915_irq_wait {#define I915_SCHEDULER_CAP_ENABLED (1ul << 0)#define I915_SCHEDULER_CAP_PRIORITY (1ul << 1)#define I915_SCHEDULER_CAP_PREEMPTION (1ul << 2) +#define I915_SCHEDULER_CAP_SEMAPHORES (1ul << 3)#define I915_PARAM_HUC_STATUS 42
@@ -559,6 +598,8 @@ typedef struct drm_i915_irq_wait {*/ #define I915_PARAM_MMAP_GTT_COHERENT 52 +/* Must be kept compact -- no holes and well documented */ + typedef struct drm_i915_getparam { __s32 param; /*
@@ -574,6 +615,7 @@ typedef struct drm_i915_getparam {#define I915_SETPARAM_TEX_LRU_LOG_GRANULARITY 2#define I915_SETPARAM_ALLOW_BATCHBUFFER 3#define I915_SETPARAM_NUM_USED_FENCES 4 +/* Must be kept compact -- no holes */ typedef struct drm_i915_setparam { int param;
@@ -972,7 +1014,7 @@ struct drm_i915_gem_execbuffer2 {* struct drm_i915_gem_exec_fence *fences. */ __u64 cliprects_ptr; -#define I915_EXEC_RING_MASK (7<<0) +#define I915_EXEC_RING_MASK (0x3f)#define I915_EXEC_DEFAULT (0<<0)#define I915_EXEC_RENDER (1<<0)#define I915_EXEC_BSD (2<<0)
@@ -1120,32 +1162,34 @@ struct drm_i915_gem_busy {* as busy may become idle before the ioctl is completed. * * Furthermore, if the object is busy, which engine is busy is only -* provided as a guide. There are race conditions which prevent the -* report of which engines are busy from being always accurate. -* However, the converse is not true. If the object is idle, the -* result of the ioctl, that all engines are idle, is accurate. +* provided as a guide and only indirectly by reporting its class +* (there may be more than one engine in each class). There are race +* conditions which prevent the report of which engines are busy from +* being always accurate. However, the converse is not true. If the +* object is idle, the result of the ioctl, that all engines are idle, +* is accurate. * * The returned dword is split into two fields to indicate both -* the engines on which the object is being read, and the -* engine on which it is currently being written (if any). +* the engine classess on which the object is being read, and the +* engine class on which it is currently being written (if any). * * The low word (bits 0:15) indicate if the object is being written * to by any engine (there can only be one, as the GEM implicit * synchronisation rules force writes to be serialised). Only the -* engine for the last write is reported. +* engine class (offset by 1, I915_ENGINE_CLASS_RENDER is reported as +* 1 not 0 etc) for the last write is reported. * -* The high word (bits 16:31) are a bitmask of which engines are -* currently reading from the object. Multiple engines may be +* The high word (bits 16:31) are a bitmask of which engines classes +* are currently reading from the object. Multiple engines may be * reading from the object simultaneously. * -* The value of each engine is the same as specified in the -* EXECBUFFER2 ioctl, i.e. I915_EXEC_RENDER, I915_EXEC_BSD etc. -* Note I915_EXEC_DEFAULT is a symbolic value and is mapped to -* the I915_EXEC_RENDER engine for execution, and so it is never +* The value of each engine class is the same as specified in the +* I915_CONTEXT_SET_ENGINES parameter and via perf, i.e. +* I915_ENGINE_CLASS_RENDER, I915_ENGINE_CLASS_COPY, etc. * reported as active itself. Some hardware may have parallel * execution engines, e.g. multiple media engines, which are -* mapped to the same identifier in the EXECBUFFER2 ioctl and -* so are not separately reported for busyness. +* mapped to the same class identifier and so are not separately +* reported for busyness. * * Caveat emptor: * Only the boolean result of this query is reliable; that is whether
@@ -1412,65 +1456,17 @@ struct drm_i915_gem_wait { };struct drm_i915_gem_context_create { -/* output: id of new context*/ -__u32 ctx_id; -__u32 pad; -}; - -struct drm_i915_gem_context_destroy { -__u32 ctx_id; +__u32 ctx_id;/* output: id of new context*/ __u32 pad; }; -struct drm_i915_reg_read { -/* -* Register offset. -* For 64bit wide registers where the upper 32bits don't immediately -* follow the lower 32bits, the offset of the lower 32bits must -* be specified -*/ -__u64 offset; -#define I915_REG_READ_8B_WA (1ul << 0) - -__u64 val;/* Return value */ -}; -/* Known registers: -* -* Render engine timestamp - 0x2358 + 64bit - gen7+ -* - Note this register returns an invalid value if using the default -* single instruction 8byte read, in order to workaround that pass -* flag I915_REG_READ_8B_WA in offset field. -* -*/ - -struct drm_i915_reset_stats { -__u32 ctx_id; -__u32 flags; - -/* All resets since boot/module reload, for all contexts */ -__u32 reset_count; - -/* Number of batches lost when active in GPU, for this context */ -__u32 batch_active; - -/* Number of batches lost pending for execution, for this context */ -__u32 batch_pending; - -__u32 pad; -}; - -struct drm_i915_gem_userptr { -__u64 user_ptr; -__u64 user_size; +struct drm_i915_gem_context_create_ext { +__u32 ctx_id;/* output: id of new context*/ __u32 flags; -#define I915_USERPTR_READ_ONLY 0x1 -#define I915_USERPTR_UNSYNCHRONIZED 0x80000000 -/** -* Returned handle for the object. -* -* Object handles are nonzero. -*/ -__u32 handle; +#define I915_CONTEXT_CREATE_FLAGS_USE_EXTENSIONS (1u << 0) +#define I915_CONTEXT_CREATE_FLAGS_UNKNOWN \ + (-(I915_CONTEXT_CREATE_FLAGS_USE_EXTENSIONS << 1)) +__u64 extensions; };struct drm_i915_gem_context_param {
@@ -1491,6 +1487,28 @@ struct drm_i915_gem_context_param {* drm_i915_gem_context_param_sseu. */ #define I915_CONTEXT_PARAM_SSEU 0x7 + +/* +* Not all clients may want to attempt automatic recover of a context after +* a hang (for example, some clients may only submit very small incremental +* batches relying on known logical state of previous batches which will never +* recover correctly and each attempt will hang), and so would prefer that +* the context is forever banned instead. +* +* If set to false (0), after a reset, subsequent (and in flight) rendering +* from this context is discarded, and the client will need to create a new +* context to use instead. +* +* If set to true (1), the kernel will automatically attempt to recover the +* context by skipping the hanging batch and executing the next batch starting +* from the default context state (discarding the incomplete logical context +* state lost due to the reset). +* +* On creation, all new contexts are marked as recoverable. +*/ +#define I915_CONTEXT_PARAM_RECOVERABLE 0x8 +/* Must be kept compact -- no holes and well documented */ +__u64 value; };
@@ -1519,8 +1537,7 @@ struct drm_i915_gem_context_param_sseu {/* * Engine class & instance to be configured or queried. */ -__u16 engine_class; -__u16 engine_instance; +struct i915_engine_class_instance engine;/* * Unused for now. Must be cleared to zero.
@@ -1553,6 +1570,96 @@ struct drm_i915_gem_context_param_sseu {__u32 rsvd; }; +struct drm_i915_gem_context_create_ext_setparam { +#define I915_CONTEXT_CREATE_EXT_SETPARAM 0 +struct i915_user_extension base; +struct drm_i915_gem_context_param param; +}; + +struct drm_i915_gem_context_destroy { +__u32 ctx_id; +__u32 pad; +}; + +/* +* DRM_I915_GEM_VM_CREATE - +* +* Create a new virtual memory address space (ppGTT) for use within a context +* on the same file. Extensions can be provided to configure exactly how the +* address space is setup upon creation. +* +* The id of new VM (bound to the fd) for use with I915_CONTEXT_PARAM_VM is +* returned in the outparam @id. +* +* No flags are defined, with all bits reserved and must be zero. +* +* An extension chain maybe provided, starting with @extensions, and terminated +* by the @next_extension being 0. Currently, no extensions are defined. +* +* DRM_I915_GEM_VM_DESTROY - +* +* Destroys a previously created VM id, specified in @id. +* +* No extensions or flags are allowed currently, and so must be zero. +*/ +struct drm_i915_gem_vm_control { +__u64 extensions; +__u32 flags; +__u32 vm_id; +}; + +struct drm_i915_reg_read { +/* +* Register offset. +* For 64bit wide registers where the upper 32bits don't immediately +* follow the lower 32bits, the offset of the lower 32bits must +* be specified +*/ +__u64 offset; +#define I915_REG_READ_8B_WA (1ul << 0) + +__u64 val;/* Return value */ +}; + +/* Known registers: +* +* Render engine timestamp - 0x2358 + 64bit - gen7+ +* - Note this register returns an invalid value if using the default +* single instruction 8byte read, in order to workaround that pass +* flag I915_REG_READ_8B_WA in offset field. +* +*/ + +struct drm_i915_reset_stats { +__u32 ctx_id; +__u32 flags; + +/* All resets since boot/module reload, for all contexts */ +__u32 reset_count; + +/* Number of batches lost when active in GPU, for this context */ +__u32 batch_active; + +/* Number of batches lost pending for execution, for this context */ +__u32 batch_pending; + +__u32 pad; +}; + +struct drm_i915_gem_userptr { +__u64 user_ptr; +__u64 user_size; +__u32 flags; +#define I915_USERPTR_READ_ONLY 0x1 +#define I915_USERPTR_UNSYNCHRONIZED 0x80000000 +/** +* Returned handle for the object. +* +* Object handles are nonzero. +*/ +__u32 handle; +}; +enum drm_i915_oa_format {I915_OA_FORMAT_A13 =1 ,/* HSW only */ I915_OA_FORMAT_A29 ,/* HSW only */
@@ -1714,6 +1821,7 @@ struct drm_i915_perf_oa_config {struct drm_i915_query_item {__u64 query_id;#define DRM_I915_QUERY_TOPOLOGY_INFO 1 +/* Must be kept compact -- no holes and well documented */ /* * When set to zero by userspace, this is filled with the size of the
Signature · 1 line
2.20.1
Arnaldo Carvalho de Melo
maintainerPATCH 8/14 tools headers UAPI: Sync drm/drm.h with the kernel
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
To pick up the changes in these csets:
060cebb20cdb ("drm: introduce a capability flag for syncobj timeline support") 50d1ebef79ef ("drm/syncobj: add timeline signal ioctl for syncobj v5") ea569910cbab ("drm/syncobj: add transition iotcls between binary and timeline v2") 27b575a9aa2f ("drm/syncobj: add timeline payload query ioctl v6") 01d6c3578379 ("drm/syncobj: add support for timeline point wait v8") 783195ec1cad ("drm/syncobj: disable the timeline UAPI for now v2") 48197bc564c7 ("drm: add syncobj timeline support v9")
Which automagically results in the following new ioctls being recognized by the 'perf trace' ioctl cmd arg beautifier:
$ tools/perf/trace/beauty/drm_ioctl.sh > /tmp/before
$ cp include/uapi/drm/drm.h tools/include/uapi/drm/drm.h
$ tools/perf/trace/beauty/drm_ioctl.sh > /tmp/after
$ diff -u /tmp/before /tmp/after
--- /tmp/before 2019-05-22 10:25:31.443151182 -0300
+++ /tmp/after 2019-05-22 10:25:46.449354819 -0300
@@ -103,6 +103,10 @@
[0xC7] = "MODE_LIST_LESSEES",
[0xC8] = "MODE_GET_LEASE",
[0xC9] = "MODE_REVOKE_LEASE",
+ [0xCA] = "SYNCOBJ_TIMELINE_WAIT",
+ [0xCB] = "SYNCOBJ_QUERY",
+ [0xCC] = "SYNCOBJ_TRANSFER",
+ [0xCD] = "SYNCOBJ_TIMELINE_SIGNAL",
[DRM_COMMAND_BASE + 0x00] = "I915_INIT",
[DRM_COMMAND_BASE + 0x01] = "I915_FLUSH",
[DRM_COMMAND_BASE + 0x02] = "I915_FLIP",
$I.e. the strace like raw_tracepoint:sys_enter handler in 'perf trace' will get the cmd integer value and map it to the string.
At some point it should be possible to translate from string to integer and use to filter using expressions such as:
# perf trace -e ioctl/cmd==DRM_IOCTL_SYNCOBJ*/
Or some more suitable syntax to express that only these ioctls when acting on DRM fds should be shown.
--- tools/include/uapi/drm/drm.h | 37 ++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
tools/include/uapi/drm/drm.h +37 -0
@@ -649,6 +649,7 @@ struct drm_gem_open {#define DRM_CAP_PAGE_FLIP_TARGET 0x11#define DRM_CAP_CRTC_IN_VBLANK_EVENT 0x12#define DRM_CAP_SYNCOBJ 0x13 +#define DRM_CAP_SYNCOBJ_TIMELINE 0x14/** DRM_IOCTL_GET_CAP ioctl argument type */ struct drm_get_cap {
@@ -735,8 +736,18 @@ struct drm_syncobj_handle {__u32 pad; }; +struct drm_syncobj_transfer { +__u32 src_handle; +__u32 dst_handle; +__u64 src_point; +__u64 dst_point; +__u32 flags; +__u32 pad; +}; +#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL (1 << 0)#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1) +#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE (1 << 2)/* wait for time point to become available */ struct drm_syncobj_wait {__u64 handles;/* absolute timeout */
@@ -747,12 +758,33 @@ struct drm_syncobj_wait {__u32 pad; }; +struct drm_syncobj_timeline_wait { +__u64 handles; +/* wait on specific timeline point for every handles*/ +__u64 points; +/* absolute timeout */ +__s64 timeout_nsec; +__u32 count_handles; +__u32 flags; +__u32 first_signaled;/* only valid when not waiting all */ +__u32 pad; +}; + +struct drm_syncobj_array {__u64 handles;__u32 count_handles;__u32 pad; }; +struct drm_syncobj_timeline_array { +__u64 handles; +__u64 points; +__u32 count_handles; +__u32 pad; +}; + +/* Query current scanout sequence number */ struct drm_crtc_get_sequence {__u32 crtc_id;/* requested crtc_id */
@@ -909,6 +941,11 @@ extern "C" {#define DRM_IOCTL_MODE_GET_LEASE DRM_IOWR(0xC8, struct drm_mode_get_lease)#define DRM_IOCTL_MODE_REVOKE_LEASE DRM_IOWR(0xC9, struct drm_mode_revoke_lease) +#define DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT DRM_IOWR(0xCA, struct drm_syncobj_timeline_wait) +#define DRM_IOCTL_SYNCOBJ_QUERY DRM_IOWR(0xCB, struct drm_syncobj_timeline_array) +#define DRM_IOCTL_SYNCOBJ_TRANSFER DRM_IOWR(0xCC, struct drm_syncobj_transfer) +#define DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL DRM_IOWR(0xCD, struct drm_syncobj_timeline_array) +/** * Device specific ioctls should only be in their respective headers * The device specific ioctl range is from 0x40 to 0x9f.
Signature · 1 line
2.20.1
Arnaldo Carvalho de Melo
maintainerPATCH 9/14 perf namespace: Protect reading thread's namespace
In reply to Arnaldo Carvalho de MeloFrom: Namhyung Kim <[email protected]>
It seems that the current code lacks holding the namespace lock in thread__namespaces(). Otherwise it can see inconsistent results.
--- tools/perf/util/thread.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
tools/perf/util/thread.c +13 -2
@@ -133,7 +133,7 @@ void thread__put(struct thread *thread) } } -struct namespaces *thread__namespaces (const struct thread *thread) +static struct namespaces *__thread__namespaces (const struct thread *thread) {if (list_empty (&thread->namespaces_list))return NULL ;
@@ -141,10 +141,21 @@ struct namespaces *thread__namespaces(const struct thread *thread) return list_first_entry(&thread->namespaces_list, struct namespaces, list); } +struct namespaces *thread__namespaces (const struct thread *thread) +{ +struct namespaces *ns; + +down_read ((struct rw_semaphore *)&thread->namespaces_lock); + ns =__thread__namespaces (thread); +up_read ((struct rw_semaphore *)&thread->namespaces_lock); + +return ns; +} +static int __thread__set_namespaces (struct thread *thread,u64 timestamp,struct namespaces_event *event) { -struct namespaces *new, *curr =thread__namespaces (thread); +struct namespaces *new, *curr =__thread__namespaces (thread); new =namespaces__new (event);if (!new)
Signature · 1 line
2.20.1
Arnaldo Carvalho de Melo
maintainerPATCH 10/14 perf session: Add missing swap ops for namespace events
In reply to Arnaldo Carvalho de MeloFrom: Namhyung Kim <[email protected]>
In case it's recorded in a different arch.
--- tools/perf/util/session.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
tools/perf/util/session.c +21 -0
@@ -647,6 +647,26 @@ static void perf_event__throttle_swap(union perf_event *event,swap_sample_id_all (event, &event->throttle +1 ); } +static void perf_event__namespaces_swap (union perf_event *event, +bool sample_id_all) +{ +u64 i; + + event->namespaces.pid =bswap_32 (event->namespaces.pid); + event->namespaces.tid =bswap_32 (event->namespaces.tid); + event->namespaces.nr_namespaces =bswap_64 (event->namespaces.nr_namespaces); + +for (i =0 ; i < event->namespaces.nr_namespaces; i++) { +struct perf_ns_link_info *ns = &event->namespaces.link_info[i]; + + ns->dev =bswap_64 (ns->dev); + ns->ino =bswap_64 (ns->ino); + } + +if (sample_id_all) +swap_sample_id_all (event, &event->namespaces.link_info[i]); +} +static u8 revbyte (u8 b) {int rev = (b >>4 ) | ((b &0xf ) <<4 );
@@ -887,6 +907,7 @@ static perf_event__swap_op perf_event__swap_ops[] = { [PERF_RECORD_LOST_SAMPLES] = perf_event__all64_swap, [PERF_RECORD_SWITCH] = perf_event__switch_swap, [PERF_RECORD_SWITCH_CPU_WIDE] = perf_event__switch_swap, + [PERF_RECORD_NAMESPACES] = perf_event__namespaces_swap, [PERF_RECORD_HEADER_ATTR] = perf_event__hdr_attr_swap, [PERF_RECORD_HEADER_EVENT_TYPE] = perf_event__event_type_swap, [PERF_RECORD_HEADER_TRACING_DATA] = perf_event__tracing_data_swap,
Signature · 1 line
2.20.1
Arnaldo Carvalho de Melo
maintainerPATCH 11/14 perf test vmlinux-kallsyms: Ignore aliases to _etext when searching on kallsyms
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
No need to search for aliases for the symbol that marks the end of the kernel text segment, the following patch will make such symbols not to be found when searching in the kallsyms maps causing this test to fail.
So as a prep patch to avoid breaking bisection, ignore such symbols.
--- tools/perf/tests/vmlinux-kallsyms.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
tools/perf/tests/vmlinux-kallsyms.c +8 -1
@@ -161,9 +161,16 @@ int test__vmlinux_matches_kallsyms(struct test *test __maybe_unused, int subtestcontinue ; } - }else + }else if (mem_start == kallsyms.vmlinux_map->end) { +/* +* Ignore aliases to _etext, i.e. to the end of the kernel text area, +* such as __indirect_thunk_end. +*/ +continue ; + }else {pr_debug ("ERR : %#" PRIx64": %s not on kallsyms\n" , mem_start, sym->name); + } err =-1 ; }
Signature · 1 line
2.20.1
Arnaldo Carvalho de Melo
maintainerPATCH 12/14 perf machine: Read also the end of the kernel
In reply to Arnaldo Carvalho de MeloFrom: Jiri Olsa <[email protected]>
We mark the end of kernel based on the first module, but that could cover some bpf program maps. Reading _etext symbol if it's present to get precise kernel map end.
--- tools/perf/util/machine.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-)
tools/perf/util/machine.c +18 -9
@@ -924,7 +924,8 @@ const char *ref_reloc_sym_names[] = {"_text", "_stext", NULL};* symbol_name if it's not that important. */ static int machine__get_running_kernel_start (struct machine *machine, -const char **symbol_name,u64 *start) +const char **symbol_name, +u64 *start,u64 *end) {char filename[PATH_MAX ];int i, err =-1 ;
@@ -949,6 +950,11 @@ static int machine__get_running_kernel_start(struct machine *machine, *symbol_name = name; *start = addr; + + err =kallsyms__get_function_start (filename,"_etext" , &addr); +if (!err) + *end = addr; +return 0 ; }
@@ -1441,7 +1447,7 @@ int machine__create_kernel_maps(struct machine *machine)struct dso *kernel =machine__get_kernel (machine);const char *name =NULL ;struct map *map; -u64 addr =0 ; +u64 start =0 , end = ~0ULL ;int ret;if (kernel ==NULL )
@@ -1460,9 +1466,9 @@ int machine__create_kernel_maps(struct machine *machine) "continuing anyway...\n", machine->pid); } -if (!machine__get_running_kernel_start (machine, &name, &addr)) { +if (!machine__get_running_kernel_start (machine, &name, &start, &end)) {if (name && -map__set_kallsyms_ref_reloc_sym (machine->vmlinux_map, name, addr)) { +map__set_kallsyms_ref_reloc_sym (machine->vmlinux_map, name, start)) {machine__destroy_kernel_maps (machine); ret =-1 ; goto out_put;
@@ -1472,16 +1478,19 @@ int machine__create_kernel_maps(struct machine *machine)* we have a real start address now, so re-order the kmaps * assume it's the last in the kmaps */ -machine__update_kernel_mmap (machine, addr, ~0ULL ); +machine__update_kernel_mmap (machine, start, end); }if (machine__create_extra_kernel_maps (machine, kernel))pr_debug ("Problems creating extra kernel maps, continuing anyway...\n" ); -/* update end address of the kernel map using adjacent module address */ - map =map__next (machine__kernel_map (machine)); -if (map) -machine__set_kernel_mmap (machine, addr, map->start); +if (end == ~0ULL ) { +/* update end address of the kernel map using adjacent module address */ + map =map__next (machine__kernel_map (machine)); +if (map) +machine__set_kernel_mmap (machine, start, map->start); + } + out_put:dso__put (kernel);return ret;
Signature · 1 line
2.20.1
Arnaldo Carvalho de Melo
maintainerPATCH 13/14 perf record: Fix s390 missing module symbol and warning for non-root users
In reply to Arnaldo Carvalho de MeloFrom: Thomas Richter <[email protected]>
Command 'perf record' and 'perf report' on a system without kernel debuginfo packages uses /proc/kallsyms and /proc/modules to find addresses for kernel and module symbols. On x86 this works for root and non-root users.
On s390, when invoked as non-root user, many of the following warnings are shown and module symbols are missing:
proc/{kallsyms,modules} inconsistency while looking for
"[sha1_s390]" module!
Command 'perf record' creates a list of module start addresses by parsing the output of /proc/modules and creates a PERF_RECORD_MMAP record for the kernel and each module. The following function call sequence is executed:
machine__create_kernel_maps
machine__create_module
modules__parse
machine__create_module --> for each line in /proc/modules
arch__fix_module_text_startFunction arch__fix_module_text_start() is s390 specific. It opens file /sys/module/<name>/sections/.text to extract the module's .text section start address. On s390 the module loader prepends a header before the first section, whereas on x86 the module's text section address is identical the the module's load address.
However module section files are root readable only. For non-root the read operation fails and machine__create_module() returns an error. Command perf record does not generate any PERF_RECORD_MMAP record for loaded modules. Later command perf report complains about missing module maps.
To fix this function arch__fix_module_text_start() always returns success. For root users there is no change, for non-root users the module's load address is used as module's text start address (the prepended header then counts as part of the text section).
This enable non-root users to use module symbols and avoid the warning when perf report is executed.
Output before:
[tmricht@m83lp54 perf]$ ./perf report -D | fgrep MMAP 0 0x168 [0x50]: PERF_RECORD_MMAP ... x [kernel.kallsyms]_text
Output after:
[tmricht@m83lp54 perf]$ ./perf report -D | fgrep MMAP
0 0x168 [0x50]: PERF_RECORD_MMAP ... x [kernel.kallsyms]_text 0 0x1b8 [0x98]: PERF_RECORD_MMAP ... x /lib/modules/.../autofs4.ko.xz 0 0x250 [0xa8]: PERF_RECORD_MMAP ... x /lib/modules/.../sha_common.ko.xz 0 0x2f8 [0x98]: PERF_RECORD_MMAP ... x /lib/modules/.../des_generic.ko.xz
--- tools/perf/arch/s390/util/machine.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
tools/perf/arch/s390/util/machine.c +6 -3
@@ -5,16 +5,19 @@#include "util.h" #include "machine.h" #include "api/fs/fs.h" +#include "debug.h" int arch__fix_module_text_start (u64 *start,const char *name) { +u64 m_start = *start;char path[PATH_MAX ];snprintf (path,PATH_MAX ,"module/%.*s/sections/.text" , (int )strlen (name) -2 , name +1 ); - -if (sysfs__read_ull (path, (unsigned long long *)start) <0 ) -return -1 ; +if (sysfs__read_ull (path, (unsigned long long *)start) <0 ) { +pr_debug2 ("Using module %s start:%#lx\n" , path, m_start); + *start = m_start; + }return 0 ; }
Signature · 1 line
2.20.1
Arnaldo Carvalho de Melo
maintainerPATCH 14/14 tools headers UAPI: Sync kvm.h headers with the kernel sources
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
dd53f6102c30 ("Merge tag 'kvmarm-for-v5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm into HEAD") 59c5c58c5b93 ("Merge tag 'kvm-ppc-next-5.2-2' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc into HEAD") d7547c55cbe7 ("KVM: Introduce KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2")
6520ca64cde7 ("KVM: PPC: Book3S HV: XIVE: Add a mapping for the source ESB pages")
39e9af3de5ca ("KVM: PPC: Book3S HV: XIVE: Add a TIMA mapping")
e4945b9da52b ("KVM: PPC: Book3S HV: XIVE: Add get/set accessors for the VP XIVE state")
e6714bd1671d ("KVM: PPC: Book3S HV: XIVE: Add a control to dirty the XIVE EQ pages")
7b46b6169ab8 ("KVM: PPC: Book3S HV: XIVE: Add a control to sync the sources")
5ca806474859 ("KVM: PPC: Book3S HV: XIVE: Add a global reset control")
13ce3297c576 ("KVM: PPC: Book3S HV: XIVE: Add controls for the EQ configuration")
e8676ce50e22 ("KVM: PPC: Book3S HV: XIVE: Add a control to configure a source")
4131f83c3d64 ("KVM: PPC: Book3S HV: XIVE: add a control to initialize a source")
eacc56bb9de3 ("KVM: PPC: Book3S HV: XIVE: Introduce a new capability KVM_CAP_PPC_IRQ_XIVE") 90c73795afa2 ("KVM: PPC: Book3S HV: Add a new KVM device for the XIVE native exploitation mode") 4f45b90e1c03 ("KVM: s390: add deflate conversion facilty to cpu model")
a243c16d18be ("KVM: arm64: Add capability to advertise ptrauth for guest")
a22fa321d13b ("KVM: arm64: Add userspace flag to enable pointer authentication")
4bd774e57b29 ("KVM: arm64/sve: Simplify KVM_REG_ARM64_SVE_VLS array sizing")
8ae6efdde451 ("KVM: arm64/sve: Clean up UAPI register ID definitions")
173aec2d5a9f ("KVM: s390: add enhanced sort facilty to cpu model")
555f3d03e7fb ("KVM: arm64: Add a capability to advertise SVE support")
9033bba4b535 ("KVM: arm64/sve: Add pseudo-register for the guest's vector lengths")
7dd32a0d0103 ("KVM: arm/arm64: Add KVM_ARM_VCPU_FINALIZE ioctl")
e1c9c98345b3 ("KVM: arm64/sve: Add SVE support to register access ioctl interface")
2b953ea34812 ("KVM: Allow 2048-bit register access via ioctl interface")
None entails changes in tooling, the closest to that were some new arch specific ioctls, that are still not handled by the tools/perf/trace/beauty/ library, that needs to create per-arch tables to convert ioctl cmd->string (and back).
From a quick look the arch specific kvm-stat.c files at:
$ ls -1 tools/perf/arch/*/util/kvm-stat.c tools/perf/arch/powerpc/util/kvm-stat.c tools/perf/arch/s390/util/kvm-stat.c tools/perf/arch/x86/util/kvm-stat.c $
Are not affected.
This silences these perf building warnings:
Warning: Kernel ABI header at 'tools/include/uapi/linux/kvm.h' differs from latest version at 'include/uapi/linux/kvm.h' diff -u tools/include/uapi/linux/kvm.h include/uapi/linux/kvm.h
Warning: Kernel ABI header at 'tools/arch/powerpc/include/uapi/asm/kvm.h' differs from latest version at 'arch/powerpc/include/uapi/asm/kvm.h' diff -u tools/arch/powerpc/include/uapi/asm/kvm.h arch/powerpc/include/uapi/asm/kvm.h
Warning: Kernel ABI header at 'tools/arch/s390/include/uapi/asm/kvm.h' differs from latest version at 'arch/s390/include/uapi/asm/kvm.h' diff -u tools/arch/s390/include/uapi/asm/kvm.h arch/s390/include/uapi/asm/kvm.h
Warning: Kernel ABI header at 'tools/arch/arm64/include/uapi/asm/kvm.h' differs from latest version at 'arch/arm64/include/uapi/asm/kvm.h' diff -u tools/arch/arm64/include/uapi/asm/kvm.h arch/arm64/include/uapi/asm/kvm.h
--- tools/arch/arm64/include/uapi/asm/kvm.h | 43 +++++++++++++++++++++ tools/arch/powerpc/include/uapi/asm/kvm.h | 46 +++++++++++++++++++++++ tools/arch/s390/include/uapi/asm/kvm.h | 4 +- tools/include/uapi/linux/kvm.h | 15 +++++++- 4 files changed, 105 insertions(+), 3 deletions(-)
tools/arch/arm64/include/uapi/asm/kvm.h +43 -0
@@ -35,6 +35,7 @@#include <linux/psci.h> #include <linux/types.h> #include <asm/ptrace.h> +#include <asm/sve_context.h> #define __KVM_HAVE_GUEST_DEBUG#define __KVM_HAVE_IRQ_LINE
@@ -102,6 +103,9 @@ struct kvm_regs {#define KVM_ARM_VCPU_EL1_32BIT 1/* CPU running a 32bit VM */ #define KVM_ARM_VCPU_PSCI_0_2 2/* CPU uses PSCI v0.2 */ #define KVM_ARM_VCPU_PMU_V3 3/* Support guest PMUv3 */ +#define KVM_ARM_VCPU_SVE 4/* enable SVE for this CPU */ +#define KVM_ARM_VCPU_PTRAUTH_ADDRESS 5/* VCPU uses address authentication */ +#define KVM_ARM_VCPU_PTRAUTH_GENERIC 6/* VCPU uses generic authentication */ struct kvm_vcpu_init {__u32 target;
@@ -226,6 +230,45 @@ struct kvm_vcpu_events { KVM_REG_ARM_FW | ((r) & 0xffff))#define KVM_REG_ARM_PSCI_VERSION KVM_REG_ARM_FW_REG(0) +/* SVE registers */ +#define KVM_REG_ARM64_SVE (0x15 << KVM_REG_ARM_COPROC_SHIFT) + +/* Z- and P-regs occupy blocks at the following offsets within this range: */ +#define KVM_REG_ARM64_SVE_ZREG_BASE 0 +#define KVM_REG_ARM64_SVE_PREG_BASE 0x400 +#define KVM_REG_ARM64_SVE_FFR_BASE 0x600 + +#define KVM_ARM64_SVE_NUM_ZREGS __SVE_NUM_ZREGS +#define KVM_ARM64_SVE_NUM_PREGS __SVE_NUM_PREGS + +#define KVM_ARM64_SVE_MAX_SLICES 32 + +#define KVM_REG_ARM64_SVE_ZREG (n, i) \ + (KVM_REG_ARM64 | KVM_REG_ARM64_SVE | KVM_REG_ARM64_SVE_ZREG_BASE | \ + KVM_REG_SIZE_U2048 | \ + (((n) & (KVM_ARM64_SVE_NUM_ZREGS - 1)) << 5) | \ + ((i) & (KVM_ARM64_SVE_MAX_SLICES - 1))) + +#define KVM_REG_ARM64_SVE_PREG (n, i) \ + (KVM_REG_ARM64 | KVM_REG_ARM64_SVE | KVM_REG_ARM64_SVE_PREG_BASE | \ + KVM_REG_SIZE_U256 | \ + (((n) & (KVM_ARM64_SVE_NUM_PREGS - 1)) << 5) | \ + ((i) & (KVM_ARM64_SVE_MAX_SLICES - 1))) + +#define KVM_REG_ARM64_SVE_FFR (i) \ + (KVM_REG_ARM64 | KVM_REG_ARM64_SVE | KVM_REG_ARM64_SVE_FFR_BASE | \ + KVM_REG_SIZE_U256 | \ + ((i) & (KVM_ARM64_SVE_MAX_SLICES - 1))) + +#define KVM_ARM64_SVE_VQ_MIN __SVE_VQ_MIN +#define KVM_ARM64_SVE_VQ_MAX __SVE_VQ_MAX + +/* Vector lengths pseudo-register: */ +#define KVM_REG_ARM64_SVE_VLS (KVM_REG_ARM64 | KVM_REG_ARM64_SVE | \ + KVM_REG_SIZE_U512 | 0xffff) +#define KVM_ARM64_SVE_VLS_WORDS \ + ((KVM_ARM64_SVE_VQ_MAX - KVM_ARM64_SVE_VQ_MIN) / 64 + 1) +/* Device Control API: ARM VGIC */ #define KVM_DEV_ARM_VGIC_GRP_ADDR 0#define KVM_DEV_ARM_VGIC_GRP_DIST_REGS 1
tools/arch/powerpc/include/uapi/asm/kvm.h +46 -0
56 lines not on this page · raw message
tools/arch/s390/include/uapi/asm/kvm.h +3 -1
@@ -153,7 +153,9 @@ struct kvm_s390_vm_cpu_subfunc {__u8 ppno[16 ];/* with MSA5 */ __u8 kma[16 ];/* with MSA8 */ __u8 kdsa[16 ];/* with MSA9 */ -__u8 reserved[1792 ]; +__u8 sortl[32 ];/* with STFLE.150 */ +__u8 dfltcc[32 ];/* with STFLE.151 */ +__u8 reserved[1728 ]; };/* kvm attributes for crypto */
tools/include/uapi/linux/kvm.h +13 -2
@@ -986,8 +986,13 @@ struct kvm_ppc_resize_hpt {#define KVM_CAP_HYPERV_ENLIGHTENED_VMCS 163#define KVM_CAP_EXCEPTION_PAYLOAD 164#define KVM_CAP_ARM_VM_IPA_SIZE 165 -#define KVM_CAP_MANUAL_DIRTY_LOG_PROTECT 166 +#define KVM_CAP_MANUAL_DIRTY_LOG_PROTECT 166/* Obsolete */ #define KVM_CAP_HYPERV_CPUID 167 +#define KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 168 +#define KVM_CAP_PPC_IRQ_XIVE 169 +#define KVM_CAP_ARM_SVE 170 +#define KVM_CAP_ARM_PTRAUTH_ADDRESS 171 +#define KVM_CAP_ARM_PTRAUTH_GENERIC 172#ifdef KVM_CAP_IRQ_ROUTING
@@ -1145,6 +1150,7 @@ struct kvm_dirty_tlb {#define KVM_REG_SIZE_U256 0x0050000000000000ULL#define KVM_REG_SIZE_U512 0x0060000000000000ULL#define KVM_REG_SIZE_U1024 0x0070000000000000ULL +#define KVM_REG_SIZE_U2048 0x0080000000000000ULLstruct kvm_reg_list {__u64 n;/* number of regs */
@@ -1211,6 +1217,8 @@ enum kvm_device_type {#define KVM_DEV_TYPE_ARM_VGIC_V3 KVM_DEV_TYPE_ARM_VGIC_V3 KVM_DEV_TYPE_ARM_VGIC_ITS,#define KVM_DEV_TYPE_ARM_VGIC_ITS KVM_DEV_TYPE_ARM_VGIC_ITS + KVM_DEV_TYPE_XIVE, +#define KVM_DEV_TYPE_XIVE KVM_DEV_TYPE_XIVE KVM_DEV_TYPE_MAX, };
@@ -1434,12 +1442,15 @@ struct kvm_enc_region {#define KVM_GET_NESTED_STATE _IOWR(KVMIO, 0xbe, struct kvm_nested_state)#define KVM_SET_NESTED_STATE _IOW(KVMIO, 0xbf, struct kvm_nested_state) -/* Available with KVM_CAP_MANUAL_DIRTY_LOG_PROTECT */ +/* Available with KVM_CAP_MANUAL_DIRTY_LOG_PROTECT_2 */ #define KVM_CLEAR_DIRTY_LOG _IOWR(KVMIO, 0xc0, struct kvm_clear_dirty_log)/* Available with KVM_CAP_HYPERV_CPUID */ #define KVM_GET_SUPPORTED_HV_CPUID _IOWR(KVMIO, 0xc1, struct kvm_cpuid2) +/* Available with KVM_CAP_ARM_SVE */ +#define KVM_ARM_VCPU_FINALIZE _IOW(KVMIO, 0xc2, int) +/* Secure Encrypted Virtualization command */ enum sev_cmd_id {/* Guest initialization commands */
Signature · 1 line
2.20.1
Quoted 127 lines · Arnaldo Carvalho de Melo
Hi Ingo,
Please consider pulling, that is a trimmed down set from
yesterday's pull req, with just fixes.The other stuff, mostly acting on the warnings for the UAPI
changes are being packaged into a perf/core pull request I'll send for 5.3.I had it mostly done earlier, but then I noticed the fix for
the syscall numbers, and backtracked to avoid sending yet another pull req, got too late in the -rc game, so 5.3 they go.I'm not reposting them, the only change was adding an Acked-by
for one of the UAPI syncs, thedrm.hone.I did all the tests again, find them below, after the new signed
tag.Best regards,
- Arnaldo
Test results at the end of this message, as usual.
The following changes since commit
5bdd9ad875b6edf213f54ec3986ed9e8640c5cf9:Merge tag 'kbuild-fixes-v5.2' of
git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild(2019-05-20 17:22:17 -0700)are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.gittags/perf-urgent-for-mingo-5.2-20190528for you to fetch changes up to
a7350998a25ac10cdca5b33dee1d343a74debbfe:tools headers UAPI: Sync
kvm.hheaders with the kernel sources (2019-05-28 09:52:23 -0300)----------------------------------------------------------------
perf/urgent fixes:BPF:
Jiri Olsa:
- Fixup determination of end of kernel map, to avoid having BPF programs, that are after the kernel headers and just before module texts mixed up in the kernel map.
tools UAPI header copies:
Arnaldo Carvalho de Melo:
- Update copy of files related to new fspick, fsmount, fsconfig, fsopen,
move_mountandopen_treesyscalls.- Sync
cpufeatures.h,sched.h,fs.h,drm.h,i915_drm.handkvm.hheaders.Namespaces:
Namhyung Kim:
- Add missing byte swap ops for namespace events when processing records from perf.data files that could have been recorded in a arch with a different endianness.
- Fix access to the thread namespaces list by using the
namespaces_lock.perf data:
Shawn Landden:
- Fix 'strncat may truncate' build failure with recent gcc.
s/390
Thomas Richter:
- Fix s390 missing module symbol and warning for non-root users in 'perf record'.
arm64:
Vitaly Chikunov:
- Fix mksyscalltbl when system kernel headers are ahead of the kernel.
Signed-off-by Arnaldo Carvalho de Melo <[email protected]>----------------------------------------------------------------
Arnaldo Carvalho de Melo (8):
tools include UAPI: Update copy of files related to new fspick, fsmount, fsconfig, fsopen,move_mountandopen_treesyscalls tools arch x86: Syncasm/cpufeatures.hwith the with the kernel
tools headers UAPI: Synclinux/sched.hwith the kernel
tools headers UAPI: Synclinux/fs.hwith the kernel
tools headers UAPI: Syncdrm/i915_drm.hwith the kernel
tools headers UAPI: Syncdrm/drm.hwith the kernel
perf test vmlinux-kallsyms: Ignore aliases to_etextwhen searching on kallsyms
tools headers UAPI: Synckvm.hheaders with the kernel sourcesJiri Olsa (1):
perf machine: Read also the end of the kernelNamhyung Kim (2):
perf namespace: Protect reading thread's namespace perf session: Add missing swap ops for namespace eventsShawn Landden (1):
perf data: Fix 'strncat may truncate' build failure with recent gccThomas Richter (1):
perf record: Fix s390 missing module symbol and warning for non-root usersVitaly Chikunov (1):
perf arm64: Fix mksyscalltbl when system kernel headers are ahead of the kerneltools/arch/arm64/include/uapi/asm/kvm.h | 43 ++++ tools/arch/powerpc/include/uapi/asm/kvm.h | 46 ++++ tools/arch/s390/include/uapi/asm/kvm.h | 4 +- tools/arch/x86/include/asm/cpufeatures.h | 3 + tools/include/uapi/asm-generic/unistd.h | 14 +- tools/include/uapi/drm/drm.h | 37 ++++ tools/include/uapi/drm/i915_drm.h | 254 +++++++++++++++------- tools/include/uapi/linux/fcntl.h | 2 + tools/include/uapi/linux/fs.h | 3 + tools/include/uapi/linux/kvm.h | 15 +- tools/include/uapi/linux/mount.h | 62 ++++++ tools/include/uapi/linux/sched.h | 1 + tools/perf/arch/arm64/entry/syscalls/mksyscalltbl | 2 +-
Quoted 8 lines
tools/perf/arch/s390/util/machine.c | 9 +- tools/perf/arch/x86/entry/syscalls/syscall_64.tbl | 6 + tools/perf/tests/vmlinux-kallsyms.c | 9 +- tools/perf/util/data-convert-bt.c | 2 +- tools/perf/util/machine.c | 27 ++- tools/perf/util/session.c | 21 ++ tools/perf/util/thread.c | 15 +- 20 files changed, 481 insertions(+), 94 deletions(-)
Pulled, thanks a lot Arnaldo!
Ingo