perf tooling fixes for v5.8:
- Update various UAPI headers, some automatically adding support for a new MSR and the faccess2 syscall. - Fix corner case NULL deref in the histograms code. - Fix corner case NULL deref in 'perf stat' aggregation code. - Fix array pointer deref and old style declaration in the parsing of events. - Fix segfault when processing ZSTD compressed perf.data files in 'perf script' due to lack of initialization of the ZSTD library. - Handle __attribute__((user)) in libtraceevent fixing the parsing of syscall tracepoints with user buffers. - Make libtraevent aware of __builtin_expect() appearing in tracepoint fields. - Make the BPF prologue generation use bpf_probe_read_{user,kernel}(). - Fix the '@user' attribute parsing in kprobes variables in 'perf probe'. - Fix error message when asking for -fsanitize=address without required libraries. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> 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. Ubuntu 19.10 and Debian experimental is failing when linking against libllvm, which isn't the default, needs to be investigated, haven't tested with CC=gcc, but should be the same problem: + make ARCH= CROSS_COMPILE= EXTRA_CFLAGS= LIBCLANGLLVM=1 -C /git/linux/tools/perf O=/tmp/build/perf CC=clang ... /usr/bin/ld: /usr/lib/llvm-9/lib/libclangAnalysis.a(ExprMutationAnalyzer.cpp.o): in function `clang::ast_matchers::internal::matcher_ignoringImpCasts0Matcher::matches(clang::Expr const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const': (.text._ZNK5clang12ast_matchers8internal32matcher_ignoringImpCasts0Matcher7matchesERKNS_4ExprEPNS1_14ASTMatchFinderEPNS1_21BoundNodesTreeBuilderE[_ZNK5clang12ast_matchers8internal32matcher_ignoringImpCasts0Matcher7matchesERKNS_4ExprEPNS1_14ASTMatchFinderEPNS1_21BoundNodesTreeBuilderE]+0x43): undefined reference to `clang::ast_matchers::internal::DynTypedMatcher::matches(clang::ast_type_traits::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const' /usr/bin/ld: /usr/lib/llvm-9/lib/libclangAnalysis.a(ExprMutationAnalyzer.cpp.o): in function `clang::ast_matchers::internal::matcher_hasLoopVariable0Matcher::matches(clang::CXXForRangeStmt const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const': (.text._ZNK5clang12ast_matchers8internal31matcher_hasLoopVariable0Matcher7matchesERKNS_15CXXForRangeStmtEPNS1_14ASTMatchFinderEPNS1_21BoundNodesTreeBuilderE[_ZNK5clang12ast_matchers8internal31matcher_hasLoopVariable0Matcher7matchesERKNS_15CXXForRangeStmtEPNS1_14ASTMatchFinderEPNS1_21BoundNodesTreeBuilderE]+0x48): undefined reference to `clang::ast_matchers::internal::DynTypedMatcher::matches(clang::ast_type_traits::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const' ... It builds ok with the default set of options. And with the newest gcc 10.1.1 in fedora rawhide, same version but slightly newer build than the one in fedora 32, it is failing with: util/scripting-engines/trace-event-python.c: In function 'python_start_script': util/scripting-engines/trace-event-python.c:1595:2: error: 'visibility' attribute ignored [-Werror=attributes] 1595 | PyMODINIT_FUNC (*initfunc)(void); | ^~~~~~~~~~~~~~ Will be fixed soon. # export PERF_TARBALL=http://192.168.124.1/perf/perf-5.8.0-rc1.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:3.11 : Ok gcc (Alpine 9.2.0) 9.2.0, Alpine clang version 9.0.0 (https://git.alpinelinux.org/aports f7f0d2c2b8bcd6a5843401a9a702029556492689) (based on LLVM 9.0.0) 9 alpine:3.12 : Ok gcc (Alpine 9.3.0) 9.3.0, Alpine clang version 10.0.0 (https://gitlab.alpinelinux.org/alpine/aports.git 7445adce501f8473efdb93b17b5eaf2f1445ed4c) 10 alpine:edge : Ok gcc (Alpine 9.3.0) 9.3.0, Alpine clang version 10.0.0 (git://git.alpinelinux.org/aports 7445adce501f8473efdb93b17b5eaf2f1445ed4c) 11 alt:p8 : Ok x86_64-alt-linux-gcc (GCC) 5.3.1 20151207 (ALT p8 5.3.1-alt3.M80P.1), clang version 3.8.0 (tags/RELEASE_380/final) 12 alt:p9 : Ok x86_64-alt-linux-gcc (GCC) 8.4.1 20200305 (ALT p9 8.4.1-alt0.p9.1), clang version 7.0.1 13 alt:sisyphus : Ok x86_64-alt-linux-gcc (GCC) 9.2.1 20200123 (ALT Sisyphus 9.2.1-alt3), clang version 10.0.0 14 amazonlinux:1 : Ok gcc (GCC) 7.2.1 20170915 (Red Hat 7.2.1-2), clang version 3.6.2 (tags/RELEASE_362/final) 15 amazonlinux:2 : Ok gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-6), clang version 7.0.1 (Amazon Linux 2 7.0.1-1.amzn2.0.2) 16 android-ndk:r12b-arm : Ok arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease) 17 android-ndk:r15c-arm : Ok arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease) 18 centos:5 : Ok gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-55) 19 centos:6 : Ok gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23) 20 centos:7 : Ok gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39) 21 centos:8 : Ok gcc (GCC) 8.3.1 20190507 (Red Hat 8.3.1-4), clang version 8.0.1 (Red Hat 8.0.1-1.module_el8.1.0+215+a01033fb) 22 clearlinux:latest : Ok gcc (Clear Linux OS for Intel Architecture) 9.3.1 20200501 releases/gcc-9.3.0-196-gcb2c76c8b1, clang version 10.0.0 23 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) 24 debian:9 : Ok gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516, clang version 3.8.1-24 (tags/RELEASE_381/final) 25 debian:10 : Ok gcc (Debian 8.3.0-6) 8.3.0, clang version 7.0.1-8 (tags/RELEASE_701/final) 26 debian:experimental : FAIL gcc (Debian 9.3.0-13) 9.3.0, clang version 9.0.1-12 27 debian:experimental-x-arm64 : Ok aarch64-linux-gnu-gcc (Debian 9.3.0-8) 9.3.0 28 debian:experimental-x-mips : Ok mips-linux-gnu-gcc (Debian 8.3.0-19) 8.3.0 29 debian:experimental-x-mips64 : Ok mips64-linux-gnuabi64-gcc (Debian 9.3.0-8) 9.3.0 30 debian:experimental-x-mipsel : Ok mipsel-linux-gnu-gcc (Debian 9.2.1-8) 9.2.1 20190909 31 fedora:20 : Ok gcc (GCC) 4.8.3 20140911 (Red Hat 4.8.3-7) 32 fedora:22 : Ok gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6), clang version 3.5.0 (tags/RELEASE_350/final) 33 fedora:23 : Ok gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6), clang version 3.7.0 (tags/RELEASE_370/final) 34 fedora:24 : Ok gcc (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1), clang version 3.8.1 (tags/RELEASE_381/final) 35 fedora:24-x-ARC-uClibc : Ok arc-linux-gcc (ARCompact ISA Linux uClibc toolchain 2017.09-rc2) 7.1.1 20170710 36 fedora:25 : Ok gcc (GCC) 6.4.1 20170727 (Red Hat 6.4.1-1), clang version 3.9.1 (tags/RELEASE_391/final) 37 fedora:26 : Ok gcc (GCC) 7.3.1 20180130 (Red Hat 7.3.1-2), clang version 4.0.1 (tags/RELEASE_401/final) 38 fedora:27 : Ok gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-6), clang version 5.0.2 (tags/RELEASE_502/final) 39 fedora:28 : Ok gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2), clang version 6.0.1 (tags/RELEASE_601/final) 40 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) 41 fedora:30 : Ok gcc (GCC) 9.2.1 20190827 (Red Hat 9.2.1-1), clang version 8.0.0 (Fedora 8.0.0-3.fc30) 42 fedora:30-x-ARC-glibc : Ok arc-linux-gcc (ARC HS GNU/Linux glibc toolchain 2019.03-rc1) 8.3.1 20190225 43 fedora:30-x-ARC-uClibc : Ok arc-linux-gcc (ARCv2 ISA Linux uClibc toolchain 2019.03-rc1) 8.3.1 20190225 44 fedora:31 : Ok gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2), clang version 9.0.1 (Fedora 9.0.1-2.fc31) 45 fedora:32 : Ok gcc (GCC) 10.1.1 20200507 (Red Hat 10.1.1-1), clang version 10.0.0 (Fedora 10.0.0-1.fc32) 46 fedora:rawhide : FAIL gcc (GCC) 10.1.1 20200507 (Red Hat 10.1.1-1), clang version 10.0.0 (Fedora 10.0.0-4.fc33) 47 gentoo-stage3-amd64:latest : Ok gcc (Gentoo 9.2.0-r2 p3) 9.2.0 48 mageia:5 : Ok gcc (GCC) 4.9.2, clang version 3.5.2 (tags/RELEASE_352/final) 49 mageia:6 : Ok gcc (Mageia 5.5.0-1.mga6) 5.5.0, clang version 3.9.1 (tags/RELEASE_391/final) 50 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) 51 manjaro:latest : Ok gcc (GCC) 9.2.0, clang version 9.0.0 (tags/RELEASE_900/final) 52 openmandriva:cooker : Ok gcc (GCC) 10.0.0 20200502 (OpenMandriva), clang version 10.0.1 53 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) 54 opensuse:15.1 : Ok gcc (SUSE Linux) 7.5.0, clang version 7.0.1 (tags/RELEASE_701/final 349238) 55 opensuse:15.2 : Ok gcc (SUSE Linux) 7.5.0, clang version 7.0.1 (tags/RELEASE_701/final 349238) 56 opensuse:42.3 : Ok gcc (SUSE Linux) 4.8.5, clang version 3.8.0 (tags/RELEASE_380/final 262553) 57 opensuse:tumbleweed : Ok gcc (SUSE Linux) 9.3.1 20200406 [revision 6db837a5288ee3ca5ec504fbd5a765817e556ac2], clang version 10.0.0 58 oraclelinux:6 : Ok gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23.0.1) 59 oraclelinux:7 : Ok gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39.0.3) 60 oraclelinux:8 : Ok gcc (GCC) 8.3.1 20191121 (Red Hat 8.3.1-5.0.3), clang version 9.0.1 (Red Hat 9.0.1-2.0.1.module+el8.2.0+5599+9ed9ef6d) 61 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) 62 ubuntu:14.04 : Ok gcc (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4 63 ubuntu:16.04 : Ok gcc (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609, clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final) 64 ubuntu:16.04-x-arm : Ok arm-linux-gnueabihf-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 65 ubuntu:16.04-x-arm64 : Ok aarch64-linux-gnu-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 66 ubuntu:16.04-x-powerpc : Ok powerpc-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 67 ubuntu:16.04-x-powerpc64 : Ok powerpc64-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 68 ubuntu:16.04-x-powerpc64el : Ok powerpc64le-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 69 ubuntu:16.04-x-s390 : Ok s390x-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 70 ubuntu:18.04 : Ok gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0, clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final) 71 ubuntu:18.04-x-arm : Ok arm-linux-gnueabihf-gcc (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0 72 ubuntu:18.04-x-arm64 : Ok aarch64-linux-gnu-gcc (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0 73 ubuntu:18.04-x-m68k : Ok m68k-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 74 ubuntu:18.04-x-powerpc : Ok powerpc-linux-gnu-gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0 75 ubuntu:18.04-x-powerpc64 : Ok powerpc64-linux-gnu-gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0 76 ubuntu:18.04-x-powerpc64el : Ok powerpc64le-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 77 ubuntu:18.04-x-riscv64 : Ok riscv64-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 78 ubuntu:18.04-x-s390 : Ok s390x-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 79 ubuntu:18.04-x-sh4 : Ok sh4-linux-gnu-gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0 80 ubuntu:18.04-x-sparc64 : Ok sparc64-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 81 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) 82 ubuntu:19.04 : Ok gcc (Ubuntu 8.3.0-6ubuntu1) 8.3.0, clang version 8.0.0-3 (tags/RELEASE_800/final) 83 ubuntu:19.04-x-alpha : Ok alpha-linux-gnu-gcc (Ubuntu 8.3.0-6ubuntu1) 8.3.0 84 ubuntu:19.04-x-arm64 : Ok aarch64-linux-gnu-gcc (Ubuntu/Linaro 8.3.0-6ubuntu1) 8.3.0 85 ubuntu:19.04-x-hppa : Ok hppa-linux-gnu-gcc (Ubuntu 8.3.0-6ubuntu1) 8.3.0 86 ubuntu:19.10 : FAIL gcc (Ubuntu 9.2.1-9ubuntu2) 9.2.1 20191008, clang version 9.0.0-2 (tags/RELEASE_900/final) 87 ubuntu:20.04 : Ok gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0, clang version 10.0.0-4ubuntu1 # # uname -a Linux five 5.7.0 #1 SMP Mon Jun 1 12:29:31 -03 2020 x86_64 x86_64 x86_64 GNU/Linux # git log --oneline -16a1515c962
perf build: Fix error message when asking for -fsanitize=address without required libraries # perf version --build-options perf version 5.8.rc1.g6a1515c962b1 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: PMU events : 10.1: PMU event table sanity : Ok 10.2: PMU event map aliases : Ok 10.3: Parsing of PMU event table metrics : Ok 11: DSO data read : Ok 12: DSO data cache : Ok 13: DSO data reopen : Ok 14: Roundtrip evsel->name : Ok 15: Parse sched tracepoints fields : Ok 16: syscalls:sys_enter_openat event fields : Ok 17: Setup struct perf_event_attr : Ok 18: Match and link multiple hists : Ok 19: 'import perf' in python : Ok 20: Breakpoint overflow signal handler : Ok 21: Breakpoint overflow sampling : Ok 22: Breakpoint accounting : Ok 23: Watchpoint : 23.1: Read Only Watchpoint : Skip 23.2: Write Only Watchpoint : Ok 23.3: Read / Write Watchpoint : Ok 23.4: Modify Watchpoint : Ok 24: Number of exit events of a simple workload : Ok 25: Software clock events period values : Ok 26: Object code reading : Ok 27: Sample parsing : Ok 28: Use a dummy software event to keep tracking : Ok 29: Parse with no sample_id_all bit set : Ok 30: Filter hist entries : Ok 31: Lookup mmap thread : Ok 32: Share thread maps : Ok 33: Sort output of hist entries : Ok 34: Cumulate child hist entries : Ok 35: Track with sched_switch : Ok 36: Filter fds with revents mask in a fdarray : Ok 37: Add fd to a fdarray, making it autogrow : Ok 38: kmod_path__parse : Ok 39: Thread map : Ok 40: LLVM search and compile : 40.1: Basic BPF llvm compile : Ok 40.2: kbuild searching : Ok 40.3: Compile source for BPF prologue generation : Ok 40.4: Compile source for BPF relocation : Ok 41: Session topology : Ok 42: BPF filter : 42.1: Basic BPF filtering : Ok 42.2: BPF pinning : Ok 42.3: BPF prologue generation : Ok 42.4: BPF relocation checker : Ok 43: Synthesize thread map : Ok 44: Remove thread map : Ok 45: Synthesize cpu map : Ok 46: Synthesize stat config : Ok 47: Synthesize stat : Ok 48: Synthesize stat round : Ok 49: Synthesize attr update : Ok 50: Event times : Ok 51: Read backward ring buffer : Ok 52: Print cpu map : Ok 53: Merge cpu map : Ok 54: Probe SDT events : Ok 55: is_printable_array : Ok 56: Print bitmap : Ok 57: perf hooks : Ok 58: builtin clang support : Skip (not compiled in) 59: unit_number__scnprintf : Ok 60: mem2node : Ok 61: time utils : Ok 62: Test jit_write_elf : Ok 63: Test libpfm4 support : Skip (not compiled in) 64: Test api io : Ok 65: maps__merge_in : Ok 66: Demangle Java : Ok 67: x86 rdpmc : Ok 68: Convert perf time to TSC : Ok 69: DWARF unwind : Ok 70: x86 instruction decoder - new instructions : Ok 71: Intel PT packet decoder : Ok 72: x86 bp modify : Ok 73: probe libc's inet_pton & backtrace it with ping : Ok 74: Use vfs_getname probe to get syscall args filenames : Ok 75: Check open filename arg using perf trace + vfs_getname: Ok 76: Zstd perf.data compression/decompression : Ok 77: Add vfs_getname probe to get syscall args filenames : Ok # $ git log --oneline -1 ; time make -C tools/perf build-test6a1515c962
(HEAD -> perf/urgent) perf build: Fix error message when asking for -fsanitize=address without required libraries make: Entering directory '/home/acme/git/perf/tools/perf' - tarpkg: ./tests/perf-targz-src-pkg . make_install_prefix_O: make install prefix=/tmp/krava make_util_pmu_bison_o_O: make util/pmu-bison.o make_no_libbionic_O: make NO_LIBBIONIC=1 make_no_demangle_O: make NO_DEMANGLE=1 make_no_libpython_O: make NO_LIBPYTHON=1 make_no_backtrace_O: make NO_BACKTRACE=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 NO_LIBCAP=1 NO_SYSCALL_TABLE=1 make_no_libcrypto_O: make NO_LIBCRYPTO=1 make_no_scripts_O: make NO_LIBPYTHON=1 NO_LIBPERL=1 make_no_sdt_O: make NO_SDT=1 make_install_bin_O: make install-bin make_no_libunwind_O: make NO_LIBUNWIND=1 make_no_libperl_O: make NO_LIBPERL=1 make_no_libelf_O: make NO_LIBELF=1 make_no_libdw_dwarf_unwind_O: make NO_LIBDW_DWARF_UNWIND=1 make_tags_O: make tags make_install_O: make install make_pure_O: make make_static_O: make LDFLAGS=-static NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1 NO_JVMTI=1 make_no_libaudit_O: make NO_LIBAUDIT=1 make_clean_all_O: make clean all make_no_libnuma_O: make NO_LIBNUMA=1 make_no_newt_O: make NO_NEWT=1 make_doc_O: make doc make_no_auxtrace_O: make NO_AUXTRACE=1 make_no_libbpf_O: make NO_LIBBPF=1 make_with_babeltrace_O: make LIBBABELTRACE=1 make_help_O: make help make_perf_o_O: make perf.o make_with_libpfm4_O: make LIBPFM4=1 make_with_clangllvm_O: make LIBCLANGLLVM=1 make_no_gtk2_O: make NO_GTK2=1 make_no_slang_O: make NO_SLANG=1 make_util_map_o_O: make util/map.o make_install_prefix_slash_O: make install prefix=/tmp/krava/ make_debug_O: make DEBUG=1 make_no_libbpf_DEBUG_O: make NO_LIBBPF=1 DEBUG=1 make_no_ui_O: make NO_NEWT=1 NO_SLANG=1 NO_GTK2=1 make_no_syscall_tbl_O: make NO_SYSCALL_TABLE=1 OK make: Leaving directory '/home/acme/git/perf/tools/perf' $ -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQR2GiIUctdOfX2qHhGyPKLppCJ+JwUCXuu/DwAKCRCyPKLppCJ+ J9NUAQCK6ZwAkxvqtMIGEPLaj+pJ7GQ0BmJJ8DmIFodblB6qGQEAo8h+NaM0h3NA xoFYFfGxE73d3rQ1zPilmptBpt7OjAc= =ufvk -----END PGP SIGNATURE----- Merge tag 'perf-tools-fixes-2020-06-02' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux Pull perf tooling fixes from Arnaldo Carvalho de Melo: - Update various UAPI headers, some automatically adding support for a new MSR and the faccess2 syscall. - Fix corner case NULL deref in the histograms code. - Fix corner case NULL deref in 'perf stat' aggregation code. - Fix array pointer deref and old style declaration in the parsing of events. - Fix segfault when processing ZSTD compressed perf.data files in 'perf script' due to lack of initialization of the ZSTD library. - Handle __attribute__((user)) in libtraceevent fixing the parsing of syscall tracepoints with user buffers. - Make libtraevent aware of __builtin_expect() appearing in tracepoint fields. - Make the BPF prologue generation use bpf_probe_read_{user,kernel}(). - Fix the '@user' attribute parsing in kprobes variables in 'perf probe'. - Fix error message when asking for -fsanitize=address without required libraries. * tag 'perf-tools-fixes-2020-06-02' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux: (22 commits) perf build: Fix error message when asking for -fsanitize=address without required libraries tools lib traceevent: Add handler for __builtin_expect() tools lib traceevent: Handle __attribute__((user)) in field names tools lib traceevent: Add append() function helper for appending strings tools headers UAPI: Sync linux/fs.h with the kernel sources tools include UAPI: Sync linux/vhost.h with the kernel sources tools arch x86: Sync the msr-index.h copy with the kernel sources perf script: Initialize zstd_data perf pmu: Remove unused declaration perf parse-events: Fix an old style declaration perf parse-events: Fix an incompatible pointer perf bpf: Fix bpf prologue generation perf probe: Fix user attribute access in kprobes perf stat: Fix NULL pointer dereference perf report: Fix NULL pointer dereference in hists__fprintf_nr_sample_events() tools headers UAPI: Sync kvm.h headers with the kernel sources tools headers UAPI: Sync drm/i915_drm.h with the kernel sources tools headers UAPI: Sync linux/fscrypt.h with the kernel sources perf beauty: Add support to STATX_MNT_ID in the 'statx' syscall 'mask' argument tools headers uapi: Sync linux/stat.h with the kernel sources ...
This commit is contained in:
commit
98d7e741a0
|
@ -362,6 +362,7 @@
|
|||
#define X86_FEATURE_AVX512_4FMAPS (18*32+ 3) /* AVX-512 Multiply Accumulation Single precision */
|
||||
#define X86_FEATURE_FSRM (18*32+ 4) /* Fast Short Rep Mov */
|
||||
#define X86_FEATURE_AVX512_VP2INTERSECT (18*32+ 8) /* AVX-512 Intersect for D/Q */
|
||||
#define X86_FEATURE_SRBDS_CTRL (18*32+ 9) /* "" SRBDS mitigation MSR available */
|
||||
#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 */
|
||||
|
@ -407,5 +408,6 @@
|
|||
#define X86_BUG_SWAPGS X86_BUG(21) /* CPU is affected by speculation through SWAPGS */
|
||||
#define X86_BUG_TAA X86_BUG(22) /* CPU is affected by TSX Async Abort(TAA) */
|
||||
#define X86_BUG_ITLB_MULTIHIT X86_BUG(23) /* CPU may incur MCE during certain page attribute changes */
|
||||
#define X86_BUG_SRBDS X86_BUG(24) /* CPU may leak RNG bits if not mitigated */
|
||||
|
||||
#endif /* _ASM_X86_CPUFEATURES_H */
|
||||
|
|
|
@ -128,6 +128,10 @@
|
|||
#define TSX_CTRL_RTM_DISABLE BIT(0) /* Disable RTM feature */
|
||||
#define TSX_CTRL_CPUID_CLEAR BIT(1) /* Disable TSX enumeration */
|
||||
|
||||
/* SRBDS support */
|
||||
#define MSR_IA32_MCU_OPT_CTRL 0x00000123
|
||||
#define RNGDS_MITG_DIS BIT(0)
|
||||
|
||||
#define MSR_IA32_SYSENTER_CS 0x00000174
|
||||
#define MSR_IA32_SYSENTER_ESP 0x00000175
|
||||
#define MSR_IA32_SYSENTER_EIP 0x00000176
|
||||
|
|
|
@ -385,33 +385,48 @@ struct kvm_sync_regs {
|
|||
#define KVM_X86_QUIRK_MISC_ENABLE_NO_MWAIT (1 << 4)
|
||||
|
||||
#define KVM_STATE_NESTED_FORMAT_VMX 0
|
||||
#define KVM_STATE_NESTED_FORMAT_SVM 1 /* unused */
|
||||
#define KVM_STATE_NESTED_FORMAT_SVM 1
|
||||
|
||||
#define KVM_STATE_NESTED_GUEST_MODE 0x00000001
|
||||
#define KVM_STATE_NESTED_RUN_PENDING 0x00000002
|
||||
#define KVM_STATE_NESTED_EVMCS 0x00000004
|
||||
#define KVM_STATE_NESTED_MTF_PENDING 0x00000008
|
||||
#define KVM_STATE_NESTED_GIF_SET 0x00000100
|
||||
|
||||
#define KVM_STATE_NESTED_SMM_GUEST_MODE 0x00000001
|
||||
#define KVM_STATE_NESTED_SMM_VMXON 0x00000002
|
||||
|
||||
#define KVM_STATE_NESTED_VMX_VMCS_SIZE 0x1000
|
||||
|
||||
#define KVM_STATE_NESTED_SVM_VMCB_SIZE 0x1000
|
||||
|
||||
#define KVM_STATE_VMX_PREEMPTION_TIMER_DEADLINE 0x00000001
|
||||
|
||||
struct kvm_vmx_nested_state_data {
|
||||
__u8 vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE];
|
||||
__u8 shadow_vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE];
|
||||
__u64 preemption_timer_deadline;
|
||||
};
|
||||
|
||||
struct kvm_vmx_nested_state_hdr {
|
||||
__u32 flags;
|
||||
__u64 vmxon_pa;
|
||||
__u64 vmcs12_pa;
|
||||
__u64 preemption_timer_deadline;
|
||||
|
||||
struct {
|
||||
__u16 flags;
|
||||
} smm;
|
||||
};
|
||||
|
||||
struct kvm_svm_nested_state_data {
|
||||
/* Save area only used if KVM_STATE_NESTED_RUN_PENDING. */
|
||||
__u8 vmcb12[KVM_STATE_NESTED_SVM_VMCB_SIZE];
|
||||
};
|
||||
|
||||
struct kvm_svm_nested_state_hdr {
|
||||
__u64 vmcb_pa;
|
||||
};
|
||||
|
||||
/* for KVM_CAP_NESTED_STATE */
|
||||
struct kvm_nested_state {
|
||||
__u16 flags;
|
||||
|
@ -420,6 +435,7 @@ struct kvm_nested_state {
|
|||
|
||||
union {
|
||||
struct kvm_vmx_nested_state_hdr vmx;
|
||||
struct kvm_svm_nested_state_hdr svm;
|
||||
|
||||
/* Pad the header to 128 bytes. */
|
||||
__u8 pad[120];
|
||||
|
@ -432,6 +448,7 @@ struct kvm_nested_state {
|
|||
*/
|
||||
union {
|
||||
struct kvm_vmx_nested_state_data vmx[0];
|
||||
struct kvm_svm_nested_state_data svm[0];
|
||||
} data;
|
||||
};
|
||||
|
||||
|
|
|
@ -2,7 +2,14 @@
|
|||
#ifndef _UAPI_ASM_X86_UNISTD_H
|
||||
#define _UAPI_ASM_X86_UNISTD_H
|
||||
|
||||
/* x32 syscall flag bit */
|
||||
/*
|
||||
* x32 syscall flag bit. Some user programs expect syscall NR macros
|
||||
* and __X32_SYSCALL_BIT to have type int, even though syscall numbers
|
||||
* are, for practical purposes, unsigned long.
|
||||
*
|
||||
* Fortunately, expressions like (nr & ~__X32_SYSCALL_BIT) do the right
|
||||
* thing regardless.
|
||||
*/
|
||||
#define __X32_SYSCALL_BIT 0x40000000
|
||||
|
||||
#ifndef __KERNEL__
|
||||
|
|
|
@ -150,6 +150,9 @@
|
|||
{ EXIT_REASON_UMWAIT, "UMWAIT" }, \
|
||||
{ EXIT_REASON_TPAUSE, "TPAUSE" }
|
||||
|
||||
#define VMX_EXIT_REASON_FLAGS \
|
||||
{ VMX_EXIT_REASONS_FAILED_VMENTRY, "FAILED_VMENTRY" }
|
||||
|
||||
#define VMX_ABORT_SAVE_GUEST_MSR_FAIL 1
|
||||
#define VMX_ABORT_LOAD_HOST_PDPTE_FAIL 2
|
||||
#define VMX_ABORT_LOAD_HOST_MSR_FAIL 4
|
||||
|
|
|
@ -855,9 +855,11 @@ __SYSCALL(__NR_clone3, sys_clone3)
|
|||
__SYSCALL(__NR_openat2, sys_openat2)
|
||||
#define __NR_pidfd_getfd 438
|
||||
__SYSCALL(__NR_pidfd_getfd, sys_pidfd_getfd)
|
||||
#define __NR_faccessat2 439
|
||||
__SYSCALL(__NR_faccessat2, sys_faccessat2)
|
||||
|
||||
#undef __NR_syscalls
|
||||
#define __NR_syscalls 439
|
||||
#define __NR_syscalls 440
|
||||
|
||||
/*
|
||||
* 32 bit systems traditionally used different
|
||||
|
|
|
@ -1969,6 +1969,30 @@ enum drm_i915_perf_property_id {
|
|||
*/
|
||||
DRM_I915_PERF_PROP_HOLD_PREEMPTION,
|
||||
|
||||
/**
|
||||
* Specifying this pins all contexts to the specified SSEU power
|
||||
* configuration for the duration of the recording.
|
||||
*
|
||||
* This parameter's value is a pointer to a struct
|
||||
* drm_i915_gem_context_param_sseu.
|
||||
*
|
||||
* This property is available in perf revision 4.
|
||||
*/
|
||||
DRM_I915_PERF_PROP_GLOBAL_SSEU,
|
||||
|
||||
/**
|
||||
* This optional parameter specifies the timer interval in nanoseconds
|
||||
* at which the i915 driver will check the OA buffer for available data.
|
||||
* Minimum allowed value is 100 microseconds. A default value is used by
|
||||
* the driver if this parameter is not specified. Note that larger timer
|
||||
* values will reduce cpu consumption during OA perf captures. However,
|
||||
* excessively large values would potentially result in OA buffer
|
||||
* overwrites as captures reach end of the OA buffer.
|
||||
*
|
||||
* This property is available in perf revision 5.
|
||||
*/
|
||||
DRM_I915_PERF_PROP_POLL_OA_PERIOD,
|
||||
|
||||
DRM_I915_PERF_PROP_MAX /* non-ABI */
|
||||
};
|
||||
|
||||
|
|
|
@ -84,10 +84,20 @@
|
|||
#define DN_ATTRIB 0x00000020 /* File changed attibutes */
|
||||
#define DN_MULTISHOT 0x80000000 /* Don't remove notifier */
|
||||
|
||||
/*
|
||||
* The constants AT_REMOVEDIR and AT_EACCESS have the same value. AT_EACCESS is
|
||||
* meaningful only to faccessat, while AT_REMOVEDIR is meaningful only to
|
||||
* unlinkat. The two functions do completely different things and therefore,
|
||||
* the flags can be allowed to overlap. For example, passing AT_REMOVEDIR to
|
||||
* faccessat would be undefined behavior and thus treating it equivalent to
|
||||
* AT_EACCESS is valid undefined behavior.
|
||||
*/
|
||||
#define AT_FDCWD -100 /* Special value used to indicate
|
||||
openat should use the current
|
||||
working directory. */
|
||||
#define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */
|
||||
#define AT_EACCESS 0x200 /* Test access permitted for
|
||||
effective IDs, not real IDs. */
|
||||
#define AT_REMOVEDIR 0x200 /* Remove directory instead of
|
||||
unlinking file. */
|
||||
#define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */
|
||||
|
|
|
@ -262,6 +262,7 @@ struct fsxattr {
|
|||
#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 */
|
||||
#define FS_DAX_FL 0x02000000 /* Inode is DAX */
|
||||
#define FS_INLINE_DATA_FL 0x10000000 /* Reserved for ext4 */
|
||||
#define FS_PROJINHERIT_FL 0x20000000 /* Create with parents projid */
|
||||
#define FS_CASEFOLD_FL 0x40000000 /* Folder is case insensitive */
|
||||
|
|
|
@ -19,7 +19,8 @@
|
|||
#define FSCRYPT_POLICY_FLAGS_PAD_MASK 0x03
|
||||
#define FSCRYPT_POLICY_FLAG_DIRECT_KEY 0x04
|
||||
#define FSCRYPT_POLICY_FLAG_IV_INO_LBLK_64 0x08
|
||||
#define FSCRYPT_POLICY_FLAGS_VALID 0x0F
|
||||
#define FSCRYPT_POLICY_FLAG_IV_INO_LBLK_32 0x10
|
||||
#define FSCRYPT_POLICY_FLAGS_VALID 0x1F
|
||||
|
||||
/* Encryption algorithms */
|
||||
#define FSCRYPT_MODE_AES_256_XTS 1
|
||||
|
|
|
@ -188,10 +188,13 @@ struct kvm_s390_cmma_log {
|
|||
struct kvm_hyperv_exit {
|
||||
#define KVM_EXIT_HYPERV_SYNIC 1
|
||||
#define KVM_EXIT_HYPERV_HCALL 2
|
||||
#define KVM_EXIT_HYPERV_SYNDBG 3
|
||||
__u32 type;
|
||||
__u32 pad1;
|
||||
union {
|
||||
struct {
|
||||
__u32 msr;
|
||||
__u32 pad2;
|
||||
__u64 control;
|
||||
__u64 evt_page;
|
||||
__u64 msg_page;
|
||||
|
@ -201,6 +204,15 @@ struct kvm_hyperv_exit {
|
|||
__u64 result;
|
||||
__u64 params[2];
|
||||
} hcall;
|
||||
struct {
|
||||
__u32 msr;
|
||||
__u32 pad2;
|
||||
__u64 control;
|
||||
__u64 status;
|
||||
__u64 send_page;
|
||||
__u64 recv_page;
|
||||
__u64 pending_page;
|
||||
} syndbg;
|
||||
} u;
|
||||
};
|
||||
|
||||
|
@ -1017,6 +1029,8 @@ struct kvm_ppc_resize_hpt {
|
|||
#define KVM_CAP_S390_VCPU_RESETS 179
|
||||
#define KVM_CAP_S390_PROTECTED 180
|
||||
#define KVM_CAP_PPC_SECURE_GUEST 181
|
||||
#define KVM_CAP_HALT_POLL 182
|
||||
#define KVM_CAP_ASYNC_PF_INT 183
|
||||
|
||||
#ifdef KVM_CAP_IRQ_ROUTING
|
||||
|
||||
|
|
|
@ -123,7 +123,10 @@ struct statx {
|
|||
__u32 stx_dev_major; /* ID of device containing file [uncond] */
|
||||
__u32 stx_dev_minor;
|
||||
/* 0x90 */
|
||||
__u64 __spare2[14]; /* Spare space for future expansion */
|
||||
__u64 stx_mnt_id;
|
||||
__u64 __spare2;
|
||||
/* 0xa0 */
|
||||
__u64 __spare3[12]; /* Spare space for future expansion */
|
||||
/* 0x100 */
|
||||
};
|
||||
|
||||
|
@ -148,6 +151,7 @@ struct statx {
|
|||
#define STATX_BLOCKS 0x00000400U /* Want/got stx_blocks */
|
||||
#define STATX_BASIC_STATS 0x000007ffU /* The stuff in the normal stat struct */
|
||||
#define STATX_BTIME 0x00000800U /* Want/got stx_btime */
|
||||
#define STATX_MNT_ID 0x00001000U /* Got stx_mnt_id */
|
||||
|
||||
#define STATX__RESERVED 0x80000000U /* Reserved for future struct statx expansion */
|
||||
|
||||
|
@ -177,7 +181,9 @@ struct statx {
|
|||
#define STATX_ATTR_NODUMP 0x00000040 /* [I] File is not to be dumped */
|
||||
#define STATX_ATTR_ENCRYPTED 0x00000800 /* [I] File requires key to decrypt in fs */
|
||||
#define STATX_ATTR_AUTOMOUNT 0x00001000 /* Dir: Automount trigger */
|
||||
#define STATX_ATTR_MOUNT_ROOT 0x00002000 /* Root of a mount */
|
||||
#define STATX_ATTR_VERITY 0x00100000 /* [I] Verity protected file */
|
||||
#define STATX_ATTR_DAX 0x00002000 /* [I] File is DAX */
|
||||
|
||||
|
||||
#endif /* _UAPI_LINUX_STAT_H */
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
#include <linux/types.h>
|
||||
#include <linux/ioctl.h>
|
||||
|
||||
#define VHOST_FILE_UNBIND -1
|
||||
|
||||
/* ioctls */
|
||||
|
||||
#define VHOST_VIRTIO 0xAF
|
||||
|
@ -140,4 +142,6 @@
|
|||
/* Get the max ring size. */
|
||||
#define VHOST_VDPA_GET_VRING_NUM _IOR(VHOST_VIRTIO, 0x76, __u16)
|
||||
|
||||
/* Set event fd for config interrupt*/
|
||||
#define VHOST_VDPA_SET_CONFIG_CALL _IOW(VHOST_VIRTIO, 0x77, int)
|
||||
#endif
|
||||
|
|
|
@ -1425,13 +1425,28 @@ static unsigned int type_size(const char *name)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int append(char **buf, const char *delim, const char *str)
|
||||
{
|
||||
char *new_buf;
|
||||
|
||||
new_buf = realloc(*buf, strlen(*buf) + strlen(delim) + strlen(str) + 1);
|
||||
if (!new_buf)
|
||||
return -1;
|
||||
strcat(new_buf, delim);
|
||||
strcat(new_buf, str);
|
||||
*buf = new_buf;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int event_read_fields(struct tep_event *event, struct tep_format_field **fields)
|
||||
{
|
||||
struct tep_format_field *field = NULL;
|
||||
enum tep_event_type type;
|
||||
char *token;
|
||||
char *last_token;
|
||||
char *delim = " ";
|
||||
int count = 0;
|
||||
int ret;
|
||||
|
||||
do {
|
||||
unsigned int size_dynamic = 0;
|
||||
|
@ -1490,24 +1505,51 @@ static int event_read_fields(struct tep_event *event, struct tep_format_field **
|
|||
field->flags |= TEP_FIELD_IS_POINTER;
|
||||
|
||||
if (field->type) {
|
||||
char *new_type;
|
||||
new_type = realloc(field->type,
|
||||
strlen(field->type) +
|
||||
strlen(last_token) + 2);
|
||||
if (!new_type) {
|
||||
free(last_token);
|
||||
goto fail;
|
||||
}
|
||||
field->type = new_type;
|
||||
strcat(field->type, " ");
|
||||
strcat(field->type, last_token);
|
||||
ret = append(&field->type, delim, last_token);
|
||||
free(last_token);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
} else
|
||||
field->type = last_token;
|
||||
last_token = token;
|
||||
delim = " ";
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Handle __attribute__((user)) */
|
||||
if ((type == TEP_EVENT_DELIM) &&
|
||||
strcmp("__attribute__", last_token) == 0 &&
|
||||
token[0] == '(') {
|
||||
int depth = 1;
|
||||
int ret;
|
||||
|
||||
ret = append(&field->type, " ", last_token);
|
||||
ret |= append(&field->type, "", "(");
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
|
||||
delim = " ";
|
||||
while ((type = read_token(&token)) != TEP_EVENT_NONE) {
|
||||
if (type == TEP_EVENT_DELIM) {
|
||||
if (token[0] == '(')
|
||||
depth++;
|
||||
else if (token[0] == ')')
|
||||
depth--;
|
||||
if (!depth)
|
||||
break;
|
||||
ret = append(&field->type, "", token);
|
||||
delim = "";
|
||||
} else {
|
||||
ret = append(&field->type, delim, token);
|
||||
delim = " ";
|
||||
}
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
free(last_token);
|
||||
last_token = token;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1523,8 +1565,6 @@ static int event_read_fields(struct tep_event *event, struct tep_format_field **
|
|||
if (strcmp(token, "[") == 0) {
|
||||
enum tep_event_type last_type = type;
|
||||
char *brackets = token;
|
||||
char *new_brackets;
|
||||
int len;
|
||||
|
||||
field->flags |= TEP_FIELD_IS_ARRAY;
|
||||
|
||||
|
@ -1536,29 +1576,27 @@ static int event_read_fields(struct tep_event *event, struct tep_format_field **
|
|||
field->arraylen = 0;
|
||||
|
||||
while (strcmp(token, "]") != 0) {
|
||||
const char *delim;
|
||||
|
||||
if (last_type == TEP_EVENT_ITEM &&
|
||||
type == TEP_EVENT_ITEM)
|
||||
len = 2;
|
||||
delim = " ";
|
||||
else
|
||||
len = 1;
|
||||
delim = "";
|
||||
|
||||
last_type = type;
|
||||
|
||||
new_brackets = realloc(brackets,
|
||||
strlen(brackets) +
|
||||
strlen(token) + len);
|
||||
if (!new_brackets) {
|
||||
ret = append(&brackets, delim, token);
|
||||
if (ret < 0) {
|
||||
free(brackets);
|
||||
goto fail;
|
||||
}
|
||||
brackets = new_brackets;
|
||||
if (len == 2)
|
||||
strcat(brackets, " ");
|
||||
strcat(brackets, token);
|
||||
/* We only care about the last token */
|
||||
field->arraylen = strtoul(token, NULL, 0);
|
||||
free_token(token);
|
||||
type = read_token(&token);
|
||||
if (type == TEP_EVENT_NONE) {
|
||||
free(brackets);
|
||||
do_warning_event(event, "failed to find token");
|
||||
goto fail;
|
||||
}
|
||||
|
@ -1566,13 +1604,11 @@ static int event_read_fields(struct tep_event *event, struct tep_format_field **
|
|||
|
||||
free_token(token);
|
||||
|
||||
new_brackets = realloc(brackets, strlen(brackets) + 2);
|
||||
if (!new_brackets) {
|
||||
ret = append(&brackets, "", "]");
|
||||
if (ret < 0) {
|
||||
free(brackets);
|
||||
goto fail;
|
||||
}
|
||||
brackets = new_brackets;
|
||||
strcat(brackets, "]");
|
||||
|
||||
/* add brackets to type */
|
||||
|
||||
|
@ -1582,34 +1618,23 @@ static int event_read_fields(struct tep_event *event, struct tep_format_field **
|
|||
* the format: type [] item;
|
||||
*/
|
||||
if (type == TEP_EVENT_ITEM) {
|
||||
char *new_type;
|
||||
new_type = realloc(field->type,
|
||||
strlen(field->type) +
|
||||
strlen(field->name) +
|
||||
strlen(brackets) + 2);
|
||||
if (!new_type) {
|
||||
ret = append(&field->type, " ", field->name);
|
||||
if (ret < 0) {
|
||||
free(brackets);
|
||||
goto fail;
|
||||
}
|
||||
field->type = new_type;
|
||||
strcat(field->type, " ");
|
||||
strcat(field->type, field->name);
|
||||
ret = append(&field->type, "", brackets);
|
||||
|
||||
size_dynamic = type_size(field->name);
|
||||
free_token(field->name);
|
||||
strcat(field->type, brackets);
|
||||
field->name = field->alias = token;
|
||||
type = read_token(&token);
|
||||
} else {
|
||||
char *new_type;
|
||||
new_type = realloc(field->type,
|
||||
strlen(field->type) +
|
||||
strlen(brackets) + 1);
|
||||
if (!new_type) {
|
||||
ret = append(&field->type, "", brackets);
|
||||
if (ret < 0) {
|
||||
free(brackets);
|
||||
goto fail;
|
||||
}
|
||||
field->type = new_type;
|
||||
strcat(field->type, brackets);
|
||||
}
|
||||
free(brackets);
|
||||
}
|
||||
|
@ -2046,19 +2071,16 @@ process_op(struct tep_event *event, struct tep_print_arg *arg, char **tok)
|
|||
/* could just be a type pointer */
|
||||
if ((strcmp(arg->op.op, "*") == 0) &&
|
||||
type == TEP_EVENT_DELIM && (strcmp(token, ")") == 0)) {
|
||||
char *new_atom;
|
||||
int ret;
|
||||
|
||||
if (left->type != TEP_PRINT_ATOM) {
|
||||
do_warning_event(event, "bad pointer type");
|
||||
goto out_free;
|
||||
}
|
||||
new_atom = realloc(left->atom.atom,
|
||||
strlen(left->atom.atom) + 3);
|
||||
if (!new_atom)
|
||||
ret = append(&left->atom.atom, " ", "*");
|
||||
if (ret < 0)
|
||||
goto out_warn_free;
|
||||
|
||||
left->atom.atom = new_atom;
|
||||
strcat(left->atom.atom, " *");
|
||||
free(arg->op.op);
|
||||
*arg = *left;
|
||||
free(left);
|
||||
|
@ -3062,6 +3084,37 @@ err:
|
|||
return TEP_EVENT_ERROR;
|
||||
}
|
||||
|
||||
static enum tep_event_type
|
||||
process_builtin_expect(struct tep_event *event, struct tep_print_arg *arg, char **tok)
|
||||
{
|
||||
enum tep_event_type type;
|
||||
char *token = NULL;
|
||||
|
||||
/* Handle __builtin_expect( cond, #) */
|
||||
type = process_arg(event, arg, &token);
|
||||
|
||||
if (type != TEP_EVENT_DELIM || token[0] != ',')
|
||||
goto out_free;
|
||||
|
||||
free_token(token);
|
||||
|
||||
/* We don't care what the second parameter is of the __builtin_expect() */
|
||||
if (read_expect_type(TEP_EVENT_ITEM, &token) < 0)
|
||||
goto out_free;
|
||||
|
||||
if (read_expected(TEP_EVENT_DELIM, ")") < 0)
|
||||
goto out_free;
|
||||
|
||||
free_token(token);
|
||||
type = read_token_item(tok);
|
||||
return type;
|
||||
|
||||
out_free:
|
||||
free_token(token);
|
||||
*tok = NULL;
|
||||
return TEP_EVENT_ERROR;
|
||||
}
|
||||
|
||||
static enum tep_event_type
|
||||
process_function(struct tep_event *event, struct tep_print_arg *arg,
|
||||
char *token, char **tok)
|
||||
|
@ -3106,6 +3159,10 @@ process_function(struct tep_event *event, struct tep_print_arg *arg,
|
|||
free_token(token);
|
||||
return process_dynamic_array_len(event, arg, tok);
|
||||
}
|
||||
if (strcmp(token, "__builtin_expect") == 0) {
|
||||
free_token(token);
|
||||
return process_builtin_expect(event, arg, tok);
|
||||
}
|
||||
|
||||
func = find_func_handler(event->tep, token);
|
||||
if (func) {
|
||||
|
@ -3151,18 +3208,15 @@ process_arg_token(struct tep_event *event, struct tep_print_arg *arg,
|
|||
}
|
||||
/* atoms can be more than one token long */
|
||||
while (type == TEP_EVENT_ITEM) {
|
||||
char *new_atom;
|
||||
new_atom = realloc(atom,
|
||||
strlen(atom) + strlen(token) + 2);
|
||||
if (!new_atom) {
|
||||
int ret;
|
||||
|
||||
ret = append(&atom, " ", token);
|
||||
if (ret < 0) {
|
||||
free(atom);
|
||||
*tok = NULL;
|
||||
free_token(token);
|
||||
return TEP_EVENT_ERROR;
|
||||
}
|
||||
atom = new_atom;
|
||||
strcat(atom, " ");
|
||||
strcat(atom, token);
|
||||
free_token(token);
|
||||
type = read_token_item(&token);
|
||||
}
|
||||
|
|
|
@ -396,6 +396,18 @@ else
|
|||
NO_LIBBPF := 1
|
||||
NO_JVMTI := 1
|
||||
else
|
||||
ifneq ($(filter s% -fsanitize=address%,$(EXTRA_CFLAGS),),)
|
||||
ifneq ($(shell ldconfig -p | grep libasan >/dev/null 2>&1; echo $$?), 0)
|
||||
msg := $(error No libasan found, please install libasan);
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(filter s% -fsanitize=undefined%,$(EXTRA_CFLAGS),),)
|
||||
ifneq ($(shell ldconfig -p | grep libubsan >/dev/null 2>&1; echo $$?), 0)
|
||||
msg := $(error No libubsan found, please install libubsan);
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(filter s% -static%,$(LDFLAGS),),)
|
||||
msg := $(error No static glibc found, please install glibc-static);
|
||||
else
|
||||
|
|
|
@ -359,6 +359,7 @@
|
|||
435 common clone3 sys_clone3
|
||||
437 common openat2 sys_openat2
|
||||
438 common pidfd_getfd sys_pidfd_getfd
|
||||
439 common faccessat2 sys_faccessat2
|
||||
|
||||
#
|
||||
# x32-specific system call numbers start at 512 to avoid cache impact
|
||||
|
|
|
@ -478,8 +478,7 @@ static size_t hists__fprintf_nr_sample_events(struct hists *hists, struct report
|
|||
if (rep->time_str)
|
||||
ret += fprintf(fp, " (time slices: %s)", rep->time_str);
|
||||
|
||||
if (symbol_conf.show_ref_callgraph &&
|
||||
strstr(evname, "call-graph=no")) {
|
||||
if (symbol_conf.show_ref_callgraph && evname && strstr(evname, "call-graph=no")) {
|
||||
ret += fprintf(fp, ", show reference callgraph");
|
||||
}
|
||||
|
||||
|
|
|
@ -3837,6 +3837,9 @@ int cmd_script(int argc, const char **argv)
|
|||
if (err)
|
||||
goto out_delete;
|
||||
|
||||
if (zstd_init(&(session->zstd_data), 0) < 0)
|
||||
pr_warning("Decompression initialization failed. Reported data may be incomplete.\n");
|
||||
|
||||
err = __cmd_script(&script);
|
||||
|
||||
flush_scripting();
|
||||
|
|
|
@ -65,6 +65,7 @@ size_t syscall_arg__scnprintf_statx_mask(char *bf, size_t size, struct syscall_a
|
|||
P_FLAG(SIZE);
|
||||
P_FLAG(BLOCKS);
|
||||
P_FLAG(BTIME);
|
||||
P_FLAG(MNT_ID);
|
||||
|
||||
#undef P_FLAG
|
||||
|
||||
|
|
|
@ -142,7 +142,8 @@ static int
|
|||
gen_read_mem(struct bpf_insn_pos *pos,
|
||||
int src_base_addr_reg,
|
||||
int dst_addr_reg,
|
||||
long offset)
|
||||
long offset,
|
||||
int probeid)
|
||||
{
|
||||
/* mov arg3, src_base_addr_reg */
|
||||
if (src_base_addr_reg != BPF_REG_ARG3)
|
||||
|
@ -159,7 +160,7 @@ gen_read_mem(struct bpf_insn_pos *pos,
|
|||
ins(BPF_MOV64_REG(BPF_REG_ARG1, dst_addr_reg), pos);
|
||||
|
||||
/* Call probe_read */
|
||||
ins(BPF_EMIT_CALL(BPF_FUNC_probe_read), pos);
|
||||
ins(BPF_EMIT_CALL(probeid), pos);
|
||||
/*
|
||||
* Error processing: if read fail, goto error code,
|
||||
* will be relocated. Target should be the start of
|
||||
|
@ -241,7 +242,7 @@ static int
|
|||
gen_prologue_slowpath(struct bpf_insn_pos *pos,
|
||||
struct probe_trace_arg *args, int nargs)
|
||||
{
|
||||
int err, i;
|
||||
int err, i, probeid;
|
||||
|
||||
for (i = 0; i < nargs; i++) {
|
||||
struct probe_trace_arg *arg = &args[i];
|
||||
|
@ -276,11 +277,16 @@ gen_prologue_slowpath(struct bpf_insn_pos *pos,
|
|||
stack_offset), pos);
|
||||
|
||||
ref = arg->ref;
|
||||
probeid = BPF_FUNC_probe_read_kernel;
|
||||
while (ref) {
|
||||
pr_debug("prologue: arg %d: offset %ld\n",
|
||||
i, ref->offset);
|
||||
|
||||
if (ref->user_access)
|
||||
probeid = BPF_FUNC_probe_read_user;
|
||||
|
||||
err = gen_read_mem(pos, BPF_REG_3, BPF_REG_7,
|
||||
ref->offset);
|
||||
ref->offset, probeid);
|
||||
if (err) {
|
||||
pr_err("prologue: failed to generate probe_read function call\n");
|
||||
goto errout;
|
||||
|
|
|
@ -26,7 +26,7 @@ do { \
|
|||
YYABORT; \
|
||||
} while (0)
|
||||
|
||||
static struct list_head* alloc_list()
|
||||
static struct list_head* alloc_list(void)
|
||||
{
|
||||
struct list_head *list;
|
||||
|
||||
|
@ -349,7 +349,7 @@ PE_PMU_EVENT_PRE '-' PE_PMU_EVENT_SUF sep_dc
|
|||
struct list_head *list;
|
||||
char pmu_name[128];
|
||||
|
||||
snprintf(&pmu_name, 128, "%s-%s", $1, $3);
|
||||
snprintf(pmu_name, sizeof(pmu_name), "%s-%s", $1, $3);
|
||||
free($1);
|
||||
free($3);
|
||||
if (parse_events_multi_pmu_add(_parse_state, pmu_name, &list) < 0)
|
||||
|
|
|
@ -86,7 +86,6 @@ int perf_pmu__check_alias(struct perf_pmu *pmu, struct list_head *head_terms,
|
|||
struct perf_pmu_info *info);
|
||||
struct list_head *perf_pmu__alias(struct perf_pmu *pmu,
|
||||
struct list_head *head_terms);
|
||||
int perf_pmu_wrap(void);
|
||||
void perf_pmu_error(struct list_head *list, char *name, char const *msg);
|
||||
|
||||
int perf_pmu__new_format(struct list_head *list, char *name,
|
||||
|
|
|
@ -1575,7 +1575,7 @@ static int parse_perf_probe_arg(char *str, struct perf_probe_arg *arg)
|
|||
}
|
||||
|
||||
tmp = strchr(str, '@');
|
||||
if (tmp && tmp != str && strcmp(tmp + 1, "user")) { /* user attr */
|
||||
if (tmp && tmp != str && !strcmp(tmp + 1, "user")) { /* user attr */
|
||||
if (!user_access_is_supported()) {
|
||||
semantic_error("ftrace does not support user access\n");
|
||||
return -EINVAL;
|
||||
|
@ -1995,7 +1995,10 @@ static int __synthesize_probe_trace_arg_ref(struct probe_trace_arg_ref *ref,
|
|||
if (depth < 0)
|
||||
return depth;
|
||||
}
|
||||
err = strbuf_addf(buf, "%+ld(", ref->offset);
|
||||
if (ref->user_access)
|
||||
err = strbuf_addf(buf, "%s%ld(", "+u", ref->offset);
|
||||
else
|
||||
err = strbuf_addf(buf, "%+ld(", ref->offset);
|
||||
return (err < 0) ? err : depth;
|
||||
}
|
||||
|
||||
|
|
|
@ -1044,7 +1044,7 @@ static struct {
|
|||
DEFINE_TYPE(FTRACE_README_PROBE_TYPE_X, "*type: * x8/16/32/64,*"),
|
||||
DEFINE_TYPE(FTRACE_README_KRETPROBE_OFFSET, "*place (kretprobe): *"),
|
||||
DEFINE_TYPE(FTRACE_README_UPROBE_REF_CTR, "*ref_ctr_offset*"),
|
||||
DEFINE_TYPE(FTRACE_README_USER_ACCESS, "*[u]<offset>*"),
|
||||
DEFINE_TYPE(FTRACE_README_USER_ACCESS, "*u]<offset>*"),
|
||||
DEFINE_TYPE(FTRACE_README_MULTIPROBE_EVENT, "*Create/append/*"),
|
||||
DEFINE_TYPE(FTRACE_README_IMMEDIATE_VALUE, "*\\imm-value,*"),
|
||||
};
|
||||
|
|
|
@ -668,7 +668,7 @@ static void print_aggr(struct perf_stat_config *config,
|
|||
int s;
|
||||
bool first;
|
||||
|
||||
if (!(config->aggr_map || config->aggr_get_id))
|
||||
if (!config->aggr_map || !config->aggr_get_id)
|
||||
return;
|
||||
|
||||
aggr_update_shadow(config, evlist);
|
||||
|
@ -1169,7 +1169,7 @@ static void print_percore(struct perf_stat_config *config,
|
|||
int s;
|
||||
bool first = true;
|
||||
|
||||
if (!(config->aggr_map || config->aggr_get_id))
|
||||
if (!config->aggr_map || !config->aggr_get_id)
|
||||
return;
|
||||
|
||||
if (config->percore_show_thread)
|
||||
|
|
Loading…
Reference in a new issue