perf/urgent improvements and fixes
Subsystems (3)
Arnaldo Carvalho de Melo
maintainerHi Ingo/Thomas,
Please consider pulling, mostly small fixes, just one extra
header copied due to linux/fs.h now having parts of it moved to linux/fscrypt.h that then needs syncing so that tooling continues to build on older systems.
Best regards,
- Arnaldo
Test results at the end of this message, as usual.
The following changes since commit da05b5ea12c1e50b2988a63470d6b69434796f8b:
Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip (2019-09-26 15:53: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.4-20191001
for you to fetch changes up to 11aad897f6d1a28eae3b7e5b293647c522d65819:
perf annotate: Don't return -1 for error when doing BPF disassembly (2019-09-30 17:30:06 -0300)
----------------------------------------------------------------
perf/urgent fixes:
perf script:
Andi Kleen:
- Fix recovery from LBR/binary mismatch in the "brstackinsn" --field.
perf annotate:
Arnaldo Carvalho de Melo:
- Propagate errors so that meaningful messages can be presented to the user in case of problems.
perf map:
Steve MacLean:
- Fix handling of maps partially overlapped, resolving symbols in the ranges not replaced by new mmaps.
perf tests:
Ian Rogers:
- Use raise() instead of NULL derefs to avoid causing a SIGILL rather than a SIGSEGV for optimized builds that turn NULL derefs into ud2 instructions.
perf LLVM:
Ian Rogers:
- Don't access out-of-scope array.
perf inject:
Steve MacLean:
- Fix JIT_CODE_MOVE filename, that was having a u64 truncaded into a 32-bit snprintf format and also a missing ".so" suffix in another case.
libsubcmd:
Ian Rogers:
- Make _FORTIFY_SOURCE defines dependent on the feature, avoiding false positives with with memory sanitizers such as LLVM's ASan.
Vendor specific events:
Intel:
Andi Kleen:
- Fix period for Intel fixed counters.
s390:
Thomas Richter (2):
- Fix some event details transaction for machine type 8561.
tools headers UAPI:
Arnaldo Carvalho de Melo:
- Sync headers with the kernel, catching new usbdevfs ioctls and madvise behaviours to properly decode in 'perf trace' output.
Documentation:
Steve MacLean:
- Correct and clarify jitdump spec.
----------------------------------------------------------------
Andi Kleen (2):
perf script brstackinsn: Fix recovery from LBR/binary mismatch perf jevents: Fix period for Intel fixed counters
Arnaldo Carvalho de Melo (13):
tools headers uapi: Sync drm/i915_drm.h with the kernel sources tools headers uapi: Sync asm-generic/mman-common.h with the kernel tools headers uapi: Sync linux/usbdevice_fs.h with the kernel sources tools headers uapi: Sync linux/fs.h with the kernel sources tools headers kvm: Sync kvm headers with the kernel sources perf tools: Propagate get_cpuid() error
perf evsel: Fall back to global 'perf_env' in perf_evsel__env() perf annotate: Propagate perf_env__arch() error
perf annotate: Fix the signedness of failure returns
perf annotate: Propagate the symbol__annotate() error return perf annotate: Fix arch specific ->init() failure errors perf annotate: Return appropriate error code for allocation failures perf annotate: Don't return -1 for error when doing BPF disassembly
Ian Rogers (4):
libsubcmd: Make _FORTIFY_SOURCE defines dependent on the feature perf tests: Avoid raising SEGV using an obvious NULL dereference perf docs: Allow man page date to be specified
perf llvm: Don't access out-of-scope array
Steve MacLean (3):
perf map: Fix overlapped map handling
perf inject jit: Fix JIT_CODE_MOVE filename
perf docs: Correct and clarify jitdump spec
Thomas Richter (2):
perf vendor events s390: Add JSON transaction for machine type 8561 perf vendor events s390: Use s390 machine name instead of type 8561
tools/arch/arm/include/uapi/asm/kvm.h | 4 +-
tools/arch/arm64/include/uapi/asm/kvm.h | 4 +-
tools/arch/s390/include/uapi/asm/kvm.h | 6 +
tools/arch/x86/include/uapi/asm/vmx.h | 2 +
tools/include/uapi/asm-generic/mman-common.h | 3 +
tools/include/uapi/drm/i915_drm.h | 1 +
tools/include/uapi/linux/fs.h | 55 +------
tools/include/uapi/linux/fscrypt.h | 181 +++++++++++++++++++++
tools/include/uapi/linux/kvm.h | 3 +
tools/include/uapi/linux/usbdevice_fs.h | 4 +
tools/lib/subcmd/Makefile | 8 +-
tools/perf/Documentation/asciidoc.conf | 3 +
tools/perf/Documentation/jitdump-specification.txt | 4 +-
tools/perf/arch/arm/annotate/instructions.c | 4 +-
tools/perf/arch/arm64/annotate/instructions.c | 4 +-
tools/perf/arch/powerpc/util/header.c | 3 +-
tools/perf/arch/s390/annotate/instructions.c | 6 +-
tools/perf/arch/s390/util/header.c | 9 +-
tools/perf/arch/x86/annotate/instructions.c | 6 +-
tools/perf/arch/x86/util/header.c | 3 +-
tools/perf/builtin-kvm.c | 7 +-
tools/perf/builtin-script.c | 6 +-
tools/perf/check-headers.sh | 1 +
.../arch/s390/{cf_m8561 => cf_z15}/basic.json | 0
.../arch/s390/{cf_m8561 => cf_z15}/crypto.json | 0
.../arch/s390/{cf_m8561 => cf_z15}/crypto6.json | 0
.../arch/s390/{cf_m8561 => cf_z15}/extended.json | 0
.../pmu-events/arch/s390/cf_z15/transaction.json | 7 +
tools/perf/pmu-events/arch/s390/mapfile.csv | 2 +-
tools/perf/pmu-events/jevents.c | 12 +-
tools/perf/tests/perf-hooks.c | 3 +-
tools/perf/util/annotate.c | 35 +++-
tools/perf/util/annotate.h | 4 +
tools/perf/util/evsel.c | 3 +-
tools/perf/util/jitdump.c | 6 +-
tools/perf/util/llvm-utils.c | 6 +-
tools/perf/util/map.c | 3 +
tools/perf/util/python.c | 6 +
38 files changed, 315 insertions(+), 99 deletions(-)
create mode 100644 tools/include/uapi/linux/fscrypt.h
rename tools/perf/pmu-events/arch/s390/{cf_m8561 => cf_z15}/basic.json (100%)
rename tools/perf/pmu-events/arch/s390/{cf_m8561 => cf_z15}/crypto.json (100%)
rename tools/perf/pmu-events/arch/s390/{cf_m8561 => cf_z15}/crypto6.json (100%)
rename tools/perf/pmu-events/arch/s390/{cf_m8561 => cf_z15}/extended.json (100%)
create mode 100644 tools/perf/pmu-events/arch/s390/cf_z15/transaction.jsonTest 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.
Clearlinux is failing when building with libpython, but that is not a perf regression, will try to remove one compiler warning that is causing the problem when building some of the glue code files in the python files, outside perf.
# export PERF_TARBALL=http://192.168.124.1/perf/perf-5.3.0.tar.xz # dm 1 alpine:3.4 : Ok gcc (Alpine 5.3.0) 5.3.0, clang version 3.8.0 (tags/RELEASE_380/final) 2 alpine:3.5 : Ok gcc (Alpine 6.2.1) 6.2.1 20160822, clang version 3.8.1 (tags/RELEASE_381/final) 3 alpine:3.6 : Ok gcc (Alpine 6.3.0) 6.3.0, clang version 4.0.0 (tags/RELEASE_400/final) 4 alpine:3.7 : Ok gcc (Alpine 6.4.0) 6.4.0, Alpine clang version 5.0.0 (tags/RELEASE_500/final) (based on LLVM 5.0.0) 5 alpine:3.8 : Ok gcc (Alpine 6.4.0) 6.4.0, Alpine clang version 5.0.1 (tags/RELEASE_501/final) (based on LLVM 5.0.1) 6 alpine:3.9 : Ok gcc (Alpine 8.3.0) 8.3.0, Alpine clang version 5.0.1 (tags/RELEASE_502/final) (based on LLVM 5.0.1) 7 alpine:3.10 : Ok gcc (Alpine 8.3.0) 8.3.0, Alpine clang version 8.0.0 (tags/RELEASE_800/final) (based on LLVM 8.0.0) 8 alpine:edge : Ok gcc (Alpine 9.2.0) 9.2.0, Alpine clang version 8.0.1 (tags/RELEASE_801/final) (based on LLVM 8.0.1) 9 amazonlinux:1 : Ok gcc (GCC) 7.2.1 20170915 (Red Hat 7.2.1-2), clang version 3.6.2 (tags/RELEASE_362/final) 10 amazonlinux:2 : Ok gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5), clang version 7.0.1 (Amazon Linux 2 7.0.1-1.amzn2.0.2) 11 android-ndk:r12b-arm : Ok arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease) 12 android-ndk:r15c-arm : Ok arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease) 13 centos:5 : Ok gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-55) 14 centos:6 : Ok gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23) 15 centos:7 : Ok gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39), clang version 3.4.2 (tags/RELEASE_34/dot2-final) 16 clearlinux:latest : Ok gcc (Clear Linux OS for Intel Architecture) 9.2.1 20190920 gcc-9-branch@275985, clang version 8.0.0 (tags/RELEASE_800/final) 17 debian:8 : Ok gcc (Debian 4.9.2-10+deb8u2) 4.9.2, Debian clang version 3.5.0-10 (tags/RELEASE_350/final) (based on LLVM 3.5.0) 18 debian:9 : Ok gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516, clang version 3.8.1-24 (tags/RELEASE_381/final) 19 debian:10 : Ok gcc (Debian 8.3.0-6) 8.3.0, clang version 7.0.1-8 (tags/RELEASE_701/final) 20 debian:experimental : Ok gcc (Debian 9.2.1-8) 9.2.1 20190909, clang version 8.0.1-3+b1 (tags/RELEASE_801/final) 21 debian:experimental-x-arm64 : Ok aarch64-linux-gnu-gcc (Debian 8.3.0-19) 8.3.0 22 debian:experimental-x-mips : Ok mips-linux-gnu-gcc (Debian 8.3.0-19) 8.3.0 23 debian:experimental-x-mips64 : Ok mips64-linux-gnuabi64-gcc (Debian 8.3.0-19) 8.3.0 24 debian:experimental-x-mipsel : Ok mipsel-linux-gnu-gcc (Debian 8.3.0-19) 8.3.0 25 fedora:20 : Ok gcc (GCC) 4.8.3 20140911 (Red Hat 4.8.3-7), clang version 3.4.2 (tags/RELEASE_34/dot2-final) 26 fedora:22 : Ok gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6), clang version 3.5.0 (tags/RELEASE_350/final) 27 fedora:23 : Ok gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6), clang version 3.7.0 (tags/RELEASE_370/final) 28 fedora:24 : Ok gcc (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1), clang version 3.8.1 (tags/RELEASE_381/final) 29 fedora:24-x-ARC-uClibc : Ok arc-linux-gcc (ARCompact ISA Linux uClibc toolchain 2017.09-rc2) 7.1.1 20170710 30 fedora:25 : Ok gcc (GCC) 6.4.1 20170727 (Red Hat 6.4.1-1), clang version 3.9.1 (tags/RELEASE_391/final) 31 fedora:26 : Ok gcc (GCC) 7.3.1 20180130 (Red Hat 7.3.1-2), clang version 4.0.1 (tags/RELEASE_401/final) 32 fedora:27 : Ok gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-6), clang version 5.0.2 (tags/RELEASE_502/final) 33 fedora:28 : Ok gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2), clang version 6.0.1 (tags/RELEASE_601/final) 34 fedora:29 : Ok gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2), clang version 7.0.1 (Fedora 7.0.1-6.fc29) 35 fedora:30 : Ok gcc (GCC) 9.2.1 20190827 (Red Hat 9.2.1-1), clang version 8.0.0 (Fedora 8.0.0-1.fc30) 36 fedora:30-x-ARC-glibc : Ok arc-linux-gcc (ARC HS GNU/Linux glibc toolchain 2019.03-rc1) 8.3.1 20190225 37 fedora:30-x-ARC-uClibc : Ok arc-linux-gcc (ARCv2 ISA Linux uClibc toolchain 2019.03-rc1) 8.3.1 20190225 38 fedora:31 : Ok gcc (GCC) 9.2.1 20190827 (Red Hat 9.2.1-1), clang version 8.0.0 (Fedora 8.0.0-3.fc31.1) 39 fedora:rawhide : Ok gcc (GCC) 9.2.1 20190827 (Red Hat 9.2.1-1), clang version 9.0.0 (Fedora 9.0.0-0.2.rc3.fc31) 40 gentoo-stage3-amd64:latest : Ok gcc (Gentoo 8.3.0-r1 p1.1) 8.3.0 41 mageia:5 : Ok gcc (GCC) 4.9.2, clang version 3.5.2 (tags/RELEASE_352/final) 42 mageia:6 : Ok gcc (Mageia 5.5.0-1.mga6) 5.5.0, clang version 3.9.1 (tags/RELEASE_391/final) 43 mageia:7 : Ok gcc (Mageia 8.3.1-0.20190524.1.mga7) 8.3.1 20190524, clang version 8.0.0 (Mageia 8.0.0-1.mga7) 44 manjaro:latest : Ok gcc (GCC) 9.1.0, clang version 8.0.1 (tags/RELEASE_801/final) 45 opensuse:15.0 : Ok gcc (SUSE Linux) 7.4.1 20190424 [gcc-7-branch revision 270538], clang version 5.0.1 (tags/RELEASE_501/final 312548) 46 opensuse:15.1 : Ok gcc (SUSE Linux) 7.4.1 20190424 [gcc-7-branch revision 270538], clang version 7.0.1 (tags/RELEASE_701/final 349238) 47 opensuse:42.3 : Ok gcc (SUSE Linux) 4.8.5, clang version 3.8.0 (tags/RELEASE_380/final 262553) 48 opensuse:tumbleweed : Ok gcc (SUSE Linux) 9.2.1 20190903 [gcc-9-branch revision 275330], clang version 8.0.1 (tags/RELEASE_801/final 366581) 49 oraclelinux:6 : Ok gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23.0.1) 50 oraclelinux:7 : Ok gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39.0.1), clang version 3.4.2 (tags/RELEASE_34/dot2-final) 51 oraclelinux:8 : Ok gcc (GCC) 8.2.1 20180905 (Red Hat 8.2.1-3.0.1), clang version 7.0.1 (tags/RELEASE_701/final) 52 ubuntu:12.04 : Ok gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3, Ubuntu clang version 3.0-6ubuntu3 (tags/RELEASE_30/final) (based on LLVM 3.0) 53 ubuntu:14.04 : Ok gcc (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4, Ubuntu clang version 3.4-1ubuntu3 (tags/RELEASE_34/final) (based on LLVM 3.4) 54 ubuntu:16.04 : Ok gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609, clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final) 55 ubuntu:16.04-x-arm : Ok arm-linux-gnueabihf-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 56 ubuntu:16.04-x-arm64 : Ok aarch64-linux-gnu-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 57 ubuntu:16.04-x-powerpc : Ok powerpc-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 58 ubuntu:16.04-x-powerpc64 : Ok powerpc64-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 59 ubuntu:16.04-x-powerpc64el : Ok powerpc64le-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 60 ubuntu:16.04-x-s390 : Ok s390x-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 61 ubuntu:18.04 : Ok gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0, clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final) 62 ubuntu:18.04-x-arm : Ok arm-linux-gnueabihf-gcc (Ubuntu/Linaro 7.4.0-1ubuntu1~18.04.1) 7.4.0 63 ubuntu:18.04-x-arm64 : Ok aarch64-linux-gnu-gcc (Ubuntu/Linaro 7.4.0-1ubuntu1~18.04.1) 7.4.0 64 ubuntu:18.04-x-m68k : Ok m68k-linux-gnu-gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0 65 ubuntu:18.04-x-powerpc : Ok powerpc-linux-gnu-gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0 66 ubuntu:18.04-x-powerpc64 : Ok powerpc64-linux-gnu-gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0 67 ubuntu:18.04-x-powerpc64el : Ok powerpc64le-linux-gnu-gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0 68 ubuntu:18.04-x-riscv64 : Ok riscv64-linux-gnu-gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0 69 ubuntu:18.04-x-s390 : Ok s390x-linux-gnu-gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0 70 ubuntu:18.04-x-sh4 : Ok sh4-linux-gnu-gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0 71 ubuntu:18.04-x-sparc64 : Ok sparc64-linux-gnu-gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0 72 ubuntu:18.10 : Ok gcc (Ubuntu 8.3.0-6ubuntu1~18.10.1) 8.3.0, clang version 7.0.0-3 (tags/RELEASE_700/final) 73 ubuntu:19.04 : Ok gcc (Ubuntu 8.3.0-6ubuntu1) 8.3.0, clang version 8.0.0-3 (tags/RELEASE_800/final) 74 ubuntu:19.04-x-alpha : Ok alpha-linux-gnu-gcc (Ubuntu 8.3.0-6ubuntu1) 8.3.0 75 ubuntu:19.04-x-arm64 : Ok aarch64-linux-gnu-gcc (Ubuntu/Linaro 8.3.0-6ubuntu1) 8.3.0 76 ubuntu:19.04-x-hppa : Ok hppa-linux-gnu-gcc (Ubuntu 8.3.0-6ubuntu1) 8.3.0 77 ubuntu:19.10 : Ok gcc (Ubuntu 9.2.1-8ubuntu1) 9.2.1 20190909, clang version 9.0.0-+rc5-1~exp1 (tags/RELEASE_900/rc5) #
# uname -a
Linux quaco 5.2.17-200.fc30.x86_64 #1 SMP Mon Sep 23 13:42:32 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
# git log --oneline -1
11aad897f6d1 perf annotate: Don't return -1 for error when doing BPF disassembly
# perf version --build-options
perf version 5.3.g11aad897f6d1
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: time utils : Ok
60: map_groups__merge_in : Ok
61: x86 rdpmc : Ok
62: Convert perf time to TSC : Ok
63: DWARF unwind : Ok
64: x86 instruction decoder - new instructions : Ok
65: Intel PT packet decoder : Ok
66: x86 bp modify : Ok
67: probe libc's inet_pton & backtrace it with ping : Ok
68: Use vfs_getname probe to get syscall args filenames : Ok
69: Add vfs_getname probe to get syscall args filenames : Ok
70: Check open filename arg using perf trace + vfs_getname: Ok
71: 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_no_newt_O: make NO_NEWT=1
make_no_libdw_dwarf_unwind_O: make NO_LIBDW_DWARF_UNWIND=1
make_cscope_O: make cscope
make_help_O: make help
make_pure_O: make
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 NO_LIBCAP=1
make_perf_o_O: make perf.o
make_clean_all_O: make clean all
make_no_gtk2_O: make NO_GTK2=1
make_no_libaudit_O: make NO_LIBAUDIT=1
make_with_babeltrace_O: make LIBBABELTRACE=1
make_util_map_o_O: make util/map.o
make_no_libperl_O: make NO_LIBPERL=1
make_static_O: make LDFLAGS=-static NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1 NO_JVMTI=1
make_no_scripts_O: make NO_LIBPYTHON=1 NO_LIBPERL=1
make_doc_O: make doc
make_install_O: make install
make_debug_O: make DEBUG=1
make_tags_O: make tags
make_no_auxtrace_O: make NO_AUXTRACE=1
make_no_libelf_O: make NO_LIBELF=1
make_no_backtrace_O: make NO_BACKTRACE=1
make_util_pmu_bison_o_O: make util/pmu-bison.o
make_install_prefix_O: make install prefix=/tmp/krava
make_no_libunwind_O: make NO_LIBUNWIND=1
make_no_libbionic_O: make NO_LIBBIONIC=1
make_no_libpython_O: make NO_LIBPYTHON=1
make_no_ui_O: make NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
make_install_prefix_slash_O: make install prefix=/tmp/krava/
make_with_clangllvm_O: make LIBCLANGLLVM=1
make_install_bin_O: make install-bin
make_no_demangle_O: make NO_DEMANGLE=1
make_no_slang_O: make NO_SLANG=1
make_no_libnuma_O: make NO_LIBNUMA=1
make_no_libbpf_O: make NO_LIBBPF=1
OK
make: Leaving directory '/home/acme/git/perf/tools/perf'
$Arnaldo Carvalho de Melo
maintainerPATCH 1/24 libsubcmd: Make _FORTIFY_SOURCE defines dependent on the feature
From: Ian Rogers <[email protected]>
Unconditionally defining _FORTIFY_SOURCE can break tools that don't work with it, such as memory sanitizers:
https://github.com/google/sanitizers/wiki/AddressSanitizer#faq
--- tools/lib/subcmd/Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
tools/lib/subcmd/Makefile +7 -1
@@ -20,7 +20,13 @@ MAKEFLAGS += --no-print-directory LIBFILE = $(OUTPUT)libsubcmd.a CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) -CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC +CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -fPIC + +ifeq ($(DEBUG),0) + ifeq ($(feature-fortify-source), 1) + CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 + endif +endif ifeq ($(CC_NO_CLANG), 0) CFLAGS += -O3
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 2/24 perf tests: Avoid raising SEGV using an obvious NULL dereference
In reply to Arnaldo Carvalho de MeloFrom: Ian Rogers <[email protected]>
An optimized build such as:
make -C tools/perf CLANG=1 CC=clang EXTRA_CFLAGS="-O3
will turn the dereference operation into a ud2 instruction, raising a SIGILL rather than a SIGSEGV. Use raise(..) for correctness and clarity.
Similar issues were addressed in Numfor Mbiziwo-Tiapo's patch:
https://lkml.org/lkml/2019/7/8/1234
Committer testing:
Before:
[root@quaco ~]# perf test hooks
55: perf hooks : Ok
[root@quaco ~]# perf test -v hooks
55: perf hooks :
--- start ---
test child forked, pid 17092
SIGSEGV is observed as expected, try to recover. Fatal error (SEGFAULT) in perf hook 'test' test child finished with 0
---- end ----
perf hooks: Ok
[root@quaco ~]#
After:
[root@quaco ~]# perf test hooks
55: perf hooks : Ok
[root@quaco ~]# perf test -v hooks
55: perf hooks :
--- start ---
test child forked, pid 17909
SIGSEGV is observed as expected, try to recover. Fatal error (SEGFAULT) in perf hook 'test' test child finished with 0
---- end ----
perf hooks: Ok
[root@quaco ~]#
--- tools/perf/tests/perf-hooks.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
tools/perf/tests/perf-hooks.c +1 -2
@@ -19,12 +19,11 @@ static void sigsegv_handler(int sig __maybe_unused)static void the_hook (void *_hook_flags) {int *hook_flags = _hook_flags; -int *p =NULL ; *hook_flags =1234 ;/* Generate a segfault, test perf_hooks__recover */ - *p =0 ; +raise (SIGSEGV ); }int test__perf_hooks (struct test *test__maybe_unused ,int subtest__maybe_unused )
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 3/24 perf docs: Allow man page date to be specified
In reply to Arnaldo Carvalho de MeloFrom: Ian Rogers <[email protected]>
With this change if a perf_date parameter is provided to asciidoc then it will override the default date written to the man page metadata.
Without this change, or if the perf_date isn't specified, then the current date is written to the metadata.
Having this parameter allows the metadata to be constant if builds happen on different dates.
The name of the parameter is intended to be consistent with the existing perf_version parameter.
--- tools/perf/Documentation/asciidoc.conf | 3 +++ 1 file changed, 3 insertions(+)
tools/perf/Documentation/asciidoc.conf +3 -0
@@ -71,6 +71,9 @@ ifdef::backend-docbook[] [header] template::[header-declarations] <refentry> +ifdef::perf_date[] +<refentryinfo><date>{perf_date}</date></refentryinfo> +endif::perf_date[] <refmeta> <refentrytitle>{mantitle}</refentrytitle> <manvolnum>{manvolnum}</manvolnum>
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 4/24 tools headers uapi: Sync drm/i915_drm.h with the kernel sources
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
To pick the change in:
bf73fc0fa9cf ("drm/i915: Show support for accurate sw PMU busyness tracking")
That don't result in any changes in tooling, just 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 | 1 + 1 file changed, 1 insertion(+)
tools/include/uapi/drm/i915_drm.h +1 -0
@@ -521,6 +521,7 @@ typedef struct drm_i915_irq_wait {#define I915_SCHEDULER_CAP_PRIORITY (1ul << 1)#define I915_SCHEDULER_CAP_PREEMPTION (1ul << 2)#define I915_SCHEDULER_CAP_SEMAPHORES (1ul << 3) +#define I915_SCHEDULER_CAP_ENGINE_BUSY_STATS (1ul << 4)#define I915_PARAM_HUC_STATUS 42
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 5/24 tools headers uapi: Sync asm-generic/mman-common.h with the kernel
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
To pick the changes from:
1a4e58cce84e ("mm: introduce MADV_PAGEOUT")
9c276cc65a58 ("mm: introduce MADV_COLD")
That result in these changes in the tools:
$ tools/perf/trace/beauty/madvise_behavior.sh > before $ cp include/uapi/asm-generic/mman-common.h tools/include/uapi/asm-generic/mman-common.h $ git diff diff --git a/tools/include/uapi/asm-generic/mman-common.h b/tools/include/uapi/asm-generic/mman-common.h index 63b1f506ea67..c160a5354eb6 100644 --- a/tools/include/uapi/asm-generic/mman-common.h +++ b/tools/include/uapi/asm-generic/mman-common.h @@ -67,6 +67,9 @@ #define MADV_WIPEONFORK 18 /* Zero memory on fork, child only */ #define MADV_KEEPONFORK 19 /* Undo MADV_WIPEONFORK */
+#define MADV_COLD 20 /* deactivate these pages */ +#define MADV_PAGEOUT 21 /* reclaim these pages */
+
/* compatibility flags */
#define MAP_FILE 0
$ tools/perf/trace/beauty/madvise_behavior.sh > after $ diff -u before after --- before 2019-09-27 11:29:43.346320100 -0300 +++ after 2019-09-27 11:30:03.838570439 -0300 @@ -16,6 +16,8 @@ [17] = "DODUMP", [18] = "WIPEONFORK", [19] = "KEEPONFORK", + [20] = "COLD", + [21] = "PAGEOUT", [100] = "HWPOISON", [101] = "SOFT_OFFLINE", }; $
I.e. now when madvise gets those behaviours as args, it will be able to translate from the number to a human readable string.
This addresses the following perf build warning:
Warning: Kernel ABI header at 'tools/include/uapi/asm-generic/mman-common.h' differs from latest version at 'include/uapi/asm-generic/mman-common.h' diff -u tools/include/uapi/asm-generic/mman-common.h include/uapi/asm-generic/mman-common.h
--- tools/include/uapi/asm-generic/mman-common.h | 3 +++ 1 file changed, 3 insertions(+)
tools/include/uapi/asm-generic/mman-common.h +3 -0
@@ -67,6 +67,9 @@#define MADV_WIPEONFORK 18/* Zero memory on fork, child only */ #define MADV_KEEPONFORK 19/* Undo MADV_WIPEONFORK */ +#define MADV_COLD 20/* deactivate these pages */ +#define MADV_PAGEOUT 21/* reclaim these pages */ +/* compatibility flags */ #define MAP_FILE 0
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 6/24 tools headers uapi: Sync linux/usbdevice_fs.h with the kernel sources
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
To pick up the changes from:
4ed3350539aa ("USB: usbfs: Add a capability flag for runtime suspend") 7794f486ed0b ("usbfs: Add ioctls for runtime power management")
This triggers these changes in the kernel sources, automagically supporting these new ioctls in the 'perf trace' beautifiers.
Soon this will be used in things like filter expressions for tracepoints in 'perf record', 'perf trace', 'perf top', i.e. filter expressions will do a lookup to turn things like USBDEVFS_WAIT_FOR_RESUME into _IO('U',
35) before associating the tracepoint expression to tracepoint perf event.
$ tools/perf/trace/beauty/usbdevfs_ioctl.sh > before
$ cp include/uapi/linux/usbdevice_fs.h tools/include/uapi/linux/usbdevice_fs.h
$ git diff
diff --git a/tools/include/uapi/linux/usbdevice_fs.h b/tools/include/uapi/linux/usbdevice_fs.h
index 78efe870c2b7..cf525cddeb94 100644
--- a/tools/include/uapi/linux/usbdevice_fs.h
+++ b/tools/include/uapi/linux/usbdevice_fs.h
@@ -158,6 +158,7 @@ struct usbdevfs_hub_portinfo {
#define USBDEVFS_CAP_MMAP 0x20
#define USBDEVFS_CAP_DROP_PRIVILEGES 0x40
#define USBDEVFS_CAP_CONNINFO_EX 0x80
+#define USBDEVFS_CAP_SUSPEND 0x100 /* USBDEVFS_DISCONNECT_CLAIM flags & struct */
@@ -223,5 +224,8 @@ struct usbdevfs_streams {
* extending size of the data returned.
*/
#define USBDEVFS_CONNINFO_EX(len) _IOC(_IOC_READ, 'U', 32, len)
+#define USBDEVFS_FORBID_SUSPEND _IO('U', 33)
+#define USBDEVFS_ALLOW_SUSPEND _IO('U', 34)
+#define USBDEVFS_WAIT_FOR_RESUME _IO('U', 35) #endif /* _UAPI_LINUX_USBDEVICE_FS_H */
$ tools/perf/trace/beauty/usbdevfs_ioctl.sh > after $ diff -u before after --- before 2019-09-27 11:41:50.634867620 -0300 +++ after 2019-09-27 11:42:07.453102978 -0300 @@ -24,6 +24,9 @@ [30] = "DROP_PRIVILEGES", [31] = "GET_SPEED", [32] = "CONNINFO_EX", + [33] = "FORBID_SUSPEND", + [34] = "ALLOW_SUSPEND", + [35] = "WAIT_FOR_RESUME", [3] = "RESETEP", [4] = "SETINTERFACE", [5] = "SETCONFIGURATION", $
This addresses the following perf build warning:
Warning: Kernel ABI header at 'tools/include/uapi/linux/usbdevice_fs.h' differs from latest version at 'include/uapi/linux/usbdevice_fs.h' diff -u tools/include/uapi/linux/usbdevice_fs.h include/uapi/linux/usbdevice_fs.h
--- tools/include/uapi/linux/usbdevice_fs.h | 4 ++++ 1 file changed, 4 insertions(+)
tools/include/uapi/linux/usbdevice_fs.h +4 -0
@@ -158,6 +158,7 @@ struct usbdevfs_hub_portinfo {#define USBDEVFS_CAP_MMAP 0x20#define USBDEVFS_CAP_DROP_PRIVILEGES 0x40#define USBDEVFS_CAP_CONNINFO_EX 0x80 +#define USBDEVFS_CAP_SUSPEND 0x100/* USBDEVFS_DISCONNECT_CLAIM flags & struct */
@@ -223,5 +224,8 @@ struct usbdevfs_streams {* extending size of the data returned. */ #define USBDEVFS_CONNINFO_EX (len) _IOC(_IOC_READ, 'U', 32, len) +#define USBDEVFS_FORBID_SUSPEND _IO('U', 33) +#define USBDEVFS_ALLOW_SUSPEND _IO('U', 34) +#define USBDEVFS_WAIT_FOR_RESUME _IO('U', 35)#endif /* _UAPI_LINUX_USBDEVICE_FS_H */
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 7/24 tools headers uapi: Sync linux/fs.h with the kernel sources
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
To pick the changes from:
78a1b96bcf7a ("fscrypt: add FS_IOC_REMOVE_ENCRYPTION_KEY_ALL_USERS ioctl") 23c688b54016 ("fscrypt: allow unprivileged users to add/remove keys for v2 policies") 5dae460c2292 ("fscrypt: v2 encryption policy support")
5a7e29924dac ("fscrypt: add FS_IOC_GET_ENCRYPTION_KEY_STATUS ioctl") b1c0ec3599f4 ("fscrypt: add FS_IOC_REMOVE_ENCRYPTION_KEY ioctl") 22d94f493bfb ("fscrypt: add FS_IOC_ADD_ENCRYPTION_KEY ioctl") 3b6df59bc4d2 ("fscrypt: use FSCRYPT_* definitions, not FS_*") 2336d0deb2d4 ("fscrypt: use FSCRYPT_ prefix for uapi constants") 7af0ab0d3aab ("fs, fscrypt: move uapi definitions to new header <linux/fscrypt.h>")
That don't trigger any changes in tooling, as it so far is used only for:
$ grep -l 'fs\.h' tools/perf/trace/beauty/*.sh | xargs grep regex=
tools/perf/trace/beauty/rename_flags.sh:regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+RENAME_([[:alnum:]_]+)[[:space:]]+\(1[[:space:]]*<<[[:space:]]*([[:xdigit:]]+)[[:space:]]*\)[[:space:]]*.*'
tools/perf/trace/beauty/sync_file_range.sh:regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+SYNC_FILE_RANGE_([[:alnum:]_]+)[[:space:]]+([[:xdigit:]]+)[[:space:]]*.*'
tools/perf/trace/beauty/usbdevfs_ioctl.sh:regex="^#[[:space:]]*define[[:space:]]+USBDEVFS_(\w+)(\(\w+\))?[[:space:]]+_IO[CWR]{0,2}\([[:space:]]*(_IOC_\w+,[[:space:]]*)?'U'[[:space:]]*,[[:space:]]*([[:digit:]]+).*"
tools/perf/trace/beauty/usbdevfs_ioctl.sh:regex="^#[[:space:]]*define[[:space:]]+USBDEVFS_(\w+)[[:space:]]+_IO[WR]{0,2}\([[:space:]]*'U'[[:space:]]*,[[:space:]]*([[:digit:]]+).*"
$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 | 55 +-------- tools/include/uapi/linux/fscrypt.h | 181 +++++++++++++++++++++++++++++ tools/perf/check-headers.sh | 1 + 3 files changed, 186 insertions(+), 51 deletions(-) create mode 100644 tools/include/uapi/linux/fscrypt.h
tools/include/uapi/linux/fs.h +4 -51
@@ -13,6 +13,9 @@#include <linux/limits.h> #include <linux/ioctl.h> #include <linux/types.h> +#ifndef __KERNEL__ +#include <linux/fscrypt.h> +#endif /* Use of MS_* flags within the kernel is restricted to core mount(2) code. */ #if !defined(__KERNEL__)
@@ -212,57 +215,6 @@ struct fsxattr {#define FS_IOC_GETFSLABEL _IOR(0x94, 49, char[FSLABEL_MAX])#define FS_IOC_SETFSLABEL _IOW(0x94, 50, char[FSLABEL_MAX]) -/* -* File system encryption support -*/ -/* Policy provided via an ioctl on the topmost directory */ -#define FS_KEY_DESCRIPTOR_SIZE 8 - -#define FS_POLICY_FLAGS_PAD_4 0x00 -#define FS_POLICY_FLAGS_PAD_8 0x01 -#define FS_POLICY_FLAGS_PAD_16 0x02 -#define FS_POLICY_FLAGS_PAD_32 0x03 -#define FS_POLICY_FLAGS_PAD_MASK 0x03 -#define FS_POLICY_FLAG_DIRECT_KEY 0x04/* use master key directly */ -#define FS_POLICY_FLAGS_VALID 0x07 - -/* Encryption algorithms */ -#define FS_ENCRYPTION_MODE_INVALID 0 -#define FS_ENCRYPTION_MODE_AES_256_XTS 1 -#define FS_ENCRYPTION_MODE_AES_256_GCM 2 -#define FS_ENCRYPTION_MODE_AES_256_CBC 3 -#define FS_ENCRYPTION_MODE_AES_256_CTS 4 -#define FS_ENCRYPTION_MODE_AES_128_CBC 5 -#define FS_ENCRYPTION_MODE_AES_128_CTS 6 -#define FS_ENCRYPTION_MODE_SPECK128_256_XTS 7/* Removed, do not use. */ -#define FS_ENCRYPTION_MODE_SPECK128_256_CTS 8/* Removed, do not use. */ -#define FS_ENCRYPTION_MODE_ADIANTUM 9 - -struct fscrypt_policy { -__u8 version; -__u8 contents_encryption_mode; -__u8 filenames_encryption_mode; -__u8 flags; -__u8 master_key_descriptor[FS_KEY_DESCRIPTOR_SIZE ]; -}; - -#define FS_IOC_SET_ENCRYPTION_POLICY _IOR('f', 19, struct fscrypt_policy) -#define FS_IOC_GET_ENCRYPTION_PWSALT _IOW('f', 20, __u8[16]) -#define FS_IOC_GET_ENCRYPTION_POLICY _IOW('f', 21, struct fscrypt_policy) - -/* Parameters for passing an encryption key into the kernel keyring */ -#define FS_KEY_DESC_PREFIX "fscrypt:" -#define FS_KEY_DESC_PREFIX_SIZE 8 - -/* Structure that userspace passes to the kernel keyring */ -#define FS_MAX_KEY_SIZE 64 - -struct fscrypt_key { -__u32 mode; -__u8 raw[FS_MAX_KEY_SIZE ]; -__u32 size; -}; -/* * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS) *
@@ -306,6 +258,7 @@ struct fscrypt_key {#define FS_TOPDIR_FL 0x00020000/* Top of directory hierarchies*/ #define FS_HUGE_FILE_FL 0x00040000/* Reserved for ext4 */ #define FS_EXTENT_FL 0x00080000/* Extents */ +#define FS_VERITY_FL 0x00100000/* Verity protected inode */ #define FS_EA_INODE_FL 0x00200000/* Inode used for large EA */ #define FS_EOFBLOCKS_FL 0x00400000/* Reserved for ext4 */ #define FS_NOCOW_FL 0x00800000/* Do not cow file */
tools/include/uapi/linux/fscrypt.h new file +181 -0
181 lines not on this page · raw message
tools/perf/check-headers.sh +1 -0
@@ -8,6 +8,7 @@ include/uapi/drm/i915_drm.h include/uapi/linux/fadvise.h include/uapi/linux/fcntl.h include/uapi/linux/fs.h +include/uapi/linux/fscrypt.h include/uapi/linux/kcmp.h include/uapi/linux/kvm.h include/uapi/linux/in.h
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 8/24 tools headers kvm: Sync kvm headers with the kernel sources
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
To pick the changes in:
200824f55eef ("KVM: s390: Disallow invalid bits in kvm_valid_regs and kvm_dirty_regs") 4a53d99dd0c2 ("KVM: VMX: Introduce exit reason for receiving INIT signal on guest-mode") 7396d337cfad ("KVM: x86: Return to userspace with internal error on unexpected exit reason") 92f35b751c71 ("KVM: arm/arm64: vgic: Allow more than 256 vcpus for KVM_IRQ_LINE")
None of them trigger any changes in tooling, this time this is just to silence these perf build 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/x86/include/uapi/asm/vmx.h' differs from latest version at 'arch/x86/include/uapi/asm/vmx.h' diff -u tools/arch/x86/include/uapi/asm/vmx.h arch/x86/include/uapi/asm/vmx.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/arm/include/uapi/asm/kvm.h' differs from latest version at 'arch/arm/include/uapi/asm/kvm.h' diff -u tools/arch/arm/include/uapi/asm/kvm.h arch/arm/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/arm/include/uapi/asm/kvm.h | 4 +++- tools/arch/arm64/include/uapi/asm/kvm.h | 4 +++- tools/arch/s390/include/uapi/asm/kvm.h | 6 ++++++ tools/arch/x86/include/uapi/asm/vmx.h | 2 ++ tools/include/uapi/linux/kvm.h | 3 +++ 5 files changed, 17 insertions(+), 2 deletions(-)
tools/arch/arm/include/uapi/asm/kvm.h +3 -1
@@ -266,8 +266,10 @@ struct kvm_vcpu_events {#define KVM_DEV_ARM_ITS_CTRL_RESET 4/* KVM_IRQ_LINE irq field index values */ +#define KVM_ARM_IRQ_VCPU2_SHIFT 28 +#define KVM_ARM_IRQ_VCPU2_MASK 0xf#define KVM_ARM_IRQ_TYPE_SHIFT 24 -#define KVM_ARM_IRQ_TYPE_MASK 0xff +#define KVM_ARM_IRQ_TYPE_MASK 0xf#define KVM_ARM_IRQ_VCPU_SHIFT 16#define KVM_ARM_IRQ_VCPU_MASK 0xff#define KVM_ARM_IRQ_NUM_SHIFT 0
tools/arch/arm64/include/uapi/asm/kvm.h +3 -1
@@ -325,8 +325,10 @@ struct kvm_vcpu_events {#define KVM_ARM_VCPU_TIMER_IRQ_PTIMER 1/* KVM_IRQ_LINE irq field index values */ +#define KVM_ARM_IRQ_VCPU2_SHIFT 28 +#define KVM_ARM_IRQ_VCPU2_MASK 0xf#define KVM_ARM_IRQ_TYPE_SHIFT 24 -#define KVM_ARM_IRQ_TYPE_MASK 0xff +#define KVM_ARM_IRQ_TYPE_MASK 0xf#define KVM_ARM_IRQ_VCPU_SHIFT 16#define KVM_ARM_IRQ_VCPU_MASK 0xff#define KVM_ARM_IRQ_NUM_SHIFT 0
tools/arch/s390/include/uapi/asm/kvm.h +6 -0
@@ -231,6 +231,12 @@ struct kvm_guest_debug_arch {#define KVM_SYNC_GSCB (1UL << 9)#define KVM_SYNC_BPBC (1UL << 10)#define KVM_SYNC_ETOKEN (1UL << 11) + +#define KVM_SYNC_S390_VALID_FIELDS \ + (KVM_SYNC_PREFIX | KVM_SYNC_GPRS | KVM_SYNC_ACRS | KVM_SYNC_CRS | \ + KVM_SYNC_ARCH0 | KVM_SYNC_PFAULT | KVM_SYNC_VRS | KVM_SYNC_RICCB | \ + KVM_SYNC_FPRS | KVM_SYNC_GSCB | KVM_SYNC_BPBC | KVM_SYNC_ETOKEN) +/* length and alignment of the sdnx as a power of two */ #define SDNXC 8#define SDNXL (1UL << SDNXC)
tools/arch/x86/include/uapi/asm/vmx.h +2 -0
@@ -31,6 +31,7 @@#define EXIT_REASON_EXCEPTION_NMI 0#define EXIT_REASON_EXTERNAL_INTERRUPT 1#define EXIT_REASON_TRIPLE_FAULT 2 +#define EXIT_REASON_INIT_SIGNAL 3#define EXIT_REASON_PENDING_INTERRUPT 7#define EXIT_REASON_NMI_WINDOW 8
@@ -90,6 +91,7 @@ { EXIT_REASON_EXCEPTION_NMI, "EXCEPTION_NMI" }, \ { EXIT_REASON_EXTERNAL_INTERRUPT, "EXTERNAL_INTERRUPT" }, \ { EXIT_REASON_TRIPLE_FAULT, "TRIPLE_FAULT" }, \ + { EXIT_REASON_INIT_SIGNAL, "INIT_SIGNAL" }, \ { EXIT_REASON_PENDING_INTERRUPT, "PENDING_INTERRUPT" }, \ { EXIT_REASON_NMI_WINDOW, "NMI_WINDOW" }, \ { EXIT_REASON_TASK_SWITCH, "TASK_SWITCH" }, \
tools/include/uapi/linux/kvm.h +3 -0
@@ -243,6 +243,8 @@ struct kvm_hyperv_exit {#define KVM_INTERNAL_ERROR_SIMUL_EX 2/* Encounter unexpected vm-exit due to delivery event. */ #define KVM_INTERNAL_ERROR_DELIVERY_EV 3 +/* Encounter unexpected vm-exit reason */ +#define KVM_INTERNAL_ERROR_UNEXPECTED_EXIT_REASON 4/* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */ struct kvm_run {
@@ -996,6 +998,7 @@ struct kvm_ppc_resize_hpt {#define KVM_CAP_ARM_PTRAUTH_ADDRESS 171#define KVM_CAP_ARM_PTRAUTH_GENERIC 172#define KVM_CAP_PMU_EVENT_FILTER 173 +#define KVM_CAP_ARM_IRQ_LINE_LAYOUT_2 174#ifdef KVM_CAP_IRQ_ROUTING
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 9/24 perf llvm: Don't access out-of-scope array
In reply to Arnaldo Carvalho de MeloFrom: Ian Rogers <[email protected]>
The 'test_dir' variable is assigned to the 'release' array which is out-of-scope 3 lines later.
Extend the scope of the 'release' array so that an out-of-scope array isn't accessed.
Bug detected by clang's address sanitizer.
--- tools/perf/util/llvm-utils.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/perf/util/llvm-utils.c +3 -3
@@ -233,14 +233,14 @@ static int detect_kbuild_dir(char **kbuild_dir)const char *prefix_dir ="" ;const char *suffix_dir ="" ; +/* _UTSNAME_LENGTH is 65 */ +char release[128 ]; +char *autoconf_path;int err;if (!test_dir) { -/* _UTSNAME_LENGTH is 65 */ -char release[128 ]; - err =fetch_kernel_version (NULL , release,sizeof (release));if (err)
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 10/24 perf vendor events s390: Add JSON transaction for machine type 8561
In reply to Arnaldo Carvalho de MeloFrom: Thomas Richter <[email protected]>
Add s390 transaction counter definition for machine 8561. This is the same file as for the predecessor machine.
--- tools/perf/pmu-events/arch/s390/cf_m8561/transaction.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 tools/perf/pmu-events/arch/s390/cf_m8561/transaction.json
tools/perf/pmu-events/arch/s390/cf_m8561/transaction.json new file +7 -0
@@ -0,0 +1,7 @@ +[ + { + "BriefDescription": "Transaction count", + "MetricName": "transaction", + "MetricExpr": "TX_C_TEND + TX_NC_TEND + TX_NC_TABORT + TX_C_TABORT_SPECIAL + TX_C_TABORT_NO_SPECIAL" + } +]
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 11/24 perf vendor events s390: Use s390 machine name instead of type 8561
In reply to Arnaldo Carvalho de MeloFrom: Thomas Richter <[email protected]>
In the pmu-events directory for JSON file definitions use the official machine name IBM z15 instead of machine type number 8561. This is consistent with previous machines.
---
tools/perf/pmu-events/arch/s390/{cf_m8561 => cf_z15}/basic.json | 0
.../perf/pmu-events/arch/s390/{cf_m8561 => cf_z15}/crypto.json | 0
.../perf/pmu-events/arch/s390/{cf_m8561 => cf_z15}/crypto6.json | 0
.../pmu-events/arch/s390/{cf_m8561 => cf_z15}/extended.json | 0
.../pmu-events/arch/s390/{cf_m8561 => cf_z15}/transaction.json | 0
tools/perf/pmu-events/arch/s390/mapfile.csv | 2 +-
6 files changed, 1 insertion(+), 1 deletion(-)
rename tools/perf/pmu-events/arch/s390/{cf_m8561 => cf_z15}/basic.json (100%)
rename tools/perf/pmu-events/arch/s390/{cf_m8561 => cf_z15}/crypto.json (100%)
rename tools/perf/pmu-events/arch/s390/{cf_m8561 => cf_z15}/crypto6.json (100%)
rename tools/perf/pmu-events/arch/s390/{cf_m8561 => cf_z15}/extended.json (100%)
rename tools/perf/pmu-events/arch/s390/{cf_m8561 => cf_z15}/transaction.json (100%)tools/perf/pmu-events/arch/s390/cf_z15/basic.json renamed from tools/perf/pmu-events/arch/s390/cf_m8561/basic.json +0 -0
tools/perf/pmu-events/arch/s390/cf_z15/crypto.json renamed from tools/perf/pmu-events/arch/s390/cf_m8561/crypto.json +0 -0
tools/perf/pmu-events/arch/s390/cf_z15/crypto6.json renamed from tools/perf/pmu-events/arch/s390/cf_m8561/crypto6.json +0 -0
tools/perf/pmu-events/arch/s390/cf_z15/extended.json renamed from tools/perf/pmu-events/arch/s390/cf_m8561/extended.json +0 -0
tools/perf/pmu-events/arch/s390/cf_z15/transaction.json renamed from tools/perf/pmu-events/arch/s390/cf_m8561/transaction.json +0 -0
tools/perf/pmu-events/arch/s390/mapfile.csv +1 -1
@@ -4,4 +4,4 @@ Family-model,Version,Filename,EventType ^IBM.282[78].*[13]\.[1-5].[[:xdigit:]]+$,1,cf_zec12,core ^IBM.296[45].*[13]\.[1-5].[[:xdigit:]]+$,1,cf_z13,core ^IBM.390[67].*[13]\.[1-5].[[:xdigit:]]+$,3,cf_z14,core -^IBM.856[12].*3\.6.[[:xdigit:]]+$,3,cf_m8561,core +^IBM.856[12].*3\.6.[[:xdigit:]]+$,3,cf_z15,core
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 12/24 perf map: Fix overlapped map handling
In reply to Arnaldo Carvalho de MeloFrom: Steve MacLean <[email protected]>
Whenever an mmap/mmap2 event occurs, the map tree must be updated to add a new entry. If a new map overlaps a previous map, the overlapped section of the previous map is effectively unmapped, but the non-overlapping sections are still valid.
maps__fixup_overlappings() is responsible for creating any new map entries from the previously overlapped map. It optionally creates a before and an after map.
When creating the after map the existing code failed to adjust the map.pgoff. This meant the new after map would incorrectly calculate the file offset for the ip. This results in incorrect symbol name resolution for any ip in the after region.
Make maps__fixup_overlappings() correctly populate map.pgoff.
Add an assert that new mapping matches old mapping at the beginning of the after map.
Committer-testing:
Validated correct parsing of libcoreclr.so symbols from .NET Core 3.0 preview9 (which didn't strip symbols).
Preparation:
~/dotnet3.0-preview9/dotnet new webapi -o perfSymbol
cd perfSymbol
~/dotnet3.0-preview9/dotnet publish
perf record ~/dotnet3.0-preview9/dotnet \
bin/Debug/netcoreapp3.0/publish/perfSymbol.dll
^CBefore:
perf script --show-mmap-events 2>&1 | grep -e MMAP -e unknown |\
grep libcoreclr.so | head -n 4
dotnet 1907 373352.698780: PERF_RECORD_MMAP2 1907/1907: \
[0x7fe615726000(0x768000) @ 0 08:02 5510620 765057155]: \
r-xp .../3.0.0-preview9-19423-09/libcoreclr.so
dotnet 1907 373352.701091: PERF_RECORD_MMAP2 1907/1907: \
[0x7fe615974000(0x1000) @ 0x24e000 08:02 5510620 765057155]: \
rwxp .../3.0.0-preview9-19423-09/libcoreclr.so
dotnet 1907 373352.701241: PERF_RECORD_MMAP2 1907/1907: \
[0x7fe615c42000(0x1000) @ 0x51c000 08:02 5510620 765057155]: \
rwxp .../3.0.0-preview9-19423-09/libcoreclr.so
dotnet 1907 373352.705249: 250000 cpu-clock: \
7fe6159a1f99 [unknown] \
(.../3.0.0-preview9-19423-09/libcoreclr.so)After:
perf script --show-mmap-events 2>&1 | grep -e MMAP -e unknown |\
grep libcoreclr.so | head -n 4
dotnet 1907 373352.698780: PERF_RECORD_MMAP2 1907/1907: \
[0x7fe615726000(0x768000) @ 0 08:02 5510620 765057155]: \
r-xp .../3.0.0-preview9-19423-09/libcoreclr.so
dotnet 1907 373352.701091: PERF_RECORD_MMAP2 1907/1907: \
[0x7fe615974000(0x1000) @ 0x24e000 08:02 5510620 765057155]: \
rwxp .../3.0.0-preview9-19423-09/libcoreclr.so
dotnet 1907 373352.701241: PERF_RECORD_MMAP2 1907/1907: \
[0x7fe615c42000(0x1000) @ 0x51c000 08:02 5510620 765057155]: \
rwxp .../3.0.0-preview9-19423-09/libcoreclr.soAll the [unknown] symbols were resolved.
--- tools/perf/util/map.c | 3 +++ 1 file changed, 3 insertions(+)
tools/perf/util/map.c +3 -0
@@ -1,5 +1,6 @@// SPDX-License-Identifier: GPL-2.0 #include "symbol.h" +#include <assert.h> #include <errno.h> #include <inttypes.h> #include <limits.h>
@@ -850,6 +851,8 @@ static int maps__fixup_overlappings(struct maps *maps, struct map *map, FILE *fp } after->start = map->end; + after->pgoff += map->end - pos->start; +assert (pos->map_ip (pos, map->end) == after->map_ip (after, map->end));__map_groups__insert (pos->groups, after);if (verbose >=2 && !use_browser)map__fprintf (after, fp);
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 13/24 perf inject jit: Fix JIT_CODE_MOVE filename
In reply to Arnaldo Carvalho de MeloFrom: Steve MacLean <[email protected]>
During perf inject --jit, JIT_CODE_MOVE records were injecting MMAP records with an incorrect filename. Specifically it was missing the ".so" suffix.
Further the JIT_CODE_LOAD record were silently truncating the jr->load.code_index field to 32 bits before generating the filename.
Make both records emit the same filename based on the full 64 bit code_index field.
--- tools/perf/util/jitdump.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/perf/util/jitdump.c +3 -3
@@ -395,7 +395,7 @@ static int jit_repipe_code_load(struct jit_buf_desc *jd, union jr_entry *jr)size_t size;u16 idr_size;const char *sym; -uint32_t count; +uint64_t count;int ret, csize, usize;pid_t pid, tid;struct {
@@ -418,7 +418,7 @@ static int jit_repipe_code_load(struct jit_buf_desc *jd, union jr_entry *jr)return -1 ; filename = event->mmap2.filename; - size =snprintf (filename,PATH_MAX ,"%s/jitted-%d-%u.so" , + size =snprintf (filename,PATH_MAX ,"%s/jitted-%d-%" PRIu64".so" , jd->dir, pid, count);
@@ -529,7 +529,7 @@ static int jit_repipe_code_move(struct jit_buf_desc *jd, union jr_entry *jr)return -1 ; filename = event->mmap2.filename; - size =snprintf (filename,PATH_MAX ,"%s/jitted-%d-%" PRIu64, + size =snprintf (filename,PATH_MAX ,"%s/jitted-%d-%" PRIu64".so" , jd->dir, pid, jr->move.code_index);
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 14/24 perf docs: Correct and clarify jitdump spec
In reply to Arnaldo Carvalho de MeloFrom: Steve MacLean <[email protected]>
Specification claims latest version of jitdump file format is 2. Current jit dump reading code treats 1 as the latest version.
Correct spec to match code.
The original language made it unclear the value to be written in the magic field.
Revise language that the writer always writes the same value. Specify that the reader uses the value to detect endian mismatches.
--- tools/perf/Documentation/jitdump-specification.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/Documentation/jitdump-specification.txt +2 -2
@@ -36,8 +36,8 @@ III/ Jitdump file header format Each jitdump file starts with a fixed size header containing the following fields in order: -* uint32_t magic : a magic number tagging the file type. The value is 4-byte long and represents the string "JiTD" in ASCII form. It is 0x4A695444 or 0x4454694a depending on the endianness. The field can be used to detect the endianness of the file -* uint32_t version : a 4-byte value representing the format version. It is currently set to 2 +* uint32_t magic : a magic number tagging the file type. The value is 4-byte long and represents the string "JiTD" in ASCII form. It written is as 0x4A695444. The reader will detect an endian mismatch when it reads 0x4454694a. +* uint32_t version : a 4-byte value representing the format version. It is currently set to 1 * uint32_t total_size: size in bytes of file header * uint32_t elf_mach : ELF architecture encoding (ELF e_machine value as specified in /usr/include/elf.h) * uint32_t pad1 : padding. Reserved for future use
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 15/24 perf script brstackinsn: Fix recovery from LBR/binary mismatch
In reply to Arnaldo Carvalho de MeloFrom: Andi Kleen <[email protected]>
When the LBR data and the instructions in a binary do not match the loop printing instructions could get confused and print a long stream of bogus <bad> instructions.
The problem was that if the instruction decoder cannot decode an instruction it ilen wasn't initialized, so the loop going through the basic block would continue with the previous value.
Harden the code to avoid such problems:
- Make sure ilen is always freshly initialized and is 0 for bad instructions.
- Do not overrun the code buffer while printing instructions
- Print a warning message if the final jump is not on an instruction boundary.
--- tools/perf/builtin-script.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
tools/perf/builtin-script.c +5 -1
@@ -1063,7 +1063,7 @@ static int perf_sample__fprintf_brstackinsn(struct perf_sample *sample,continue ; insn =0 ; -for (off =0 ;; off += ilen) { +for (off =0 ; off < (unsigned )len; off += ilen) {uint64_t ip = start + off; printed +=ip__fprintf_sym (ip, thread, x.cpumode, x.cpu, &lastsym, attr, fp);
@@ -1074,6 +1074,7 @@ static int perf_sample__fprintf_brstackinsn(struct perf_sample *sample, printed +=print_srccode (thread, x.cpumode, ip);break ; }else { + ilen =0 ; printed +=fprintf (fp,"\t%016" PRIx64"\t%s\n" , ip,dump_insn (&x, ip, buffer + off, len - off, &ilen));if (ilen ==0 )
@@ -1083,6 +1084,8 @@ static int perf_sample__fprintf_brstackinsn(struct perf_sample *sample, insn++; } } +if (off != (unsigned )len) + printed +=fprintf (fp,"\tmismatch of LBR data and executable\n" ); }/*
@@ -1123,6 +1126,7 @@ static int perf_sample__fprintf_brstackinsn(struct perf_sample *sample, goto out; }for (off =0 ; off <= end - start; off += ilen) { + ilen =0 ; printed +=fprintf (fp,"\t%016" PRIx64"\t%s\n" , start + off,dump_insn (&x, start + off, buffer + off, len - off, &ilen));if (ilen ==0 )
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 16/24 perf jevents: Fix period for Intel fixed counters
In reply to Arnaldo Carvalho de MeloFrom: Andi Kleen <[email protected]>
The Intel fixed counters use a special table to override the JSON information.
During this override the period information from the JSON file got dropped, which results in inst_retired.any and similar running with frequency mode instead of a period.
Just specify the expected period in the table.
--- tools/perf/pmu-events/jevents.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
tools/perf/pmu-events/jevents.c +6 -6
@@ -450,12 +450,12 @@ static struct fixed {const char *name;const char *event; } fixed[] = { - { "inst_retired.any", "event=0xc0" }, - { "inst_retired.any_p", "event=0xc0" }, - { "cpu_clk_unhalted.ref", "event=0x0,umask=0x03" }, - { "cpu_clk_unhalted.thread", "event=0x3c" }, - { "cpu_clk_unhalted.core", "event=0x3c" }, - { "cpu_clk_unhalted.thread_any", "event=0x3c,any=1" }, + { "inst_retired.any", "event=0xc0,period=2000003" }, + { "inst_retired.any_p", "event=0xc0,period=2000003" }, + { "cpu_clk_unhalted.ref", "event=0x0,umask=0x03,period=2000003" }, + { "cpu_clk_unhalted.thread", "event=0x3c,period=2000003" }, + { "cpu_clk_unhalted.core", "event=0x3c,period=2000003" }, + { "cpu_clk_unhalted.thread_any", "event=0x3c,any=1,period=2000003" }, { NULL, NULL}, };
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 17/24 perf tools: Propagate get_cpuid() error
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
For consistency, propagate the exact cause for get_cpuid() to have failed.
--- tools/perf/arch/powerpc/util/header.c | 3 ++- tools/perf/arch/s390/util/header.c | 9 +++++---- tools/perf/arch/x86/util/header.c | 3 ++- tools/perf/builtin-kvm.c | 7 ++++--- 4 files changed, 13 insertions(+), 9 deletions(-)
tools/perf/arch/powerpc/util/header.c +2 -1
@@ -1,5 +1,6 @@// SPDX-License-Identifier: GPL-2.0 #include <sys/types.h> +#include <errno.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h>
@@ -30,7 +31,7 @@ get_cpuid(char *buffer, size_t sz) buffer[nb-1 ] ='\0' ;return 0 ; } -return -1 ; +return ENOBUFS ; } char *
tools/perf/arch/s390/util/header.c +5 -4
@@ -8,6 +8,7 @@*/ #include <sys/types.h> +#include <errno.h> #include <unistd.h> #include <stdio.h> #include <string.h>
@@ -54,7 +55,7 @@ int get_cpuid(char *buffer, size_t sz) sysinfo =fopen (SYSINFO ,"r" );if (sysinfo ==NULL ) -return -1 ; +return errno;while ((read =getline (&line, &line_sz, sysinfo)) !=-1 ) {if (!strncmp (line,SYSINFO_MANU ,strlen (SYSINFO_MANU ))) {
@@ -89,7 +90,7 @@ int get_cpuid(char *buffer, size_t sz)/* Missing manufacturer, type or model information should not happen */ if (!manufacturer[0 ] || !type[0 ] || !model[0 ]) -return -1 ; +return EINVAL ;/* * Scan /proc/service_levels and return the CPU-MF counter facility
@@ -133,14 +134,14 @@ int get_cpuid(char *buffer, size_t sz)else nbytes =snprintf (buffer, sz,"%s,%s,%s" , manufacturer, type, model); -return (nbytes >= sz) ?-1 :0 ; +return (nbytes >= sz) ?ENOBUFS :0 ; }char *get_cpuid_str (struct perf_pmu *pmu__maybe_unused ) {char *buf =malloc (128 ); -if (buf &&get_cpuid (buf,128 ) <0 ) +if (buf &&get_cpuid (buf,128 ))zfree (&buf);return buf; }
tools/perf/arch/x86/util/header.c +2 -1
@@ -1,5 +1,6 @@// SPDX-License-Identifier: GPL-2.0 #include <sys/types.h> +#include <errno.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h>
@@ -58,7 +59,7 @@ __get_cpuid(char *buffer, size_t sz, const char *fmt) buffer[nb-1 ] ='\0' ;return 0 ; } -return -1 ; +return ENOBUFS ; }int
tools/perf/builtin-kvm.c +4 -3
@@ -705,14 +705,15 @@ static int process_sample_event(struct perf_tool *tool,static int cpu_isa_config (struct perf_kvm_stat *kvm) { -char buf[64 ], *cpuid; +char buf[128 ], *cpuid;int err;if (kvm->live) { err =get_cpuid (buf,sizeof (buf));if (err !=0 ) { -pr_err ("Failed to look up CPU type\n" ); -return err; +pr_err ("Failed to look up CPU type: %s\n" , +str_error_r (err, buf,sizeof (buf))); +return -err; } cpuid = buf; }else
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 18/24 perf evsel: Fall back to global 'perf_env' in perf_evsel__env()
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
I.e. if evsel->evlist or evsel->evlist->env isn't set, return the environment for the running machine, as that would be set if reading from a perf.data file.
--- tools/perf/util/evsel.c | 3 ++- tools/perf/util/python.c | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-)
tools/perf/util/evsel.c +2 -1
@@ -30,6 +30,7 @@#include "counts.h" #include "event.h" #include "evsel.h" +#include "util/env.h" #include "util/evsel_config.h" #include "util/evsel_fprintf.h" #include "evlist.h"
@@ -2512,7 +2513,7 @@ struct perf_env *perf_evsel__env(struct evsel *evsel) {if (evsel && evsel->evlist)return evsel->evlist->env; -return NULL ; +return &perf_env; }static int store_evsel_ids (struct evsel *evsel,struct evlist *evlist)
tools/perf/util/python.c +6 -0
@@ -14,6 +14,7 @@#include "thread_map.h" #include "trace-event.h" #include "mmap.h" +#include "util/env.h" #include <internal/lib.h> #include "../perf-sys.h"
@@ -53,6 +54,11 @@ int parse_callchain_record(const char *arg __maybe_unused,return 0 ; } +/* +* Add this one here not to drag util/env.c +*/ +struct perf_env perf_env; +/* * Support debug printing even though util/debug.c is not linked. That means * implementing 'verbose' and 'eprintf'.
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 19/24 perf annotate: Propagate perf_env__arch() error
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
The callers of symbol__annotate2() use symbol__strerror_disassemble() to convert its failure returns into a human readable string, so propagate error values from functions it calls, starting with perf_env__arch() that when fails the right thing to do is to look at 'errno' to see why its possible call to uname() failed.
--- tools/perf/util/annotate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/annotate.c +1 -1
@@ -2071,7 +2071,7 @@ int symbol__annotate(struct symbol *sym, struct map *map,int err;if (!arch_name) -return -1 ; +return errno; args.arch = arch =arch__find (arch_name);if (arch ==NULL )
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 20/24 perf annotate: Fix the signedness of failure returns
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Callers of symbol__annotate() expect a errno value or some other extended error value range in symbol__strerror_disassemble() to convert to a proper error string, fix it when propagating a failure to find the arch specific annotation routines via arch__find(arch_name).
--- tools/perf/util/annotate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/annotate.c +1 -1
@@ -2075,7 +2075,7 @@ int symbol__annotate(struct symbol *sym, struct map *map, args.arch = arch =arch__find (arch_name);if (arch ==NULL ) -return -ENOTSUP ; +return ENOTSUP ;if (parch) *parch = arch;
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 21/24 perf annotate: Propagate the symbol__annotate() error return
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
We were just returning -1 in symbol__annotate() when symbol__annotate() failed, propagate its error as it is used later to pass to symbol__strerror_disassemble() to present a error message to the user, that in some cases were getting:
"Invalid -1 error code"
Fix it to propagate the error.
--- tools/perf/util/annotate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/annotate.c +1 -1
@@ -2997,7 +2997,7 @@ int symbol__annotate2(struct symbol *sym, struct map *map, struct evsel *evsel, out_free_offsets:zfree (¬es->offsets); -return -1 ; +return err; }#define ANNOTATION__CFG (n) \
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 22/24 perf annotate: Fix arch specific ->init() failure errors
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
They are called from symbol__annotate() and to propagate errors that can help understand the problem make them return what symbol__strerror_disassemble() known, i.e. errno codes and other annotation specific errors in a special, out of errnos, range.
--- tools/perf/arch/arm/annotate/instructions.c | 4 ++-- tools/perf/arch/arm64/annotate/instructions.c | 4 ++-- tools/perf/arch/s390/annotate/instructions.c | 6 ++++-- tools/perf/arch/x86/annotate/instructions.c | 6 ++++-- tools/perf/util/annotate.c | 6 ++++++ tools/perf/util/annotate.h | 2 ++ 6 files changed, 20 insertions(+), 8 deletions(-)
tools/perf/arch/arm/annotate/instructions.c +2 -2
@@ -37,7 +37,7 @@ static int arm__annotate_init(struct arch *arch, char *cpuid __maybe_unused) arm =zalloc (sizeof (*arm));if (!arm) -return -1 ; +return ENOMEM ;#define ARM_CONDS "(cc|cs|eq|ge|gt|hi|le|ls|lt|mi|ne|pl|vc|vs)" err =regcomp (&arm->call_insn,"^blx?" ARM_CONDS "?$" ,REG_EXTENDED );
@@ -59,5 +59,5 @@ static int arm__annotate_init(struct arch *arch, char *cpuid __maybe_unused)regfree (&arm->call_insn); out_free_arm:free (arm); -return -1 ; +return SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_REGEXP ; }
tools/perf/arch/arm64/annotate/instructions.c +2 -2
@@ -95,7 +95,7 @@ static int arm64__annotate_init(struct arch *arch, char *cpuid __maybe_unused) arm =zalloc (sizeof (*arm));if (!arm) -return -1 ; +return ENOMEM ;/* bl, blr */ err =regcomp (&arm->call_insn,"^blr?$" ,REG_EXTENDED );
@@ -118,5 +118,5 @@ static int arm64__annotate_init(struct arch *arch, char *cpuid __maybe_unused)regfree (&arm->call_insn); out_free_arm:free (arm); -return -1 ; +return SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_REGEXP ; }
tools/perf/arch/s390/annotate/instructions.c +4 -2
@@ -164,8 +164,10 @@ static int s390__annotate_init(struct arch *arch, char *cpuid __maybe_unused)if (!arch->initialized) { arch->initialized = true; arch->associate_instruction_ops = s390__associate_ins_ops; -if (cpuid) - err =s390__cpuid_parse (arch, cpuid); +if (cpuid) { +if (s390__cpuid_parse (arch, cpuid)) + err =SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_CPUID_PARSING ; + } }return err;
tools/perf/arch/x86/annotate/instructions.c +4 -2
@@ -196,8 +196,10 @@ static int x86__annotate_init(struct arch *arch, char *cpuid)if (arch->initialized)return 0 ; -if (cpuid) - err =x86__cpuid_parse (arch, cpuid); +if (cpuid) { +if (x86__cpuid_parse (arch, cpuid)) + err =SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_CPUID_PARSING ; + } arch->initialized = true;return err;
tools/perf/util/annotate.c +6 -0
@@ -1631,6 +1631,12 @@ int symbol__strerror_disassemble(struct symbol *sym __maybe_unused, struct map *case SYMBOL_ANNOTATE_ERRNO__NO_LIBOPCODES_FOR_BPF :scnprintf (buf, buflen,"Please link with binutils's libopcode to enable BPF annotation" );break ; +case SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_REGEXP : +scnprintf (buf, buflen,"Problems with arch specific instruction name regular expressions." ); +break ; +case SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_CPUID_PARSING : +scnprintf (buf, buflen,"Problems while parsing the CPUID in the arch specific initialization." ); +break ;default :scnprintf (buf, buflen,"Internal error: Invalid %d error code\n" , errnum);break ;
tools/perf/util/annotate.h +2 -0
@@ -370,6 +370,8 @@ enum symbol_disassemble_errno {SYMBOL_ANNOTATE_ERRNO__NO_VMLINUX = __SYMBOL_ANNOTATE_ERRNO__START,SYMBOL_ANNOTATE_ERRNO__NO_LIBOPCODES_FOR_BPF , +SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_CPUID_PARSING , +SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_REGEXP , __SYMBOL_ANNOTATE_ERRNO__END, };
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 23/24 perf annotate: Return appropriate error code for allocation failures
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
We should return errno or the annotation extra range understood by symbol__strerror_disassemble() instead of -1, fix it, returning ENOMEM instead.
--- tools/perf/util/annotate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/annotate.c +2 -2
@@ -1668,7 +1668,7 @@ static int dso__disassemble_filename(struct dso *dso, char *filename, size_t fil build_id_path =strdup (filename);if (!build_id_path) -return -1 ; +return ENOMEM ;/* * old style build-id cache has name of XX/XXXXXXX.. while
@@ -2977,7 +2977,7 @@ int symbol__annotate2(struct symbol *sym, struct map *map, struct evsel *evsel, notes->offsets =zalloc (size *sizeof (struct annotation_line *));if (notes->offsets ==NULL ) -return -1 ; +return ENOMEM ;if (perf_evsel__is_group_event (evsel)) nr_pcnt = evsel->core.nr_members;
Signature · 1 line
2.21.0
Arnaldo Carvalho de Melo
maintainerPATCH 24/24 perf annotate: Don't return -1 for error when doing BPF disassembly
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Return errno when open_memstream() fails and add two new speciall error codes for when an invalid, non BPF file or one without BTF is passed to symbol__disassemble_bpf(), so that its callers can rely on symbol__strerror_disassemble() to convert that to a human readable error message that can help figure out what is wrong, with hints even.
--- tools/perf/util/annotate.c | 19 +++++++++++++++---- tools/perf/util/annotate.h | 2 ++ 2 files changed, 17 insertions(+), 4 deletions(-)
tools/perf/util/annotate.c +15 -4
@@ -1637,6 +1637,13 @@ int symbol__strerror_disassemble(struct symbol *sym __maybe_unused, struct map *case SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_CPUID_PARSING :scnprintf (buf, buflen,"Problems while parsing the CPUID in the arch specific initialization." );break ; +case SYMBOL_ANNOTATE_ERRNO__BPF_INVALID_FILE : +scnprintf (buf, buflen,"Invalid BPF file: %s." , dso->long_name); +break ; +case SYMBOL_ANNOTATE_ERRNO__BPF_MISSING_BTF : +scnprintf (buf, buflen,"The %s BPF file has no BTF section, compile with -g or use pahole -J." , + dso->long_name); +break ;default :scnprintf (buf, buflen,"Internal error: Invalid %d error code\n" , errnum);break ;
@@ -1719,13 +1726,13 @@ static int symbol__disassemble_bpf(struct symbol *sym,char tpath[PATH_MAX ];size_t buf_size;int nr_skip =0 ; -int ret =-1 ;char *buf;bfd *bfdf; +int ret;FILE *s;if (dso->binary_type !=DSO_BINARY_TYPE__BPF_PROG_INFO ) -return -1 ; +return SYMBOL_ANNOTATE_ERRNO__BPF_INVALID_FILE ;pr_debug ("%s: handling sym %s addr %" PRIx64" len %" PRIx64"\n" , __func__, sym->name, sym->start, sym->end - sym->start);
@@ -1738,8 +1745,10 @@ static int symbol__disassemble_bpf(struct symbol *sym,assert (bfd_check_format (bfdf, bfd_object)); s =open_memstream (&buf, &buf_size); -if (!s) +if (!s) { + ret = errno; goto out; + }init_disassemble_info (&info, s, (fprintf_ftype ) fprintf);
@@ -1748,8 +1757,10 @@ static int symbol__disassemble_bpf(struct symbol *sym, info_node =perf_env__find_bpf_prog_info (dso->bpf_prog.env, dso->bpf_prog.id); -if (!info_node) +if (!info_node) { +return SYMBOL_ANNOTATE_ERRNO__BPF_MISSING_BTF ; goto out; + } info_linear = info_node->info_linear; sub_id = dso->bpf_prog.sub_id;
tools/perf/util/annotate.h +2 -0
@@ -372,6 +372,8 @@ enum symbol_disassemble_errno {SYMBOL_ANNOTATE_ERRNO__NO_LIBOPCODES_FOR_BPF ,SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_CPUID_PARSING ,SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_REGEXP , +SYMBOL_ANNOTATE_ERRNO__BPF_INVALID_FILE , +SYMBOL_ANNOTATE_ERRNO__BPF_MISSING_BTF , __SYMBOL_ANNOTATE_ERRNO__END, };
Signature · 1 line
2.21.0
Re: [PATCH 06/24] tools headers uapi: Sync linux/usbdevice_fs.h with the kernel sources
In reply to Arnaldo Carvalho de MeloQuoted 56 lines · Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <[email protected]>
To pick up the changes from:
4ed3350539aa("USB: usbfs: Add a capability flag for runtime suspend")7794f486ed0b("usbfs: Add ioctls for runtime power management")This triggers these changes in the kernel sources, automagically supporting these new ioctls in the 'perf trace' beautifiers.
Soon this will be used in things like filter expressions for tracepoints in 'perf record', 'perf trace', 'perf top', i.e. filter expressions will do a lookup to turn things like
USBDEVFS_WAIT_FOR_RESUMEinto _IO('U',
35) before associating the tracepoint expression to tracepoint perf event.$ tools/perf/trace/beauty/usbdevfs_ioctl.sh > before $ cp include/uapi/linux/usbdevice_fs.h tools/include/uapi/linux/usbdevice_fs.h $ git diff diff --git a/tools/include/uapi/linux/usbdevice_fs.h b/tools/include/uapi/linux/usbdevice_fs.h index 78efe870c2b7..cf525cddeb94 100644 --- a/tools/include/uapi/linux/usbdevice_fs.h +++ b/tools/include/uapi/linux/usbdevice_fs.h @@ -158,6 +158,7 @@ struct usbdevfs_hub_portinfo { #define USBDEVFS_CAP_MMAP 0x20 #define USBDEVFS_CAP_DROP_PRIVILEGES 0x40 #define USBDEVFS_CAP_CONNINFO_EX 0x80 +#define USBDEVFS_CAP_SUSPEND 0x100/* USBDEVFS_DISCONNECT_CLAIM flags & struct */@@ -223,5 +224,8 @@ struct usbdevfs_streams { * extending size of the data returned. */ #define USBDEVFS_CONNINFO_EX(len) _IOC(_IOC_READ, 'U', 32, len) +#define USBDEVFS_FORBID_SUSPEND _IO('U', 33) +#define USBDEVFS_ALLOW_SUSPEND _IO('U', 34) +#define USBDEVFS_WAIT_FOR_RESUME _IO('U', 35)#endif /* _UAPI_LINUX_USBDEVICE_FS_H */ $ tools/perf/trace/beauty/usbdevfs_ioctl.sh > after $ diff -u before after --- before 2019-09-27 11:41:50.634867620 -0300 +++ after 2019-09-27 11:42:07.453102978 -0300 @@ -24,6 +24,9 @@ [30] = "DROP_PRIVILEGES", [31] = "GET_SPEED", [32] = "CONNINFO_EX", + [33] = "FORBID_SUSPEND", + [34] = "ALLOW_SUSPEND", + [35] = "WAIT_FOR_RESUME", [3] = "RESETEP", [4] = "SETINTERFACE", [5] = "SETCONFIGURATION", $
Quoted 4 lines
This addresses the following perf build warning:
Warning: Kernel ABI header at '
tools/include/uapi/linux/usbdevice_fs.h' differs from latest version at 'include/uapi/linux/usbdevice_fs.h' diff -utools/include/uapi/linux/usbdevice_fs.hinclude/uapi/linux/usbdevice_fs.h
This may sound silly, and undoubtedly the question has been asked before. Nevertheless...
Why go to the time and trouble to detect differences between tools/include/uapi/linux/usbdevice_fs.h and include/uapi/linux/usbdevice_fs.h? Why not just make the first a symbolic link to the second? Or get rid of the first entirely, and change the source code so that it #include's the second?
Alan Stern
Re: [PATCH 07/24] tools headers uapi: Sync linux/fs.h with the kernel sources
In reply to Arnaldo Carvalho de MeloQuoted 29 lines · Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <[email protected]>
To pick the changes from:
78a1b96bcf7a("fscrypt: addFS_IOC_REMOVE_ENCRYPTION_KEY_ALL_USERSioctl")23c688b54016("fscrypt: allow unprivileged users to add/remove keys for v2 policies")5dae460c2292("fscrypt: v2 encryption policy support")
5a7e29924dac("fscrypt: addFS_IOC_GET_ENCRYPTION_KEY_STATUSioctl")b1c0ec3599f4("fscrypt: addFS_IOC_REMOVE_ENCRYPTION_KEYioctl")22d94f493bfb("fscrypt: addFS_IOC_ADD_ENCRYPTION_KEYioctl")3b6df59bc4d2("fscrypt: use FSCRYPT_* definitions, not FS_*")2336d0deb2d4("fscrypt: useFSCRYPT_prefix for uapi constants")7af0ab0d3aab("fs, fscrypt: move uapi definitions to new header <linux/fscrypt.h>")That don't trigger any changes in tooling, as it so far is used only for:
$ grep -l 'fs\.h' tools/perf/trace/beauty/*.sh | xargs grep regex= tools/perf/trace/beauty/rename_flags.sh:regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+RENAME_([[:alnum:]_]+)[[:space:]]+\(1[[:space:]]*<<[[:space:]]*([[:xdigit:]]+)[[:space:]]*\)[[:space:]]*.*' tools/perf/trace/beauty/sync_file_range.sh:regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+SYNC_FILE_RANGE_([[:alnum:]_]+)[[:space:]]+([[:xdigit:]]+)[[:space:]]*.*' tools/perf/trace/beauty/usbdevfs_ioctl.sh:regex="^#[[:space:]]*define[[:space:]]+USBDEVFS_(\w+)(\(\w+\))?[[:space:]]+_IO[CWR]{0,2}\([[:space:]]*(_IOC_\w+,[[:space:]]*)?'U'[[:space:]]*,[[:space:]]*([[:digit:]]+).*" tools/perf/trace/beauty/usbdevfs_ioctl.sh:regex="^#[[:space:]]*define[[:space:]]+USBDEVFS_(\w+)[[:space:]]+_IO[WR]{0,2}\([[:space:]]*'U'[[:space:]]*,[[:space:]]*([[:digit:]]+).*" $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 -utools/include/uapi/linux/fs.hinclude/uapi/linux/fs.h
Quoted 6 lines
Cc Adrian Hunter <[email protected]>Cc Eric Biggers <[email protected]>Cc Jiri Olsa <[email protected]>Cc Namhyung Kim <[email protected]>Signed-off-by Arnaldo Carvalho de Melo <[email protected]>
What's the reason why you don't just use the include/uapi/ headers directly?
- Eric
Re: [PATCH 07/24] tools headers uapi: Sync linux/fs.h with the kernel sources
Em Tue, Oct 01, 2019 at 11:45:21AM -0700, Eric Biggers escreveu:
Quoted 30 lines · Arnaldo Carvalho de Melo
Quoted 29 lines
From: Arnaldo Carvalho de Melo <[email protected]>
To pick the changes from:
78a1b96bcf7a("fscrypt: addFS_IOC_REMOVE_ENCRYPTION_KEY_ALL_USERSioctl")23c688b54016("fscrypt: allow unprivileged users to add/remove keys for v2 policies")5dae460c2292("fscrypt: v2 encryption policy support")
5a7e29924dac("fscrypt: addFS_IOC_GET_ENCRYPTION_KEY_STATUSioctl")b1c0ec3599f4("fscrypt: addFS_IOC_REMOVE_ENCRYPTION_KEYioctl")22d94f493bfb("fscrypt: addFS_IOC_ADD_ENCRYPTION_KEYioctl")3b6df59bc4d2("fscrypt: use FSCRYPT_* definitions, not FS_*")2336d0deb2d4("fscrypt: useFSCRYPT_prefix for uapi constants")7af0ab0d3aab("fs, fscrypt: move uapi definitions to new header <linux/fscrypt.h>")That don't trigger any changes in tooling, as it so far is used only for:
$ grep -l 'fs\.h' tools/perf/trace/beauty/*.sh | xargs grep regex= tools/perf/trace/beauty/rename_flags.sh:regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+RENAME_([[:alnum:]_]+)[[:space:]]+\(1[[:space:]]*<<[[:space:]]*([[:xdigit:]]+)[[:space:]]*\)[[:space:]]*.*' tools/perf/trace/beauty/sync_file_range.sh:regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+SYNC_FILE_RANGE_([[:alnum:]_]+)[[:space:]]+([[:xdigit:]]+)[[:space:]]*.*' tools/perf/trace/beauty/usbdevfs_ioctl.sh:regex="^#[[:space:]]*define[[:space:]]+USBDEVFS_(\w+)(\(\w+\))?[[:space:]]+_IO[CWR]{0,2}\([[:space:]]*(_IOC_\w+,[[:space:]]*)?'U'[[:space:]]*,[[:space:]]*([[:digit:]]+).*" tools/perf/trace/beauty/usbdevfs_ioctl.sh:regex="^#[[:space:]]*define[[:space:]]+USBDEVFS_(\w+)[[:space:]]+_IO[WR]{0,2}\([[:space:]]*'U'[[:space:]]*,[[:space:]]*([[:digit:]]+).*" $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 -utools/include/uapi/linux/fs.hinclude/uapi/linux/fs.h
Quoted 8 lines
Quoted 6 lines
Cc Adrian Hunter <[email protected]>Cc Eric Biggers <[email protected]>Cc Jiri Olsa <[email protected]>Cc Namhyung Kim <[email protected]>Signed-off-by Arnaldo Carvalho de Melo <[email protected]>What's the reason why you don't just use the
include/uapi/headers directly?
We can't use anything from outside tools/perf/ to build it, sometimes things get changed by kernel developers and tooling breaks.
Another reason is that we want to be able to do:
[acme@quaco perf]$ make help | grep perf
perf-tar-src-pkg - Build perf-5.3.0.tar source tarball
perf-targz-src-pkg - Build perf-5.3.0.tar.gz source tarball perf-tarbz2-src-pkg - Build perf-5.3.0.tar.bz2 source tarball perf-tarxz-src-pkg - Build perf-5.3.0.tar.xz source tarball
[acme@quaco perf]$
Take that tarball, transfer it to an older system and still have it building and working.
We also use the build warnings as hints that something needs to be changed in tooling to pick up new kernel features, such as new ioctls, syscall arguments to handle in 'perf trace', etc.
- Arnaldo
Re: [PATCH 06/24] tools headers uapi: Sync linux/usbdevice_fs.h with the kernel sources
In reply to Alan SternEm Tue, Oct 01, 2019 at 09:59:55AM -0400, Alan Stern escreveu:
Quoted 63 lines · Arnaldo Carvalho de Melo
Quoted 57 lines
From: Arnaldo Carvalho de Melo <[email protected]>
To pick up the changes from:
4ed3350539aa("USB: usbfs: Add a capability flag for runtime suspend")7794f486ed0b("usbfs: Add ioctls for runtime power management")This triggers these changes in the kernel sources, automagically supporting these new ioctls in the 'perf trace' beautifiers.
Soon this will be used in things like filter expressions for tracepoints in 'perf record', 'perf trace', 'perf top', i.e. filter expressions will do a lookup to turn things like
USBDEVFS_WAIT_FOR_RESUMEinto _IO('U',
35) before associating the tracepoint expression to tracepoint perf event.$ tools/perf/trace/beauty/usbdevfs_ioctl.sh > before $ cp include/uapi/linux/usbdevice_fs.h tools/include/uapi/linux/usbdevice_fs.h $ git diff diff --git a/tools/include/uapi/linux/usbdevice_fs.h b/tools/include/uapi/linux/usbdevice_fs.h index 78efe870c2b7..cf525cddeb94 100644 --- a/tools/include/uapi/linux/usbdevice_fs.h +++ b/tools/include/uapi/linux/usbdevice_fs.h @@ -158,6 +158,7 @@ struct usbdevfs_hub_portinfo { #define USBDEVFS_CAP_MMAP 0x20 #define USBDEVFS_CAP_DROP_PRIVILEGES 0x40 #define USBDEVFS_CAP_CONNINFO_EX 0x80 +#define USBDEVFS_CAP_SUSPEND 0x100/* USBDEVFS_DISCONNECT_CLAIM flags & struct */@@ -223,5 +224,8 @@ struct usbdevfs_streams { * extending size of the data returned. */ #define USBDEVFS_CONNINFO_EX(len) _IOC(_IOC_READ, 'U', 32, len) +#define USBDEVFS_FORBID_SUSPEND _IO('U', 33) +#define USBDEVFS_ALLOW_SUSPEND _IO('U', 34) +#define USBDEVFS_WAIT_FOR_RESUME _IO('U', 35)#endif /* _UAPI_LINUX_USBDEVICE_FS_H */ $ tools/perf/trace/beauty/usbdevfs_ioctl.sh > after $ diff -u before after --- before 2019-09-27 11:41:50.634867620 -0300 +++ after 2019-09-27 11:42:07.453102978 -0300 @@ -24,6 +24,9 @@ [30] = "DROP_PRIVILEGES", [31] = "GET_SPEED", [32] = "CONNINFO_EX", + [33] = "FORBID_SUSPEND", + [34] = "ALLOW_SUSPEND", + [35] = "WAIT_FOR_RESUME", [3] = "RESETEP", [4] = "SETINTERFACE", [5] = "SETCONFIGURATION", $Quoted 4 lines
This addresses the following perf build warning:
Warning: Kernel ABI header at '
tools/include/uapi/linux/usbdevice_fs.h' differs from latest version at 'include/uapi/linux/usbdevice_fs.h' diff -utools/include/uapi/linux/usbdevice_fs.hinclude/uapi/linux/usbdevice_fs.h
Quoted 8 lines
This may sound silly, and undoubtedly the question has been asked before. Nevertheless...
Why go to the time and trouble to detect differences between
tools/include/uapi/linux/usbdevice_fs.handinclude/uapi/linux/usbdevice_fs.h? Why not just make the first a symbolic link to the second? Or get rid of the first entirely, and change the source code so that it #include's the second?
We can't use anything from outside tools/perf/ to build it, sometimes things get changed by kernel developers and tooling breaks.
Another reason is that we want to be able to do:
[acme@quaco perf]$ make help | grep perf
perf-tar-src-pkg - Build perf-5.3.0.tar source tarball
perf-targz-src-pkg - Build perf-5.3.0.tar.gz source tarball perf-tarbz2-src-pkg - Build perf-5.3.0.tar.bz2 source tarball perf-tarxz-src-pkg - Build perf-5.3.0.tar.xz source tarball
[acme@quaco perf]$
Take that tarball, transfer it to an older system and still have it building and working.
We also use the build warnings as hints that something needs to be changed in tooling to pick up new kernel features, such as new ioctls, syscall arguments to handle in 'perf trace', etc.
- Arnaldo
Quoted 176 lines · Arnaldo Carvalho de Melo
Hi Ingo/Thomas,
Please consider pulling, mostly small fixes, just one extra
header copied due tolinux/fs.hnow having parts of it moved tolinux/fscrypt.hthat then needs syncing so that tooling continues to build on older systems.Best regards,
- Arnaldo
Test results at the end of this message, as usual.
The following changes since commit
da05b5ea12c1e50b2988a63470d6b69434796f8b:Merge branch 'timers-urgent-for-linus' of
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip(2019-09-26 15:53: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.4-20191001for you to fetch changes up to
11aad897f6d1a28eae3b7e5b293647c522d65819:perf annotate: Don't return -1 for error when doing BPF disassembly (2019-09-30 17:30:06 -0300)
----------------------------------------------------------------
perf/urgent fixes:perf script:
Andi Kleen:
- Fix recovery from LBR/binary mismatch in the "brstackinsn" --field.
perf annotate:
Arnaldo Carvalho de Melo:
- Propagate errors so that meaningful messages can be presented to the user in case of problems.
perf map:
Steve MacLean:
- Fix handling of maps partially overlapped, resolving symbols in the ranges not replaced by new mmaps.
perf tests:
Ian Rogers:
- Use
raise()instead of NULL derefs to avoid causing a SIGILL rather than a SIGSEGV for optimized builds that turn NULL derefs into ud2 instructions.perf LLVM:
Ian Rogers:
- Don't access out-of-scope array.
perf inject:
Steve MacLean:
- Fix
JIT_CODE_MOVEfilename, that was having a u64 truncaded into a 32-bit snprintf format and also a missing ".so" suffix in another case.libsubcmd:
Ian Rogers:
- Make
_FORTIFY_SOURCEdefines dependent on the feature, avoiding false positives with with memory sanitizers such as LLVM's ASan.Vendor specific events:
Intel:
Andi Kleen:
- Fix period for Intel fixed counters.
s390:
Thomas Richter (2):
- Fix some event details transaction for machine type 8561.
tools headers UAPI:
Arnaldo Carvalho de Melo:
- Sync headers with the kernel, catching new usbdevfs ioctls and madvise behaviours to properly decode in 'perf trace' output.
Documentation:
Steve MacLean:
- Correct and clarify jitdump spec.
Signed-off-by Arnaldo Carvalho de Melo <[email protected]>----------------------------------------------------------------
Andi Kleen (2):
perf script brstackinsn: Fix recovery from LBR/binary mismatch perf jevents: Fix period for Intel fixed countersArnaldo Carvalho de Melo (13):
tools headers uapi: Syncdrm/i915_drm.hwith the kernel sources tools headers uapi: Syncasm-generic/mman-common.hwith the kernel tools headers uapi: Synclinux/usbdevice_fs.hwith the kernel sources tools headers uapi: Synclinux/fs.hwith the kernel sources tools headers kvm: Sync kvm headers with the kernel sources perf tools: Propagateget_cpuid()error
perf evsel: Fall back to global 'perf_env' inperf_evsel__env()perf annotate: Propagateperf_env__arch()error
perf annotate: Fix the signedness of failure returns
perf annotate: Propagate thesymbol__annotate()error return perf annotate: Fix arch specific ->init() failure errors perf annotate: Return appropriate error code for allocation failures perf annotate: Don't return -1 for error when doing BPF disassemblyIan Rogers (4):
libsubcmd: Make_FORTIFY_SOURCEdefines dependent on the feature perf tests: Avoid raising SEGV using an obvious NULL dereference perf docs: Allow man page date to be specified
perf llvm: Don't access out-of-scope arraySteve MacLean (3):
perf map: Fix overlapped map handling
perf inject jit: FixJIT_CODE_MOVEfilename
perf docs: Correct and clarify jitdump specThomas Richter (2):
perf vendor events s390: Add JSON transaction for machine type 8561 perf vendor events s390: Use s390 machine name instead of type 8561tools/arch/arm/include/uapi/asm/kvm.h | 4 +- tools/arch/arm64/include/uapi/asm/kvm.h | 4 +- tools/arch/s390/include/uapi/asm/kvm.h | 6 + tools/arch/x86/include/uapi/asm/vmx.h | 2 + tools/include/uapi/asm-generic/mman-common.h | 3 + tools/include/uapi/drm/i915_drm.h | 1 + tools/include/uapi/linux/fs.h | 55 +------ tools/include/uapi/linux/fscrypt.h | 181 +++++++++++++++++++++ tools/include/uapi/linux/kvm.h | 3 + tools/include/uapi/linux/usbdevice_fs.h | 4 + tools/lib/subcmd/Makefile | 8 +- tools/perf/Documentation/asciidoc.conf | 3 + tools/perf/Documentation/jitdump-specification.txt | 4 +- tools/perf/arch/arm/annotate/instructions.c | 4 +- tools/perf/arch/arm64/annotate/instructions.c | 4 +- tools/perf/arch/powerpc/util/header.c | 3 +- tools/perf/arch/s390/annotate/instructions.c | 6 +- tools/perf/arch/s390/util/header.c | 9 +- tools/perf/arch/x86/annotate/instructions.c | 6 +- tools/perf/arch/x86/util/header.c | 3 +- tools/perf/builtin-kvm.c | 7 +- tools/perf/builtin-script.c | 6 +- tools/perf/check-headers.sh | 1 + .../arch/s390/{cf_m8561 => cf_z15}/basic.json | 0 .../arch/s390/{cf_m8561 => cf_z15}/crypto.json | 0 .../arch/s390/{cf_m8561 => cf_z15}/crypto6.json | 0 .../arch/s390/{cf_m8561 => cf_z15}/extended.json | 0 .../pmu-events/arch/s390/cf_z15/transaction.json | 7 + tools/perf/pmu-events/arch/s390/mapfile.csv | 2 +- tools/perf/pmu-events/jevents.c | 12 +- tools/perf/tests/perf-hooks.c | 3 +- tools/perf/util/annotate.c | 35 +++- tools/perf/util/annotate.h | 4 + tools/perf/util/evsel.c | 3 +- tools/perf/util/jitdump.c | 6 +- tools/perf/util/llvm-utils.c | 6 +- tools/perf/util/map.c | 3 +
Quoted 8 lines
tools/perf/util/python.c | 6 +
38 files changed, 315 insertions(+), 99 deletions(-)
create mode 100644 tools/include/uapi/linux/fscrypt.h
rename tools/perf/pmu-events/arch/s390/{cf_m8561 => cf_z15}/basic.json (100%)
rename tools/perf/pmu-events/arch/s390/{cf_m8561 => cf_z15}/crypto.json (100%)
rename tools/perf/pmu-events/arch/s390/{cf_m8561 => cf_z15}/crypto6.json (100%)
rename tools/perf/pmu-events/arch/s390/{cf_m8561 => cf_z15}/extended.json (100%)
create mode 100644 tools/perf/pmu-events/arch/s390/cf_z15/transaction.jsonPulled, thanks a lot Arnaldo!
Ingo