diff options
Diffstat (limited to 'tools/perf')
411 files changed, 539 insertions, 176 deletions
diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt index e397453e5a46..63526f4416ea 100644 --- a/tools/perf/Documentation/perf-record.txt +++ b/tools/perf/Documentation/perf-record.txt @@ -8,8 +8,8 @@ perf-record - Run a command and record its profile into perf.data SYNOPSIS -------- [verse] -'perf record' [-e <EVENT> | --event=EVENT] [-l] [-a] <command> -'perf record' [-e <EVENT> | --event=EVENT] [-l] [-a] -- <command> [<options>] +'perf record' [-e <EVENT> | --event=EVENT] [-a] <command> +'perf record' [-e <EVENT> | --event=EVENT] [-a] -- <command> [<options>] DESCRIPTION ----------- diff --git a/tools/perf/MANIFEST b/tools/perf/MANIFEST index 62072822dc85..627b7cada144 100644 --- a/tools/perf/MANIFEST +++ b/tools/perf/MANIFEST @@ -1,34 +1,8 @@ tools/perf -tools/arch/alpha/include/asm/barrier.h -tools/arch/arm/include/asm/barrier.h -tools/arch/arm64/include/asm/barrier.h -tools/arch/ia64/include/asm/barrier.h -tools/arch/mips/include/asm/barrier.h -tools/arch/powerpc/include/asm/barrier.h -tools/arch/s390/include/asm/barrier.h -tools/arch/sh/include/asm/barrier.h -tools/arch/sparc/include/asm/barrier.h -tools/arch/sparc/include/asm/barrier_32.h -tools/arch/sparc/include/asm/barrier_64.h -tools/arch/tile/include/asm/barrier.h -tools/arch/x86/include/asm/barrier.h -tools/arch/x86/include/asm/cmpxchg.h -tools/arch/x86/include/asm/cpufeatures.h -tools/arch/x86/include/asm/disabled-features.h -tools/arch/x86/include/asm/required-features.h -tools/arch/x86/include/uapi/asm/svm.h -tools/arch/x86/include/uapi/asm/vmx.h -tools/arch/x86/include/uapi/asm/kvm.h -tools/arch/x86/include/uapi/asm/kvm_perf.h -tools/arch/x86/lib/memcpy_64.S -tools/arch/x86/lib/memset_64.S -tools/arch/s390/include/uapi/asm/kvm_perf.h -tools/arch/s390/include/uapi/asm/sie.h -tools/arch/xtensa/include/asm/barrier.h +tools/arch tools/scripts tools/build -tools/arch/x86/include/asm/atomic.h -tools/arch/x86/include/asm/rmwcc.h +tools/include tools/lib/traceevent tools/lib/api tools/lib/bpf @@ -42,60 +16,3 @@ tools/lib/find_bit.c tools/lib/bitmap.c tools/lib/str_error_r.c tools/lib/vsprintf.c -tools/include/asm/alternative-asm.h -tools/include/asm/atomic.h -tools/include/asm/barrier.h -tools/include/asm/bug.h -tools/include/asm-generic/atomic-gcc.h -tools/include/asm-generic/barrier.h -tools/include/asm-generic/bitops/arch_hweight.h -tools/include/asm-generic/bitops/atomic.h -tools/include/asm-generic/bitops/const_hweight.h -tools/include/asm-generic/bitops/__ffs.h -tools/include/asm-generic/bitops/__ffz.h -tools/include/asm-generic/bitops/__fls.h -tools/include/asm-generic/bitops/find.h -tools/include/asm-generic/bitops/fls64.h -tools/include/asm-generic/bitops/fls.h -tools/include/asm-generic/bitops/hweight.h -tools/include/asm-generic/bitops.h -tools/include/linux/atomic.h -tools/include/linux/bitops.h -tools/include/linux/compiler.h -tools/include/linux/compiler-gcc.h -tools/include/linux/coresight-pmu.h -tools/include/linux/bug.h -tools/include/linux/filter.h -tools/include/linux/hash.h -tools/include/linux/kernel.h -tools/include/linux/list.h -tools/include/linux/log2.h -tools/include/uapi/asm-generic/fcntl.h -tools/include/uapi/asm-generic/ioctls.h -tools/include/uapi/asm-generic/mman-common.h -tools/include/uapi/asm-generic/mman.h -tools/include/uapi/drm/drm.h -tools/include/uapi/drm/i915_drm.h -tools/include/uapi/linux/bpf.h -tools/include/uapi/linux/bpf_common.h -tools/include/uapi/linux/fcntl.h -tools/include/uapi/linux/hw_breakpoint.h -tools/include/uapi/linux/kvm.h -tools/include/uapi/linux/mman.h -tools/include/uapi/linux/perf_event.h -tools/include/uapi/linux/sched.h -tools/include/uapi/linux/stat.h -tools/include/uapi/linux/vhost.h -tools/include/uapi/sound/asound.h -tools/include/linux/poison.h -tools/include/linux/rbtree.h -tools/include/linux/rbtree_augmented.h -tools/include/linux/refcount.h -tools/include/linux/string.h -tools/include/linux/stringify.h -tools/include/linux/types.h -tools/include/linux/err.h -tools/include/linux/bitmap.h -tools/include/linux/time64.h -tools/arch/*/include/uapi/asm/mman.h -tools/arch/*/include/uapi/asm/perf_regs.h diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 32a64e619028..225454416ed5 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 # # This is a simple wrapper Makefile that calls the main Makefile.perf # with a -j option to do parallel builds diff --git a/tools/perf/arch/arm/annotate/instructions.c b/tools/perf/arch/arm/annotate/instructions.c index 1ce0872b1726..b39b16395aac 100644 --- a/tools/perf/arch/arm/annotate/instructions.c +++ b/tools/perf/arch/arm/annotate/instructions.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <sys/types.h> #include <regex.h> diff --git a/tools/perf/arch/arm/include/dwarf-regs-table.h b/tools/perf/arch/arm/include/dwarf-regs-table.h index f298d034c37b..5a45046fab72 100644 --- a/tools/perf/arch/arm/include/dwarf-regs-table.h +++ b/tools/perf/arch/arm/include/dwarf-regs-table.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifdef DEFINE_DWARF_REGSTR_TABLE /* This is included in perf/util/dwarf-regs.c */ diff --git a/tools/perf/arch/arm/include/perf_regs.h b/tools/perf/arch/arm/include/perf_regs.h index f619c9c5a4bf..ed20e0253e25 100644 --- a/tools/perf/arch/arm/include/perf_regs.h +++ b/tools/perf/arch/arm/include/perf_regs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef ARCH_PERF_REGS_H #define ARCH_PERF_REGS_H diff --git a/tools/perf/arch/arm/tests/dwarf-unwind.c b/tools/perf/arch/arm/tests/dwarf-unwind.c index 62eff847f91c..8cb347760233 100644 --- a/tools/perf/arch/arm/tests/dwarf-unwind.c +++ b/tools/perf/arch/arm/tests/dwarf-unwind.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <string.h> #include "perf_regs.h" #include "thread.h" diff --git a/tools/perf/arch/arm/tests/regs_load.S b/tools/perf/arch/arm/tests/regs_load.S index e09e983946fe..6e2495cc4517 100644 --- a/tools/perf/arch/arm/tests/regs_load.S +++ b/tools/perf/arch/arm/tests/regs_load.S @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #include <linux/linkage.h> #define R0 0x00 diff --git a/tools/perf/arch/arm/util/unwind-libdw.c b/tools/perf/arch/arm/util/unwind-libdw.c index bacfa00fca39..36ba4c69c3c5 100644 --- a/tools/perf/arch/arm/util/unwind-libdw.c +++ b/tools/perf/arch/arm/util/unwind-libdw.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <elfutils/libdwfl.h> #include "../../util/unwind-libdw.h" #include "../../util/perf_regs.h" diff --git a/tools/perf/arch/arm/util/unwind-libunwind.c b/tools/perf/arch/arm/util/unwind-libunwind.c index 62c397ed3d97..3a550225dfaf 100644 --- a/tools/perf/arch/arm/util/unwind-libunwind.c +++ b/tools/perf/arch/arm/util/unwind-libunwind.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <errno.h> #include <libunwind.h> diff --git a/tools/perf/arch/arm64/Makefile b/tools/perf/arch/arm64/Makefile index eebe1ec9d2ee..91de4860faad 100644 --- a/tools/perf/arch/arm64/Makefile +++ b/tools/perf/arch/arm64/Makefile @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 ifndef NO_DWARF PERF_HAVE_DWARF_REGS := 1 endif diff --git a/tools/perf/arch/arm64/annotate/instructions.c b/tools/perf/arch/arm64/annotate/instructions.c index 8f1908756cb6..9a3e0523e2c9 100644 --- a/tools/perf/arch/arm64/annotate/instructions.c +++ b/tools/perf/arch/arm64/annotate/instructions.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <sys/types.h> #include <regex.h> diff --git a/tools/perf/arch/arm64/include/dwarf-regs-table.h b/tools/perf/arch/arm64/include/dwarf-regs-table.h index 36e375f5a211..177b2855f797 100644 --- a/tools/perf/arch/arm64/include/dwarf-regs-table.h +++ b/tools/perf/arch/arm64/include/dwarf-regs-table.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifdef DEFINE_DWARF_REGSTR_TABLE /* This is included in perf/util/dwarf-regs.c */ diff --git a/tools/perf/arch/arm64/include/perf_regs.h b/tools/perf/arch/arm64/include/perf_regs.h index 4e5af27e3fbf..baaa5e64a3fb 100644 --- a/tools/perf/arch/arm64/include/perf_regs.h +++ b/tools/perf/arch/arm64/include/perf_regs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef ARCH_PERF_REGS_H #define ARCH_PERF_REGS_H diff --git a/tools/perf/arch/arm64/tests/dwarf-unwind.c b/tools/perf/arch/arm64/tests/dwarf-unwind.c index cf04a4c91c59..e907f0f4c20c 100644 --- a/tools/perf/arch/arm64/tests/dwarf-unwind.c +++ b/tools/perf/arch/arm64/tests/dwarf-unwind.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <string.h> #include "perf_regs.h" #include "thread.h" diff --git a/tools/perf/arch/arm64/tests/regs_load.S b/tools/perf/arch/arm64/tests/regs_load.S index 025b46e579a6..07042511dca9 100644 --- a/tools/perf/arch/arm64/tests/regs_load.S +++ b/tools/perf/arch/arm64/tests/regs_load.S @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #include <linux/linkage.h> .text diff --git a/tools/perf/arch/arm64/util/unwind-libunwind.c b/tools/perf/arch/arm64/util/unwind-libunwind.c index b415dfdbccca..002520d4036b 100644 --- a/tools/perf/arch/arm64/util/unwind-libunwind.c +++ b/tools/perf/arch/arm64/util/unwind-libunwind.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <errno.h> #ifndef REMOTE_UNWIND_LIBUNWIND diff --git a/tools/perf/arch/common.c b/tools/perf/arch/common.c index 6b40e9f01740..8c0cfeb55f8e 100644 --- a/tools/perf/arch/common.c +++ b/tools/perf/arch/common.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <stdio.h> #include <sys/utsname.h> #include "common.h" diff --git a/tools/perf/arch/common.h b/tools/perf/arch/common.h index 6b01c736b7d9..a1546509ad24 100644 --- a/tools/perf/arch/common.h +++ b/tools/perf/arch/common.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef ARCH_PERF_COMMON_H #define ARCH_PERF_COMMON_H diff --git a/tools/perf/arch/powerpc/Makefile b/tools/perf/arch/powerpc/Makefile index cc3930904d68..42dab7c8f508 100644 --- a/tools/perf/arch/powerpc/Makefile +++ b/tools/perf/arch/powerpc/Makefile @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 ifndef NO_DWARF PERF_HAVE_DWARF_REGS := 1 endif diff --git a/tools/perf/arch/powerpc/annotate/instructions.c b/tools/perf/arch/powerpc/annotate/instructions.c index 3c4004db81b9..b7bc04980fe8 100644 --- a/tools/perf/arch/powerpc/annotate/instructions.c +++ b/tools/perf/arch/powerpc/annotate/instructions.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 static struct ins_ops *powerpc__associate_instruction_ops(struct arch *arch, const char *name) { int i; diff --git a/tools/perf/arch/powerpc/include/arch-tests.h b/tools/perf/arch/powerpc/include/arch-tests.h index 84d8dedef2ed..1c7be75cbc78 100644 --- a/tools/perf/arch/powerpc/include/arch-tests.h +++ b/tools/perf/arch/powerpc/include/arch-tests.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef ARCH_TESTS_H #define ARCH_TESTS_H diff --git a/tools/perf/arch/powerpc/include/dwarf-regs-table.h b/tools/perf/arch/powerpc/include/dwarf-regs-table.h index db4730f5585c..66dc015a733d 100644 --- a/tools/perf/arch/powerpc/include/dwarf-regs-table.h +++ b/tools/perf/arch/powerpc/include/dwarf-regs-table.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifdef DEFINE_DWARF_REGSTR_TABLE /* This is included in perf/util/dwarf-regs.c */ diff --git a/tools/perf/arch/powerpc/include/perf_regs.h b/tools/perf/arch/powerpc/include/perf_regs.h index c12f4e804f66..00e37b106913 100644 --- a/tools/perf/arch/powerpc/include/perf_regs.h +++ b/tools/perf/arch/powerpc/include/perf_regs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef ARCH_PERF_REGS_H #define ARCH_PERF_REGS_H diff --git a/tools/perf/arch/powerpc/tests/arch-tests.c b/tools/perf/arch/powerpc/tests/arch-tests.c index e24f46241f40..8c3fbd4af817 100644 --- a/tools/perf/arch/powerpc/tests/arch-tests.c +++ b/tools/perf/arch/powerpc/tests/arch-tests.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <string.h> #include "tests/tests.h" #include "arch-tests.h" diff --git a/tools/perf/arch/powerpc/tests/dwarf-unwind.c b/tools/perf/arch/powerpc/tests/dwarf-unwind.c index 0bac3137ccbd..30cbbd6d5be0 100644 --- a/tools/perf/arch/powerpc/tests/dwarf-unwind.c +++ b/tools/perf/arch/powerpc/tests/dwarf-unwind.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <string.h> #include "perf_regs.h" #include "thread.h" diff --git a/tools/perf/arch/powerpc/tests/regs_load.S b/tools/perf/arch/powerpc/tests/regs_load.S index d76c9a32f327..36a20b0033f9 100644 --- a/tools/perf/arch/powerpc/tests/regs_load.S +++ b/tools/perf/arch/powerpc/tests/regs_load.S @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #include <linux/linkage.h> /* Offset is based on macros from arch/powerpc/include/uapi/asm/ptrace.h. */ diff --git a/tools/perf/arch/powerpc/util/book3s_hcalls.h b/tools/perf/arch/powerpc/util/book3s_hcalls.h index 0dd6b7f2d44f..54cfa0530e86 100644 --- a/tools/perf/arch/powerpc/util/book3s_hcalls.h +++ b/tools/perf/arch/powerpc/util/book3s_hcalls.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef ARCH_PERF_BOOK3S_HV_HCALLS_H #define ARCH_PERF_BOOK3S_HV_HCALLS_H diff --git a/tools/perf/arch/powerpc/util/book3s_hv_exits.h b/tools/perf/arch/powerpc/util/book3s_hv_exits.h index e68ba2da8970..853b95d1e139 100644 --- a/tools/perf/arch/powerpc/util/book3s_hv_exits.h +++ b/tools/perf/arch/powerpc/util/book3s_hv_exits.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef ARCH_PERF_BOOK3S_HV_EXITS_H #define ARCH_PERF_BOOK3S_HV_EXITS_H diff --git a/tools/perf/arch/powerpc/util/header.c b/tools/perf/arch/powerpc/util/header.c index 9aaa6f5a9347..7a4cf80c207a 100644 --- a/tools/perf/arch/powerpc/util/header.c +++ b/tools/perf/arch/powerpc/util/header.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <sys/types.h> #include <unistd.h> #include <stdio.h> diff --git a/tools/perf/arch/powerpc/util/kvm-stat.c b/tools/perf/arch/powerpc/util/kvm-stat.c index 249723f0e6a9..596ad6aedaac 100644 --- a/tools/perf/arch/powerpc/util/kvm-stat.c +++ b/tools/perf/arch/powerpc/util/kvm-stat.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <errno.h> #include "util/kvm-stat.h" #include "util/parse-events.h" diff --git a/tools/perf/arch/powerpc/util/perf_regs.c b/tools/perf/arch/powerpc/util/perf_regs.c index f860dc411f69..ec50939b0418 100644 --- a/tools/perf/arch/powerpc/util/perf_regs.c +++ b/tools/perf/arch/powerpc/util/perf_regs.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <errno.h> #include <string.h> #include <regex.h> diff --git a/tools/perf/arch/powerpc/util/unwind-libdw.c b/tools/perf/arch/powerpc/util/unwind-libdw.c index 3a24b3c43273..7a1f05ef2fc0 100644 --- a/tools/perf/arch/powerpc/util/unwind-libdw.c +++ b/tools/perf/arch/powerpc/util/unwind-libdw.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <elfutils/libdwfl.h> #include "../../util/unwind-libdw.h" #include "../../util/perf_regs.h" diff --git a/tools/perf/arch/s390/annotate/instructions.c b/tools/perf/arch/s390/annotate/instructions.c index 745b4b1b8b21..c9a81673e8aa 100644 --- a/tools/perf/arch/s390/annotate/instructions.c +++ b/tools/perf/arch/s390/annotate/instructions.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 static struct ins_ops *s390__associate_ins_ops(struct arch *arch, const char *name) { struct ins_ops *ops = NULL; diff --git a/tools/perf/arch/s390/include/dwarf-regs-table.h b/tools/perf/arch/s390/include/dwarf-regs-table.h index 9da74a933bd6..792d4c277225 100644 --- a/tools/perf/arch/s390/include/dwarf-regs-table.h +++ b/tools/perf/arch/s390/include/dwarf-regs-table.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifdef DEFINE_DWARF_REGSTR_TABLE /* This is included in perf/util/dwarf-regs.c */ diff --git a/tools/perf/arch/s390/util/Build b/tools/perf/arch/s390/util/Build index bd518b623d7a..5bd7b9260cc0 100644 --- a/tools/perf/arch/s390/util/Build +++ b/tools/perf/arch/s390/util/Build @@ -1,5 +1,4 @@ libperf-y += header.o -libperf-y += sym-handling.o libperf-y += kvm-stat.o libperf-$(CONFIG_DWARF) += dwarf-regs.o diff --git a/tools/perf/arch/s390/util/dwarf-regs.c b/tools/perf/arch/s390/util/dwarf-regs.c index 0469df02ee62..0dff5b2ed1e5 100644 --- a/tools/perf/arch/s390/util/dwarf-regs.c +++ b/tools/perf/arch/s390/util/dwarf-regs.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Mapping of DWARF debug register numbers into register names. * diff --git a/tools/perf/arch/s390/util/machine.c b/tools/perf/arch/s390/util/machine.c index b9a95a1a8e69..0b2054007314 100644 --- a/tools/perf/arch/s390/util/machine.c +++ b/tools/perf/arch/s390/util/machine.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <unistd.h> #include <stdio.h> #include <string.h> diff --git a/tools/perf/arch/s390/util/sym-handling.c b/tools/perf/arch/s390/util/sym-handling.c deleted file mode 100644 index e103f6e46afe..000000000000 --- a/tools/perf/arch/s390/util/sym-handling.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Architecture specific ELF symbol handling and relocation mapping. - * - * Copyright 2017 IBM Corp. - * Author(s): Thomas Richter <tmricht@linux.vnet.ibm.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License (version 2 only) - * as published by the Free Software Foundation. - */ - -#include "symbol.h" - -#ifdef HAVE_LIBELF_SUPPORT -bool elf__needs_adjust_symbols(GElf_Ehdr ehdr) -{ - if (ehdr.e_type == ET_EXEC) - return false; - return ehdr.e_type == ET_REL || ehdr.e_type == ET_DYN; -} - -void arch__adjust_sym_map_offset(GElf_Sym *sym, - GElf_Shdr *shdr __maybe_unused, - struct map *map) -{ - if (map->type == MAP__FUNCTION) - sym->st_value += map->start; -} -#endif diff --git a/tools/perf/arch/sh/include/dwarf-regs-table.h b/tools/perf/arch/sh/include/dwarf-regs-table.h index 3a2deaf3dab4..900e69619970 100644 --- a/tools/perf/arch/sh/include/dwarf-regs-table.h +++ b/tools/perf/arch/sh/include/dwarf-regs-table.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifdef DEFINE_DWARF_REGSTR_TABLE /* This is included in perf/util/dwarf-regs.c */ diff --git a/tools/perf/arch/sparc/include/dwarf-regs-table.h b/tools/perf/arch/sparc/include/dwarf-regs-table.h index 12c07619002c..35ede84a6b0d 100644 --- a/tools/perf/arch/sparc/include/dwarf-regs-table.h +++ b/tools/perf/arch/sparc/include/dwarf-regs-table.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifdef DEFINE_DWARF_REGSTR_TABLE /* This is included in perf/util/dwarf-regs.c */ diff --git a/tools/perf/arch/x86/Makefile b/tools/perf/arch/x86/Makefile index 9a628a24c5c9..d74eaa7aa927 100644 --- a/tools/perf/arch/x86/Makefile +++ b/tools/perf/arch/x86/Makefile @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 ifndef NO_DWARF PERF_HAVE_DWARF_REGS := 1 endif diff --git a/tools/perf/arch/x86/annotate/instructions.c b/tools/perf/arch/x86/annotate/instructions.c index d84b72063a30..4adfb4ce2864 100644 --- a/tools/perf/arch/x86/annotate/instructions.c +++ b/tools/perf/arch/x86/annotate/instructions.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 static struct ins x86__instructions[] = { { .name = "add", .ops = &mov_ops, }, { .name = "addl", .ops = &mov_ops, }, diff --git a/tools/perf/arch/x86/entry/syscalls/syscalltbl.sh b/tools/perf/arch/x86/entry/syscalls/syscalltbl.sh index 49a18b9ad9cf..029a72c20b19 100755 --- a/tools/perf/arch/x86/entry/syscalls/syscalltbl.sh +++ b/tools/perf/arch/x86/entry/syscalls/syscalltbl.sh @@ -1,4 +1,5 @@ #!/bin/sh +# SPDX-License-Identifier: GPL-2.0 in="$1" arch="$2" diff --git a/tools/perf/arch/x86/include/arch-tests.h b/tools/perf/arch/x86/include/arch-tests.h index 4e0b806a7a0f..9834fdc7c59e 100644 --- a/tools/perf/arch/x86/include/arch-tests.h +++ b/tools/perf/arch/x86/include/arch-tests.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef ARCH_TESTS_H #define ARCH_TESTS_H diff --git a/tools/perf/arch/x86/include/dwarf-regs-table.h b/tools/perf/arch/x86/include/dwarf-regs-table.h index 9b5e5cbb4209..b9bd5dc9d4c0 100644 --- a/tools/perf/arch/x86/include/dwarf-regs-table.h +++ b/tools/perf/arch/x86/include/dwarf-regs-table.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifdef DEFINE_DWARF_REGSTR_TABLE /* This is included in perf/util/dwarf-regs.c */ diff --git a/tools/perf/arch/x86/include/perf_regs.h b/tools/perf/arch/x86/include/perf_regs.h index 7df517acfef8..7f6d538f8a89 100644 --- a/tools/perf/arch/x86/include/perf_regs.h +++ b/tools/perf/arch/x86/include/perf_regs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef ARCH_PERF_REGS_H #define ARCH_PERF_REGS_H diff --git a/tools/perf/arch/x86/tests/arch-tests.c b/tools/perf/arch/x86/tests/arch-tests.c index 99d66191e56c..34a078136a47 100644 --- a/tools/perf/arch/x86/tests/arch-tests.c +++ b/tools/perf/arch/x86/tests/arch-tests.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <string.h> #include "tests/tests.h" #include "arch-tests.h" diff --git a/tools/perf/arch/x86/tests/dwarf-unwind.c b/tools/perf/arch/x86/tests/dwarf-unwind.c index 7f209ce827bf..95036c7a59e8 100644 --- a/tools/perf/arch/x86/tests/dwarf-unwind.c +++ b/tools/perf/arch/x86/tests/dwarf-unwind.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <string.h> #include "perf_regs.h" #include "thread.h" diff --git a/tools/perf/arch/x86/tests/insn-x86-dat-32.c b/tools/perf/arch/x86/tests/insn-x86-dat-32.c index 3cbf6fad169f..fab3c6de73fa 100644 --- a/tools/perf/arch/x86/tests/insn-x86-dat-32.c +++ b/tools/perf/arch/x86/tests/insn-x86-dat-32.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Generated by gen-insn-x86-dat.sh and gen-insn-x86-dat.awk * from insn-x86-dat-src.c for inclusion by insn-x86.c diff --git a/tools/perf/arch/x86/tests/insn-x86-dat-64.c b/tools/perf/arch/x86/tests/insn-x86-dat-64.c index aa512fa944dd..c57f34603b9b 100644 --- a/tools/perf/arch/x86/tests/insn-x86-dat-64.c +++ b/tools/perf/arch/x86/tests/insn-x86-dat-64.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Generated by gen-insn-x86-dat.sh and gen-insn-x86-dat.awk * from insn-x86-dat-src.c for inclusion by insn-x86.c diff --git a/tools/perf/arch/x86/tests/insn-x86-dat-src.c b/tools/perf/arch/x86/tests/insn-x86-dat-src.c index 6cdb65d25b79..891415b10984 100644 --- a/tools/perf/arch/x86/tests/insn-x86-dat-src.c +++ b/tools/perf/arch/x86/tests/insn-x86-dat-src.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * This file contains instructions for testing by the test titled: * diff --git a/tools/perf/arch/x86/tests/insn-x86.c b/tools/perf/arch/x86/tests/insn-x86.c index b3860586a0c2..a5d24ae5810d 100644 --- a/tools/perf/arch/x86/tests/insn-x86.c +++ b/tools/perf/arch/x86/tests/insn-x86.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <linux/types.h> #include "debug.h" diff --git a/tools/perf/arch/x86/tests/intel-cqm.c b/tools/perf/arch/x86/tests/intel-cqm.c index 57f86b6e7d6f..90a4a8c58a62 100644 --- a/tools/perf/arch/x86/tests/intel-cqm.c +++ b/tools/perf/arch/x86/tests/intel-cqm.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "tests/tests.h" #include "perf.h" #include "cloexec.h" diff --git a/tools/perf/arch/x86/tests/perf-time-to-tsc.c b/tools/perf/arch/x86/tests/perf-time-to-tsc.c index 5dd7efb192ce..b59678e8c1e2 100644 --- a/tools/perf/arch/x86/tests/perf-time-to-tsc.c +++ b/tools/perf/arch/x86/tests/perf-time-to-tsc.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <errno.h> #include <inttypes.h> #include <stdio.h> diff --git a/tools/perf/arch/x86/tests/rdpmc.c b/tools/perf/arch/x86/tests/rdpmc.c index 17fec30a0b31..7a11f02d6c6c 100644 --- a/tools/perf/arch/x86/tests/rdpmc.c +++ b/tools/perf/arch/x86/tests/rdpmc.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <errno.h> #include <unistd.h> #include <stdlib.h> diff --git a/tools/perf/arch/x86/tests/regs_load.S b/tools/perf/arch/x86/tests/regs_load.S index 60875d5c556c..bbe5a0d16e51 100644 --- a/tools/perf/arch/x86/tests/regs_load.S +++ b/tools/perf/arch/x86/tests/regs_load.S @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #include <linux/linkage.h> #define AX 0 diff --git a/tools/perf/arch/x86/util/group.c b/tools/perf/arch/x86/util/group.c index 37f92aa39a5d..e2f8034b8973 100644 --- a/tools/perf/arch/x86/util/group.c +++ b/tools/perf/arch/x86/util/group.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <stdio.h> #include "api/fs/fs.h" #include "util/group.h" diff --git a/tools/perf/arch/x86/util/header.c b/tools/perf/arch/x86/util/header.c index a74a48db26f5..33027c5e6f92 100644 --- a/tools/perf/arch/x86/util/header.c +++ b/tools/perf/arch/x86/util/header.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <sys/types.h> #include <unistd.h> #include <stdio.h> diff --git a/tools/perf/arch/x86/util/kvm-stat.c b/tools/perf/arch/x86/util/kvm-stat.c index bf817beca0a8..b32409a0e546 100644 --- a/tools/perf/arch/x86/util/kvm-stat.c +++ b/tools/perf/arch/x86/util/kvm-stat.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <errno.h> #include "../../util/kvm-stat.h" #include <asm/svm.h> diff --git a/tools/perf/arch/x86/util/perf_regs.c b/tools/perf/arch/x86/util/perf_regs.c index f95edebfb716..4b2caf6d48e7 100644 --- a/tools/perf/arch/x86/util/perf_regs.c +++ b/tools/perf/arch/x86/util/perf_regs.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <errno.h> #include <string.h> #include <regex.h> diff --git a/tools/perf/arch/x86/util/pmu.c b/tools/perf/arch/x86/util/pmu.c index 79fe07158d00..63a74c32ddc5 100644 --- a/tools/perf/arch/x86/util/pmu.c +++ b/tools/perf/arch/x86/util/pmu.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <string.h> #include <linux/perf_event.h> diff --git a/tools/perf/arch/x86/util/tsc.c b/tools/perf/arch/x86/util/tsc.c index 2e5567c94e09..06bae7023a51 100644 --- a/tools/perf/arch/x86/util/tsc.c +++ b/tools/perf/arch/x86/util/tsc.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <stdbool.h> #include <errno.h> diff --git a/tools/perf/arch/x86/util/unwind-libdw.c b/tools/perf/arch/x86/util/unwind-libdw.c index 38dc9bb2a7c9..fda8f4206ee4 100644 --- a/tools/perf/arch/x86/util/unwind-libdw.c +++ b/tools/perf/arch/x86/util/unwind-libdw.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <elfutils/libdwfl.h> #include "../../util/unwind-libdw.h" #include "../../util/perf_regs.h" diff --git a/tools/perf/arch/x86/util/unwind-libunwind.c b/tools/perf/arch/x86/util/unwind-libunwind.c index 4f16661cbdbb..9c917f80c906 100644 --- a/tools/perf/arch/x86/util/unwind-libunwind.c +++ b/tools/perf/arch/x86/util/unwind-libunwind.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #ifndef REMOTE_UNWIND_LIBUNWIND #include <errno.h> diff --git a/tools/perf/arch/xtensa/include/dwarf-regs-table.h b/tools/perf/arch/xtensa/include/dwarf-regs-table.h index aa0444a33fe6..d7c9f1fb4444 100644 --- a/tools/perf/arch/xtensa/include/dwarf-regs-table.h +++ b/tools/perf/arch/xtensa/include/dwarf-regs-table.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifdef DEFINE_DWARF_REGSTR_TABLE /* This is included in perf/util/dwarf-regs.c */ diff --git a/tools/perf/bench/bench.h b/tools/perf/bench/bench.h index 842ab2781cdc..6c9fcd757f31 100644 --- a/tools/perf/bench/bench.h +++ b/tools/perf/bench/bench.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef BENCH_H #define BENCH_H diff --git a/tools/perf/bench/futex-hash.c b/tools/perf/bench/futex-hash.c index fe16b310097f..58ae6ed8f38b 100644 --- a/tools/perf/bench/futex-hash.c +++ b/tools/perf/bench/futex-hash.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2013 Davidlohr Bueso <davidlohr@hp.com> * diff --git a/tools/perf/bench/futex-lock-pi.c b/tools/perf/bench/futex-lock-pi.c index 73a1c44ea63c..08653ae8a8c4 100644 --- a/tools/perf/bench/futex-lock-pi.c +++ b/tools/perf/bench/futex-lock-pi.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2015 Davidlohr Bueso. */ diff --git a/tools/perf/bench/futex-requeue.c b/tools/perf/bench/futex-requeue.c index 41786cbea24c..1058c194608a 100644 --- a/tools/perf/bench/futex-requeue.c +++ b/tools/perf/bench/futex-requeue.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2013 Davidlohr Bueso <davidlohr@hp.com> * diff --git a/tools/perf/bench/futex-wake-parallel.c b/tools/perf/bench/futex-wake-parallel.c index 4ab12c8e016a..b4732dad9f89 100644 --- a/tools/perf/bench/futex-wake-parallel.c +++ b/tools/perf/bench/futex-wake-parallel.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2015 Davidlohr Bueso. * diff --git a/tools/perf/bench/futex-wake.c b/tools/perf/bench/futex-wake.c index 2fa49222ef8d..8c5c0b6b5c97 100644 --- a/tools/perf/bench/futex-wake.c +++ b/tools/perf/bench/futex-wake.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2013 Davidlohr Bueso <davidlohr@hp.com> * diff --git a/tools/perf/bench/futex.h b/tools/perf/bench/futex.h index e44fd3239530..db4853f209c7 100644 --- a/tools/perf/bench/futex.h +++ b/tools/perf/bench/futex.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * Glibc independent futex library for testing kernel functionality. * Shamelessly stolen from Darren Hart <dvhltc@us.ibm.com> diff --git a/tools/perf/bench/mem-functions.c b/tools/perf/bench/mem-functions.c index fbd732b54047..0251dd348124 100644 --- a/tools/perf/bench/mem-functions.c +++ b/tools/perf/bench/mem-functions.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * mem-memcpy.c * diff --git a/tools/perf/bench/mem-memcpy-arch.h b/tools/perf/bench/mem-memcpy-arch.h index 5aad2a9408b0..5bcaec5601a8 100644 --- a/tools/perf/bench/mem-memcpy-arch.h +++ b/tools/perf/bench/mem-memcpy-arch.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifdef HAVE_ARCH_X86_64_SUPPORT diff --git a/tools/perf/bench/mem-memcpy-x86-64-asm-def.h b/tools/perf/bench/mem-memcpy-x86-64-asm-def.h index 8c0c1a2770c8..50ae8bd58296 100644 --- a/tools/perf/bench/mem-memcpy-x86-64-asm-def.h +++ b/tools/perf/bench/mem-memcpy-x86-64-asm-def.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ MEMCPY_FN(memcpy_orig, "x86-64-unrolled", diff --git a/tools/perf/bench/mem-memcpy-x86-64-asm.S b/tools/perf/bench/mem-memcpy-x86-64-asm.S index f700369bb0f6..b43f8d2a34ec 100644 --- a/tools/perf/bench/mem-memcpy-x86-64-asm.S +++ b/tools/perf/bench/mem-memcpy-x86-64-asm.S @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* Various wrappers to make the kernel .S file build in user-space: */ diff --git a/tools/perf/bench/mem-memset-arch.h b/tools/perf/bench/mem-memset-arch.h index 0d15786d9ae3..53f45482663f 100644 --- a/tools/perf/bench/mem-memset-arch.h +++ b/tools/perf/bench/mem-memset-arch.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifdef HAVE_ARCH_X86_64_SUPPORT diff --git a/tools/perf/bench/mem-memset-x86-64-asm-def.h b/tools/perf/bench/mem-memset-x86-64-asm-def.h index f02d028771d9..dac6d2b7c39b 100644 --- a/tools/perf/bench/mem-memset-x86-64-asm-def.h +++ b/tools/perf/bench/mem-memset-x86-64-asm-def.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ MEMSET_FN(memset_orig, "x86-64-unrolled", diff --git a/tools/perf/bench/mem-memset-x86-64-asm.S b/tools/perf/bench/mem-memset-x86-64-asm.S index 58407aa24c1b..d550bd526162 100644 --- a/tools/perf/bench/mem-memset-x86-64-asm.S +++ b/tools/perf/bench/mem-memset-x86-64-asm.S @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #define memset MEMSET /* don't hide glibc's memset() */ #define altinstr_replacement text #define globl p2align 4; .globl diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c index 469d65b21122..d95fdcc26f4b 100644 --- a/tools/perf/bench/numa.c +++ b/tools/perf/bench/numa.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * numa.c * diff --git a/tools/perf/bench/sched-messaging.c b/tools/perf/bench/sched-messaging.c index 4f961e74535b..f9d7641ae833 100644 --- a/tools/perf/bench/sched-messaging.c +++ b/tools/perf/bench/sched-messaging.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * * sched-messaging.c diff --git a/tools/perf/bench/sched-pipe.c b/tools/perf/bench/sched-pipe.c index a152737370c5..0591be008f2a 100644 --- a/tools/perf/bench/sched-pipe.c +++ b/tools/perf/bench/sched-pipe.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * * sched-pipe.c diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index c38373195c4a..3d32aa45016d 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * builtin-annotate.c * diff --git a/tools/perf/builtin-bench.c b/tools/perf/builtin-bench.c index 445e62881254..17a6bcd01aa6 100644 --- a/tools/perf/builtin-bench.c +++ b/tools/perf/builtin-bench.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * builtin-bench.c * diff --git a/tools/perf/builtin-buildid-cache.c b/tools/perf/builtin-buildid-cache.c index e3eb6240ced0..5f53a7ad5ef3 100644 --- a/tools/perf/builtin-buildid-cache.c +++ b/tools/perf/builtin-buildid-cache.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * builtin-buildid-cache.c * diff --git a/tools/perf/builtin-buildid-list.c b/tools/perf/builtin-buildid-list.c index fdaca16e0c74..ec2f327cd79d 100644 --- a/tools/perf/builtin-buildid-list.c +++ b/tools/perf/builtin-buildid-list.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * builtin-buildid-list.c * diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index 475999e48f66..fd32ad08c6d4 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * This is rewrite of original c2c tool introduced in here: * http://lwn.net/Articles/588866/ diff --git a/tools/perf/builtin-config.c b/tools/perf/builtin-config.c index a1d82e33282c..abfa49eaf7fd 100644 --- a/tools/perf/builtin-config.c +++ b/tools/perf/builtin-config.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * builtin-config.c * diff --git a/tools/perf/builtin-data.c b/tools/perf/builtin-data.c index 46cd8490baf4..dde25d4ca56d 100644 --- a/tools/perf/builtin-data.c +++ b/tools/perf/builtin-data.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <linux/compiler.h> #include "builtin.h" #include "perf.h" diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index 0cd4cf6a344b..56223bdfa205 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * builtin-diff.c * diff --git a/tools/perf/builtin-evlist.c b/tools/perf/builtin-evlist.c index 6d210e40d611..cdd145613f60 100644 --- a/tools/perf/builtin-evlist.c +++ b/tools/perf/builtin-evlist.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Builtin evlist command: Show the list of event selectors present * in a perf.data file. diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c index dbe4e4153bcf..bd1fedef3d1c 100644 --- a/tools/perf/builtin-help.c +++ b/tools/perf/builtin-help.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * builtin-help.c * diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c index 2b8032908fb2..3e0e73b0dc67 100644 --- a/tools/perf/builtin-inject.c +++ b/tools/perf/builtin-inject.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * builtin-inject.c * diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c index 24ee68ecdd42..35d4b9c9a9e8 100644 --- a/tools/perf/builtin-kmem.c +++ b/tools/perf/builtin-kmem.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "builtin.h" #include "perf.h" diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c index f309c3773522..5fb40368d5d1 100644 --- a/tools/perf/builtin-kvm.c +++ b/tools/perf/builtin-kvm.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "builtin.h" #include "perf.h" diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c index 4bf2cb4d25aa..eeedbe433776 100644 --- a/tools/perf/builtin-list.c +++ b/tools/perf/builtin-list.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * builtin-list.c * diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c index ff98652484a7..fe69cd6b89e1 100644 --- a/tools/perf/builtin-lock.c +++ b/tools/perf/builtin-lock.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <errno.h> #include <inttypes.h> #include "builtin.h" diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c index 0f15634ef82c..4db960085273 100644 --- a/tools/perf/builtin-mem.c +++ b/tools/perf/builtin-mem.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <inttypes.h> #include <sys/types.h> #include <sys/stat.h> diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 56f8142ff97f..0c95ffefb6cc 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * builtin-record.c * diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index f9dff652dcbd..fae4b0340750 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * builtin-report.c * diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index 322b4def8411..f380d91ee609 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "builtin.h" #include "perf.h" diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index 3d4c3b5e1868..0fe02758de7d 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "builtin.h" #include "perf.h" @@ -586,7 +587,7 @@ static void print_sample_brstack(struct perf_sample *sample, thread__find_addr_map(thread, sample->cpumode, MAP__FUNCTION, to, &alt); } - printf("0x%"PRIx64, from); + printf(" 0x%"PRIx64, from); if (PRINT_FIELD(DSO)) { printf("("); map__fprintf_dsoname(alf.map, stdout); @@ -681,7 +682,7 @@ static void print_sample_brstackoff(struct perf_sample *sample, if (alt.map && !alt.map->dso->adjust_symbols) to = map__map_ip(alt.map, to); - printf("0x%"PRIx64, from); + printf(" 0x%"PRIx64, from); if (PRINT_FIELD(DSO)) { printf("("); map__fprintf_dsoname(alf.map, stdout); diff --git a/tools/perf/builtin-version.c b/tools/perf/builtin-version.c index d25149456a2f..37019c5d675f 100644 --- a/tools/perf/builtin-version.c +++ b/tools/perf/builtin-version.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "builtin.h" #include "perf.h" #include <linux/compiler.h> diff --git a/tools/perf/builtin.h b/tools/perf/builtin.h index d4d19fe3d050..05745f3ce912 100644 --- a/tools/perf/builtin.h +++ b/tools/perf/builtin.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef BUILTIN_H #define BUILTIN_H diff --git a/tools/perf/check-headers.sh b/tools/perf/check-headers.sh index 932fda54b8a6..50cd6228f506 100755 --- a/tools/perf/check-headers.sh +++ b/tools/perf/check-headers.sh @@ -1,4 +1,5 @@ #!/bin/sh +# SPDX-License-Identifier: GPL-2.0 HEADERS=' include/uapi/drm/drm.h diff --git a/tools/perf/jvmti/jvmti_agent.h b/tools/perf/jvmti/jvmti_agent.h index c53a41f48b63..fe32d8344a82 100644 --- a/tools/perf/jvmti/jvmti_agent.h +++ b/tools/perf/jvmti/jvmti_agent.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __JVMTI_AGENT_H__ #define __JVMTI_AGENT_H__ diff --git a/tools/perf/jvmti/libjvmti.c b/tools/perf/jvmti/libjvmti.c index 6d710904c837..c62c9fc9a525 100644 --- a/tools/perf/jvmti/libjvmti.c +++ b/tools/perf/jvmti/libjvmti.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <linux/compiler.h> #include <sys/types.h> #include <stdio.h> diff --git a/tools/perf/perf-archive.sh b/tools/perf/perf-archive.sh index e91930620269..0cfb3e2cefef 100644 --- a/tools/perf/perf-archive.sh +++ b/tools/perf/perf-archive.sh @@ -1,4 +1,5 @@ #!/bin/bash +# SPDX-License-Identifier: GPL-2.0 # perf archive # Arnaldo Carvalho de Melo <acme@redhat.com> diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh index 3ba80b2359cc..345f5d6e9ed5 100644 --- a/tools/perf/perf-completion.sh +++ b/tools/perf/perf-completion.sh @@ -1,4 +1,5 @@ # perf bash and zsh completion +# SPDX-License-Identifier: GPL-2.0 # Taken from git.git's completion script. __my_reassemble_comp_words_by_ref() diff --git a/tools/perf/perf-read-vdso.c b/tools/perf/perf-read-vdso.c index 764e2547c25a..8c0ca0cc428f 100644 --- a/tools/perf/perf-read-vdso.c +++ b/tools/perf/perf-read-vdso.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <stdio.h> #include <string.h> diff --git a/tools/perf/perf-sys.h b/tools/perf/perf-sys.h index c11f0c76e90c..36673f98d66b 100644 --- a/tools/perf/perf-sys.h +++ b/tools/perf/perf-sys.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _PERF_SYS_H #define _PERF_SYS_H diff --git a/tools/perf/perf.c b/tools/perf/perf.c index 2f19e03c5c40..62b13518bc6e 100644 --- a/tools/perf/perf.c +++ b/tools/perf/perf.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * perf.c * diff --git a/tools/perf/perf.h b/tools/perf/perf.h index dc442ba21bf6..f75f3dec7485 100644 --- a/tools/perf/perf.h +++ b/tools/perf/perf.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _PERF_PERF_H #define _PERF_PERF_H diff --git a/tools/perf/pmu-events/jevents.h b/tools/perf/pmu-events/jevents.h index 611fac01913d..d87efd2685b8 100644 --- a/tools/perf/pmu-events/jevents.h +++ b/tools/perf/pmu-events/jevents.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef JEVENTS_H #define JEVENTS_H 1 diff --git a/tools/perf/pmu-events/jsmn.h b/tools/perf/pmu-events/jsmn.h index d666b10cf25b..c7b0f6ea2a31 100644 --- a/tools/perf/pmu-events/jsmn.h +++ b/tools/perf/pmu-events/jsmn.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __JSMN_H_ #define __JSMN_H_ diff --git a/tools/perf/pmu-events/json.h b/tools/perf/pmu-events/json.h index 278ebd32cfb6..fbcd5a0590ad 100644 --- a/tools/perf/pmu-events/json.h +++ b/tools/perf/pmu-events/json.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef JSON_H #define JSON_H 1 diff --git a/tools/perf/pmu-events/pmu-events.h b/tools/perf/pmu-events/pmu-events.h index 569eab3688dd..e08789ddfe6c 100644 --- a/tools/perf/pmu-events/pmu-events.h +++ b/tools/perf/pmu-events/pmu-events.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef PMU_EVENTS_H #define PMU_EVENTS_H diff --git a/tools/perf/python/tracepoint.py b/tools/perf/python/tracepoint.py index eb4dbed57de7..eb76f6516247 100755 --- a/tools/perf/python/tracepoint.py +++ b/tools/perf/python/tracepoint.py @@ -1,4 +1,5 @@ #! /usr/bin/python +# SPDX-License-Identifier: GPL-2.0 # -*- python -*- # -*- coding: utf-8 -*- diff --git a/tools/perf/scripts/perl/Perf-Trace-Util/Makefile.PL b/tools/perf/scripts/perl/Perf-Trace-Util/Makefile.PL index decdeb0f6789..e8994332d7dc 100644 --- a/tools/perf/scripts/perl/Perf-Trace-Util/Makefile.PL +++ b/tools/perf/scripts/perl/Perf-Trace-Util/Makefile.PL @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 use 5.010000; use ExtUtils::MakeMaker; # See lib/ExtUtils/MakeMaker.pm for details of how to influence diff --git a/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/EventClass.py b/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/EventClass.py index 9e0985794e20..81a56cd2b3c1 100755 --- a/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/EventClass.py +++ b/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/EventClass.py @@ -1,4 +1,5 @@ # EventClass.py +# SPDX-License-Identifier: GPL-2.0 # # This is a library defining some events types classes, which could # be used by other scripts to analyzing the perf samples. diff --git a/tools/perf/scripts/python/event_analyzing_sample.py b/tools/perf/scripts/python/event_analyzing_sample.py index 163c39fa12d9..4e843b9864ec 100644 --- a/tools/perf/scripts/python/event_analyzing_sample.py +++ b/tools/perf/scripts/python/event_analyzing_sample.py @@ -1,4 +1,5 @@ # event_analyzing_sample.py: general event handler in python +# SPDX-License-Identifier: GPL-2.0 # # Current perf report is already very powerful with the annotation integrated, # and this script is not trying to be as powerful as perf report, but diff --git a/tools/perf/scripts/python/net_dropmonitor.py b/tools/perf/scripts/python/net_dropmonitor.py index 0b6ce8c253e8..a150164b44a3 100755 --- a/tools/perf/scripts/python/net_dropmonitor.py +++ b/tools/perf/scripts/python/net_dropmonitor.py @@ -1,4 +1,5 @@ # Monitor the system for dropped packets and proudce a report of drop locations and counts +# SPDX-License-Identifier: GPL-2.0 import os import sys diff --git a/tools/perf/scripts/python/netdev-times.py b/tools/perf/scripts/python/netdev-times.py index 4c6f09ac7d12..9b2050f778f1 100644 --- a/tools/perf/scripts/python/netdev-times.py +++ b/tools/perf/scripts/python/netdev-times.py @@ -1,4 +1,5 @@ # Display a process of packets and processed time. +# SPDX-License-Identifier: GPL-2.0 # It helps us to investigate networking or network device. # # options diff --git a/tools/perf/scripts/python/stackcollapse.py b/tools/perf/scripts/python/stackcollapse.py index 5a605f70ef32..1697b5e18c96 100755 --- a/tools/perf/scripts/python/stackcollapse.py +++ b/tools/perf/scripts/python/stackcollapse.py @@ -1,4 +1,5 @@ # stackcollapse.py - format perf samples with one line per distinct call stack +# SPDX-License-Identifier: GPL-2.0 # # This script's output has two space-separated fields. The first is a semicolon # separated stack including the program name (from the "comm" field) and the diff --git a/tools/perf/scripts/python/stat-cpi.py b/tools/perf/scripts/python/stat-cpi.py index 8b60f343dd07..8410672efb8b 100644 --- a/tools/perf/scripts/python/stat-cpi.py +++ b/tools/perf/scripts/python/stat-cpi.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# SPDX-License-Identifier: GPL-2.0 data = {} times = [] diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c index c9aafed7da15..c180bbcdbef6 100644 --- a/tools/perf/tests/attr.c +++ b/tools/perf/tests/attr.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * The struct perf_event_attr test support. * diff --git a/tools/perf/tests/attr.py b/tools/perf/tests/attr.py index 6bb50e82a3e3..907b1b2f56ad 100644 --- a/tools/perf/tests/attr.py +++ b/tools/perf/tests/attr.py @@ -1,4 +1,5 @@ #! /usr/bin/python +# SPDX-License-Identifier: GPL-2.0 import os import sys diff --git a/tools/perf/tests/backward-ring-buffer.c b/tools/perf/tests/backward-ring-buffer.c index d233ad336463..71b9a0b613d2 100644 --- a/tools/perf/tests/backward-ring-buffer.c +++ b/tools/perf/tests/backward-ring-buffer.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Test backward bit in event attribute, read ring buffer from end to * beginning diff --git a/tools/perf/tests/bitmap.c b/tools/perf/tests/bitmap.c index 0d7c06584905..47bedf25ba69 100644 --- a/tools/perf/tests/bitmap.c +++ b/tools/perf/tests/bitmap.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <linux/compiler.h> #include <linux/bitmap.h> #include "tests.h" diff --git a/tools/perf/tests/bp_signal.c b/tools/perf/tests/bp_signal.c index 97937e1bc53a..335b695f4970 100644 --- a/tools/perf/tests/bp_signal.c +++ b/tools/perf/tests/bp_signal.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Inspired by breakpoint overflow test done by * Vince Weaver <vincent.weaver@maine.edu> for perf_event_tests diff --git a/tools/perf/tests/bp_signal_overflow.c b/tools/perf/tests/bp_signal_overflow.c index 61ecd8021f49..ca962559e845 100644 --- a/tools/perf/tests/bp_signal_overflow.c +++ b/tools/perf/tests/bp_signal_overflow.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Originally done by Vince Weaver <vincent.weaver@maine.edu> for * perf_event_tests (git://github.com/deater/perf_event_tests) diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c index 377bea009163..53d06f37406a 100644 --- a/tools/perf/tests/builtin-test.c +++ b/tools/perf/tests/builtin-test.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * builtin-test.c * diff --git a/tools/perf/tests/clang.c b/tools/perf/tests/clang.c index c60ec916f0f2..f45fe11dcf50 100644 --- a/tools/perf/tests/clang.c +++ b/tools/perf/tests/clang.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "tests.h" #include "debug.h" #include "util.h" diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c index 466a462b26d1..fcc8984bc329 100644 --- a/tools/perf/tests/code-reading.c +++ b/tools/perf/tests/code-reading.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <errno.h> #include <linux/kernel.h> #include <linux/types.h> diff --git a/tools/perf/tests/cpumap.c b/tools/perf/tests/cpumap.c index 199702252270..e78b897677bd 100644 --- a/tools/perf/tests/cpumap.c +++ b/tools/perf/tests/cpumap.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "tests.h" #include <stdio.h> #include "cpumap.h" diff --git a/tools/perf/tests/dso-data.c b/tools/perf/tests/dso-data.c index 30aead42d136..7f6c52021e41 100644 --- a/tools/perf/tests/dso-data.c +++ b/tools/perf/tests/dso-data.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <dirent.h> #include <stdlib.h> #include <linux/kernel.h> diff --git a/tools/perf/tests/dwarf-unwind.c b/tools/perf/tests/dwarf-unwind.c index 9ba1d216a89f..ac40e05bcab4 100644 --- a/tools/perf/tests/dwarf-unwind.c +++ b/tools/perf/tests/dwarf-unwind.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <linux/compiler.h> #include <linux/types.h> #include <inttypes.h> diff --git a/tools/perf/tests/event-times.c b/tools/perf/tests/event-times.c index b82b981c3259..1a2686f1fcf0 100644 --- a/tools/perf/tests/event-times.c +++ b/tools/perf/tests/event-times.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <linux/compiler.h> #include <errno.h> #include <inttypes.h> diff --git a/tools/perf/tests/event_update.c b/tools/perf/tests/event_update.c index 9484da2ec6b4..f14dcd613438 100644 --- a/tools/perf/tests/event_update.c +++ b/tools/perf/tests/event_update.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <linux/compiler.h> #include "evlist.h" #include "evsel.h" diff --git a/tools/perf/tests/evsel-roundtrip-name.c b/tools/perf/tests/evsel-roundtrip-name.c index d32759b6e38a..a104728ebf25 100644 --- a/tools/perf/tests/evsel-roundtrip-name.c +++ b/tools/perf/tests/evsel-roundtrip-name.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "evlist.h" #include "evsel.h" #include "parse-events.h" diff --git a/tools/perf/tests/evsel-tp-sched.c b/tools/perf/tests/evsel-tp-sched.c index 5fc906d26c5c..699561fa512c 100644 --- a/tools/perf/tests/evsel-tp-sched.c +++ b/tools/perf/tests/evsel-tp-sched.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <linux/err.h> #include <traceevent/event-parse.h> #include "evsel.h" diff --git a/tools/perf/tests/expr.c b/tools/perf/tests/expr.c index cb251bf523e7..01f0706995a9 100644 --- a/tools/perf/tests/expr.c +++ b/tools/perf/tests/expr.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "util/debug.h" #include "util/expr.h" #include "tests.h" diff --git a/tools/perf/tests/fdarray.c b/tools/perf/tests/fdarray.c index 7d3a9e2ff897..c7c81c4a5b2b 100644 --- a/tools/perf/tests/fdarray.c +++ b/tools/perf/tests/fdarray.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <api/fd/array.h> #include <poll.h> #include "util/debug.h" diff --git a/tools/perf/tests/hists_common.c b/tools/perf/tests/hists_common.c index 00b8dc50f3db..f7c5b613d667 100644 --- a/tools/perf/tests/hists_common.c +++ b/tools/perf/tests/hists_common.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <inttypes.h> #include "perf.h" #include "util/debug.h" diff --git a/tools/perf/tests/hists_common.h b/tools/perf/tests/hists_common.h index 888254e8665c..a2de0ff0ce3a 100644 --- a/tools/perf/tests/hists_common.h +++ b/tools/perf/tests/hists_common.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_TESTS__HISTS_COMMON_H__ #define __PERF_TESTS__HISTS_COMMON_H__ diff --git a/tools/perf/tests/hists_cumulate.c b/tools/perf/tests/hists_cumulate.c index 8d19c0200cb7..65fe02bebbee 100644 --- a/tools/perf/tests/hists_cumulate.c +++ b/tools/perf/tests/hists_cumulate.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "perf.h" #include "util/debug.h" #include "util/event.h" diff --git a/tools/perf/tests/hists_filter.c b/tools/perf/tests/hists_filter.c index 755ca551b810..1c5bedab3c2c 100644 --- a/tools/perf/tests/hists_filter.c +++ b/tools/perf/tests/hists_filter.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "perf.h" #include "util/debug.h" #include "util/symbol.h" diff --git a/tools/perf/tests/hists_link.c b/tools/perf/tests/hists_link.c index 073c9c2856bc..9a9d06cb0222 100644 --- a/tools/perf/tests/hists_link.c +++ b/tools/perf/tests/hists_link.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "perf.h" #include "tests.h" #include "debug.h" diff --git a/tools/perf/tests/hists_output.c b/tools/perf/tests/hists_output.c index 282d62eaebe2..faacb4f41460 100644 --- a/tools/perf/tests/hists_output.c +++ b/tools/perf/tests/hists_output.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "perf.h" #include "util/debug.h" #include "util/event.h" diff --git a/tools/perf/tests/is_printable_array.c b/tools/perf/tests/is_printable_array.c index 38f765767587..9c7b3baca4fe 100644 --- a/tools/perf/tests/is_printable_array.c +++ b/tools/perf/tests/is_printable_array.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <linux/compiler.h> #include <linux/kernel.h> #include "tests.h" diff --git a/tools/perf/tests/keep-tracking.c b/tools/perf/tests/keep-tracking.c index 739428603b71..842d33637a18 100644 --- a/tools/perf/tests/keep-tracking.c +++ b/tools/perf/tests/keep-tracking.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <linux/types.h> #include <unistd.h> #include <sys/prctl.h> diff --git a/tools/perf/tests/kmod-path.c b/tools/perf/tests/kmod-path.c index 8b9d4ba06c0e..8e57d46109de 100644 --- a/tools/perf/tests/kmod-path.c +++ b/tools/perf/tests/kmod-path.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <stdbool.h> #include <stdlib.h> #include "tests.h" diff --git a/tools/perf/tests/llvm.c b/tools/perf/tests/llvm.c index 5187b50dbafe..a039f93199e5 100644 --- a/tools/perf/tests/llvm.c +++ b/tools/perf/tests/llvm.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <stdio.h> #include <bpf/libbpf.h> #include <util/llvm-utils.h> diff --git a/tools/perf/tests/llvm.h b/tools/perf/tests/llvm.h index b83571758d83..f68b0d9b8ae2 100644 --- a/tools/perf/tests/llvm.h +++ b/tools/perf/tests/llvm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef PERF_TEST_LLVM_H #define PERF_TEST_LLVM_H diff --git a/tools/perf/tests/mmap-basic.c b/tools/perf/tests/mmap-basic.c index bc8a70ee46d8..5a8bf318f8a7 100644 --- a/tools/perf/tests/mmap-basic.c +++ b/tools/perf/tests/mmap-basic.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <errno.h> #include <inttypes.h> /* For the CLR_() macros */ diff --git a/tools/perf/tests/mmap-thread-lookup.c b/tools/perf/tests/mmap-thread-lookup.c index f94a4196e7c9..3c3f3e029e33 100644 --- a/tools/perf/tests/mmap-thread-lookup.c +++ b/tools/perf/tests/mmap-thread-lookup.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <inttypes.h> #include <unistd.h> #include <sys/syscall.h> diff --git a/tools/perf/tests/openat-syscall-all-cpus.c b/tools/perf/tests/openat-syscall-all-cpus.c index 9cf1c35f2ad0..c531e6deb104 100644 --- a/tools/perf/tests/openat-syscall-all-cpus.c +++ b/tools/perf/tests/openat-syscall-all-cpus.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <errno.h> #include <inttypes.h> /* For the CPU_* macros */ diff --git a/tools/perf/tests/openat-syscall-tp-fields.c b/tools/perf/tests/openat-syscall-tp-fields.c index b6ee1c41f45d..d9619d265314 100644 --- a/tools/perf/tests/openat-syscall-tp-fields.c +++ b/tools/perf/tests/openat-syscall-tp-fields.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <linux/err.h> #include "perf.h" #include "evlist.h" diff --git a/tools/perf/tests/openat-syscall.c b/tools/perf/tests/openat-syscall.c index 9dc5c5d37553..00cd63f90b92 100644 --- a/tools/perf/tests/openat-syscall.c +++ b/tools/perf/tests/openat-syscall.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <errno.h> #include <inttypes.h> #include <api/fs/tracing_path.h> diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c index 0f0b025faa4b..f0679613bd18 100644 --- a/tools/perf/tests/parse-events.c +++ b/tools/perf/tests/parse-events.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "parse-events.h" #include "evsel.h" #include "evlist.h" diff --git a/tools/perf/tests/parse-no-sample-id-all.c b/tools/perf/tests/parse-no-sample-id-all.c index 91867dcc39f0..2196d1497c0c 100644 --- a/tools/perf/tests/parse-no-sample-id-all.c +++ b/tools/perf/tests/parse-no-sample-id-all.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <linux/kernel.h> #include <linux/types.h> #include <stddef.h> diff --git a/tools/perf/tests/perf-hooks.c b/tools/perf/tests/perf-hooks.c index bf2517d6de70..a693bcf017ea 100644 --- a/tools/perf/tests/perf-hooks.c +++ b/tools/perf/tests/perf-hooks.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <signal.h> #include <stdlib.h> diff --git a/tools/perf/tests/perf-record.c b/tools/perf/tests/perf-record.c index 19b650064b70..c34904d37705 100644 --- a/tools/perf/tests/perf-record.c +++ b/tools/perf/tests/perf-record.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <errno.h> #include <inttypes.h> /* For the CLR_() macros */ diff --git a/tools/perf/tests/perf-targz-src-pkg b/tools/perf/tests/perf-targz-src-pkg index f2d9c5fe58e0..fae26b1cf08f 100755 --- a/tools/perf/tests/perf-targz-src-pkg +++ b/tools/perf/tests/perf-targz-src-pkg @@ -1,4 +1,5 @@ #!/bin/sh +# SPDX-License-Identifier: GPL-2.0 # Test one of the main kernel Makefile targets to generate a perf sources tarball # suitable for build outside the full kernel sources. # diff --git a/tools/perf/tests/pmu.c b/tools/perf/tests/pmu.c index 9f7f589f9c54..9abca267afa9 100644 --- a/tools/perf/tests/pmu.c +++ b/tools/perf/tests/pmu.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "parse-events.h" #include "pmu.h" #include "util.h" diff --git a/tools/perf/tests/python-use.c b/tools/perf/tests/python-use.c index 598a7e058ad4..5d2df65ada6a 100644 --- a/tools/perf/tests/python-use.c +++ b/tools/perf/tests/python-use.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Just test if we can load the python binding. */ diff --git a/tools/perf/tests/sample-parsing.c b/tools/perf/tests/sample-parsing.c index c3858487159d..3ec6302b6498 100644 --- a/tools/perf/tests/sample-parsing.c +++ b/tools/perf/tests/sample-parsing.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <stdbool.h> #include <inttypes.h> #include <linux/kernel.h> diff --git a/tools/perf/tests/sdt.c b/tools/perf/tests/sdt.c index a9903d9b8bc2..5059452d27dd 100644 --- a/tools/perf/tests/sdt.c +++ b/tools/perf/tests/sdt.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <errno.h> #include <stdio.h> #include <sys/epoll.h> diff --git a/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh b/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh index 462fc755092e..7a84d73324e3 100755 --- a/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh +++ b/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh @@ -10,6 +10,9 @@ . $(dirname $0)/lib/probe.sh +ld=$(realpath /lib64/ld*.so.* | uniq) +libc=$(echo $ld | sed 's/ld/libc/g') + trace_libc_inet_pton_backtrace() { idx=0 expected[0]="PING.*bytes" @@ -18,8 +21,8 @@ trace_libc_inet_pton_backtrace() { expected[3]=".*packets transmitted.*" expected[4]="rtt min.*" expected[5]="[0-9]+\.[0-9]+[[:space:]]+probe_libc:inet_pton:\([[:xdigit:]]+\)" - expected[6]=".*inet_pton[[:space:]]\(/usr/lib.*/libc-[0-9]+\.[0-9]+\.so\)$" - expected[7]="getaddrinfo[[:space:]]\(/usr/lib.*/libc-[0-9]+\.[0-9]+\.so\)$" + expected[6]=".*inet_pton[[:space:]]\($libc\)$" + expected[7]="getaddrinfo[[:space:]]\($libc\)$" expected[8]=".*\(.*/bin/ping.*\)$" perf trace --no-syscalls -e probe_libc:inet_pton/max-stack=3/ ping -6 -c 1 ::1 2>&1 | grep -v ^$ | while read line ; do @@ -35,7 +38,7 @@ trace_libc_inet_pton_backtrace() { } skip_if_no_perf_probe && \ -perf probe -q /lib64/libc-*.so inet_pton && \ +perf probe -q $libc inet_pton && \ trace_libc_inet_pton_backtrace err=$? rm -f ${file} diff --git a/tools/perf/tests/stat.c b/tools/perf/tests/stat.c index 7f988a939036..94250024684a 100644 --- a/tools/perf/tests/stat.c +++ b/tools/perf/tests/stat.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <linux/compiler.h> #include "event.h" #include "tests.h" diff --git a/tools/perf/tests/sw-clock.c b/tools/perf/tests/sw-clock.c index d88511f6072c..725a196991a8 100644 --- a/tools/perf/tests/sw-clock.c +++ b/tools/perf/tests/sw-clock.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <errno.h> #include <inttypes.h> #include <unistd.h> diff --git a/tools/perf/tests/switch-tracking.c b/tools/perf/tests/switch-tracking.c index 2acd78555192..7d3f4bf9534f 100644 --- a/tools/perf/tests/switch-tracking.c +++ b/tools/perf/tests/switch-tracking.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <sys/time.h> #include <sys/prctl.h> #include <errno.h> diff --git a/tools/perf/tests/task-exit.c b/tools/perf/tests/task-exit.c index f0881d0dd9c9..bc4a7344e274 100644 --- a/tools/perf/tests/task-exit.c +++ b/tools/perf/tests/task-exit.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "evlist.h" #include "evsel.h" #include "thread_map.h" diff --git a/tools/perf/tests/tests.h b/tools/perf/tests/tests.h index 921412a6a880..2862b80bc288 100644 --- a/tools/perf/tests/tests.h +++ b/tools/perf/tests/tests.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef TESTS_H #define TESTS_H diff --git a/tools/perf/tests/thread-map.c b/tools/perf/tests/thread-map.c index b3423c744f46..dbcb6a19b375 100644 --- a/tools/perf/tests/thread-map.c +++ b/tools/perf/tests/thread-map.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <stdlib.h> #include <sys/types.h> #include <unistd.h> diff --git a/tools/perf/tests/thread-mg-share.c b/tools/perf/tests/thread-mg-share.c index b9c7f58db6c4..b1d1bbafe7ae 100644 --- a/tools/perf/tests/thread-mg-share.c +++ b/tools/perf/tests/thread-mg-share.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "tests.h" #include "machine.h" #include "thread.h" diff --git a/tools/perf/tests/topology.c b/tools/perf/tests/topology.c index 19b0561fd6f6..a59db7c45a65 100644 --- a/tools/perf/tests/topology.c +++ b/tools/perf/tests/topology.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <string.h> #include <stdlib.h> #include <stdio.h> diff --git a/tools/perf/tests/unit_number__scnprintf.c b/tools/perf/tests/unit_number__scnprintf.c index 15cd1cf8c129..2bb8cb0039c1 100644 --- a/tools/perf/tests/unit_number__scnprintf.c +++ b/tools/perf/tests/unit_number__scnprintf.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <inttypes.h> #include <linux/compiler.h> #include <linux/types.h> diff --git a/tools/perf/tests/vmlinux-kallsyms.c b/tools/perf/tests/vmlinux-kallsyms.c index 86cb8868f67f..f6789fb029d6 100644 --- a/tools/perf/tests/vmlinux-kallsyms.c +++ b/tools/perf/tests/vmlinux-kallsyms.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <linux/compiler.h> #include <linux/rbtree.h> #include <inttypes.h> diff --git a/tools/perf/trace/beauty/beauty.h b/tools/perf/trace/beauty/beauty.h index 4b58581a6053..d80655cd1881 100644 --- a/tools/perf/trace/beauty/beauty.h +++ b/tools/perf/trace/beauty/beauty.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _PERF_TRACE_BEAUTY_H #define _PERF_TRACE_BEAUTY_H diff --git a/tools/perf/trace/beauty/eventfd.c b/tools/perf/trace/beauty/eventfd.c index b08f21eb6f4d..5d6a477a6400 100644 --- a/tools/perf/trace/beauty/eventfd.c +++ b/tools/perf/trace/beauty/eventfd.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #ifndef EFD_SEMAPHORE #define EFD_SEMAPHORE 1 #endif diff --git a/tools/perf/trace/beauty/flock.c b/tools/perf/trace/beauty/flock.c index 74613703a14e..f9707f57566c 100644 --- a/tools/perf/trace/beauty/flock.c +++ b/tools/perf/trace/beauty/flock.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <fcntl.h> #ifndef LOCK_MAND diff --git a/tools/perf/trace/beauty/futex_op.c b/tools/perf/trace/beauty/futex_op.c index bfd3359b09b6..61850fbc85ff 100644 --- a/tools/perf/trace/beauty/futex_op.c +++ b/tools/perf/trace/beauty/futex_op.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <linux/futex.h> #ifndef FUTEX_WAIT_BITSET diff --git a/tools/perf/trace/beauty/mmap.c b/tools/perf/trace/beauty/mmap.c index 754558f9009d..51f1cea406f5 100644 --- a/tools/perf/trace/beauty/mmap.c +++ b/tools/perf/trace/beauty/mmap.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <uapi/linux/mman.h> static size_t syscall_arg__scnprintf_mmap_prot(char *bf, size_t size, diff --git a/tools/perf/trace/beauty/mode_t.c b/tools/perf/trace/beauty/mode_t.c index 930d8fef2400..d929ad7dd97b 100644 --- a/tools/perf/trace/beauty/mode_t.c +++ b/tools/perf/trace/beauty/mode_t.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> diff --git a/tools/perf/trace/beauty/msg_flags.c b/tools/perf/trace/beauty/msg_flags.c index 1106c8960cc4..c064d6aae659 100644 --- a/tools/perf/trace/beauty/msg_flags.c +++ b/tools/perf/trace/beauty/msg_flags.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <sys/types.h> #include <sys/socket.h> diff --git a/tools/perf/trace/beauty/open_flags.c b/tools/perf/trace/beauty/open_flags.c index e359e041dc0e..6aec6178a99d 100644 --- a/tools/perf/trace/beauty/open_flags.c +++ b/tools/perf/trace/beauty/open_flags.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> diff --git a/tools/perf/trace/beauty/perf_event_open.c b/tools/perf/trace/beauty/perf_event_open.c index 311f09dd718d..2bafd7c995ff 100644 --- a/tools/perf/trace/beauty/perf_event_open.c +++ b/tools/perf/trace/beauty/perf_event_open.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #ifndef PERF_FLAG_FD_NO_GROUP # define PERF_FLAG_FD_NO_GROUP (1UL << 0) #endif diff --git a/tools/perf/trace/beauty/pid.c b/tools/perf/trace/beauty/pid.c index b6d419e16dcf..0313df342830 100644 --- a/tools/perf/trace/beauty/pid.c +++ b/tools/perf/trace/beauty/pid.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 size_t syscall_arg__scnprintf_pid(char *bf, size_t size, struct syscall_arg *arg) { int pid = arg->val; diff --git a/tools/perf/trace/beauty/sched_policy.c b/tools/perf/trace/beauty/sched_policy.c index 34775295b9b3..ba5096ae76b6 100644 --- a/tools/perf/trace/beauty/sched_policy.c +++ b/tools/perf/trace/beauty/sched_policy.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <sched.h> /* diff --git a/tools/perf/trace/beauty/seccomp.c b/tools/perf/trace/beauty/seccomp.c index 356441bce27d..b7097fd5fed9 100644 --- a/tools/perf/trace/beauty/seccomp.c +++ b/tools/perf/trace/beauty/seccomp.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #ifndef SECCOMP_SET_MODE_STRICT #define SECCOMP_SET_MODE_STRICT 0 #endif diff --git a/tools/perf/trace/beauty/signum.c b/tools/perf/trace/beauty/signum.c index fde8f2fc6558..bde18a53f090 100644 --- a/tools/perf/trace/beauty/signum.c +++ b/tools/perf/trace/beauty/signum.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <signal.h> static size_t syscall_arg__scnprintf_signum(char *bf, size_t size, struct syscall_arg *arg) diff --git a/tools/perf/trace/beauty/socket_type.c b/tools/perf/trace/beauty/socket_type.c index 0a5ce818131c..bca26aef4a77 100644 --- a/tools/perf/trace/beauty/socket_type.c +++ b/tools/perf/trace/beauty/socket_type.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <sys/types.h> #include <sys/socket.h> diff --git a/tools/perf/trace/beauty/waitid_options.c b/tools/perf/trace/beauty/waitid_options.c index 7942724adec8..8465281a093d 100644 --- a/tools/perf/trace/beauty/waitid_options.c +++ b/tools/perf/trace/beauty/waitid_options.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <sys/types.h> #include <sys/wait.h> diff --git a/tools/perf/ui/browser.c b/tools/perf/ui/browser.c index d0c2007c307b..63399af3049f 100644 --- a/tools/perf/ui/browser.c +++ b/tools/perf/ui/browser.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "../util.h" #include "../string2.h" #include "../config.h" diff --git a/tools/perf/ui/browser.h b/tools/perf/ui/browser.h index a12eff75638b..03e1734412b9 100644 --- a/tools/perf/ui/browser.h +++ b/tools/perf/ui/browser.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _PERF_UI_BROWSER_H_ #define _PERF_UI_BROWSER_H_ 1 diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c index 786fecaf578e..8f7f59d1a2b5 100644 --- a/tools/perf/ui/browsers/annotate.c +++ b/tools/perf/ui/browsers/annotate.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "../../util/util.h" #include "../browser.h" #include "../helpline.h" diff --git a/tools/perf/ui/browsers/header.c b/tools/perf/ui/browsers/header.c index e2c9390ff4c5..d75492189acb 100644 --- a/tools/perf/ui/browsers/header.c +++ b/tools/perf/ui/browsers/header.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "util/cache.h" #include "util/debug.h" #include "ui/browser.h" diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index 13dfb0a0bdeb..628ad5f7eddb 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <dirent.h> #include <errno.h> #include <inttypes.h> diff --git a/tools/perf/ui/browsers/hists.h b/tools/perf/ui/browsers/hists.h index 23d6acb84800..ba431777f559 100644 --- a/tools/perf/ui/browsers/hists.h +++ b/tools/perf/ui/browsers/hists.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _PERF_UI_BROWSER_HISTS_H_ #define _PERF_UI_BROWSER_HISTS_H_ 1 diff --git a/tools/perf/ui/browsers/map.c b/tools/perf/ui/browsers/map.c index ffa5addf631d..e03fa75f108a 100644 --- a/tools/perf/ui/browsers/map.c +++ b/tools/perf/ui/browsers/map.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <elf.h> #include <inttypes.h> #include <sys/ttydefaults.h> diff --git a/tools/perf/ui/browsers/map.h b/tools/perf/ui/browsers/map.h index 2d58e4b3eb6f..0ed7dbb3a373 100644 --- a/tools/perf/ui/browsers/map.h +++ b/tools/perf/ui/browsers/map.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _PERF_UI_MAP_BROWSER_H_ #define _PERF_UI_MAP_BROWSER_H_ 1 struct map; diff --git a/tools/perf/ui/browsers/scripts.c b/tools/perf/ui/browsers/scripts.c index ad6b6ee3770e..90a32ac69e76 100644 --- a/tools/perf/ui/browsers/scripts.c +++ b/tools/perf/ui/browsers/scripts.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <elf.h> #include <inttypes.h> #include <sys/ttydefaults.h> diff --git a/tools/perf/ui/gtk/annotate.c b/tools/perf/ui/gtk/annotate.c index 02176193f427..fc7a2e105bfd 100644 --- a/tools/perf/ui/gtk/annotate.c +++ b/tools/perf/ui/gtk/annotate.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "gtk.h" #include "util/debug.h" #include "util/annotate.h" diff --git a/tools/perf/ui/gtk/browser.c b/tools/perf/ui/gtk/browser.c index c24d91221290..4820e25ac68d 100644 --- a/tools/perf/ui/gtk/browser.c +++ b/tools/perf/ui/gtk/browser.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "../evlist.h" #include "../cache.h" #include "../evsel.h" diff --git a/tools/perf/ui/gtk/gtk.h b/tools/perf/ui/gtk/gtk.h index 0a9173ff9a61..9846ea5c831b 100644 --- a/tools/perf/ui/gtk/gtk.h +++ b/tools/perf/ui/gtk/gtk.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _PERF_GTK_H_ #define _PERF_GTK_H_ 1 diff --git a/tools/perf/ui/gtk/helpline.c b/tools/perf/ui/gtk/helpline.c index 3388cbd12186..fbf1ea9ce9a2 100644 --- a/tools/perf/ui/gtk/helpline.c +++ b/tools/perf/ui/gtk/helpline.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <stdio.h> #include <string.h> diff --git a/tools/perf/ui/gtk/hists.c b/tools/perf/ui/gtk/hists.c index e24f83957705..24e1ec201ffd 100644 --- a/tools/perf/ui/gtk/hists.c +++ b/tools/perf/ui/gtk/hists.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "../evlist.h" #include "../cache.h" #include "../evsel.h" diff --git a/tools/perf/ui/gtk/progress.c b/tools/perf/ui/gtk/progress.c index b656655fbc39..b6ad8857da78 100644 --- a/tools/perf/ui/gtk/progress.c +++ b/tools/perf/ui/gtk/progress.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <inttypes.h> #include "gtk.h" diff --git a/tools/perf/ui/gtk/setup.c b/tools/perf/ui/gtk/setup.c index 1d57676f8212..506e73b3834c 100644 --- a/tools/perf/ui/gtk/setup.c +++ b/tools/perf/ui/gtk/setup.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "gtk.h" #include "../../util/cache.h" #include "../../util/debug.h" diff --git a/tools/perf/ui/gtk/util.c b/tools/perf/ui/gtk/util.c index 00b91921edb1..7250d8101c8f 100644 --- a/tools/perf/ui/gtk/util.c +++ b/tools/perf/ui/gtk/util.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "../util.h" #include "../../util/util.h" #include "../../util/debug.h" diff --git a/tools/perf/ui/helpline.c b/tools/perf/ui/helpline.c index 379039ab00d8..b3c421429ed4 100644 --- a/tools/perf/ui/helpline.c +++ b/tools/perf/ui/helpline.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/tools/perf/ui/helpline.h b/tools/perf/ui/helpline.h index d52d0a1a881b..8f775a053ca3 100644 --- a/tools/perf/ui/helpline.h +++ b/tools/perf/ui/helpline.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _PERF_UI_HELPLINE_H_ #define _PERF_UI_HELPLINE_H_ 1 diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c index ddb2c6fbdf91..706f6f1e9c7d 100644 --- a/tools/perf/ui/hist.c +++ b/tools/perf/ui/hist.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <inttypes.h> #include <math.h> #include <linux/compiler.h> @@ -532,7 +533,7 @@ void perf_hpp_list__prepend_sort_field(struct perf_hpp_list *list, void perf_hpp__column_unregister(struct perf_hpp_fmt *format) { - list_del(&format->list); + list_del_init(&format->list); } void perf_hpp__cancel_cumulate(void) @@ -606,6 +607,13 @@ next: static void fmt_free(struct perf_hpp_fmt *fmt) { + /* + * At this point fmt should be completely + * unhooked, if not it's a bug. + */ + BUG_ON(!list_empty(&fmt->list)); + BUG_ON(!list_empty(&fmt->sort_list)); + if (fmt->free) fmt->free(fmt); } diff --git a/tools/perf/ui/keysyms.h b/tools/perf/ui/keysyms.h index 65092d576b4e..fbfac29077f2 100644 --- a/tools/perf/ui/keysyms.h +++ b/tools/perf/ui/keysyms.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _PERF_KEYSYMS_H_ #define _PERF_KEYSYMS_H_ 1 diff --git a/tools/perf/ui/libslang.h b/tools/perf/ui/libslang.h index db816695ad97..c0686cda39a5 100644 --- a/tools/perf/ui/libslang.h +++ b/tools/perf/ui/libslang.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _PERF_UI_SLANG_H_ #define _PERF_UI_SLANG_H_ 1 /* diff --git a/tools/perf/ui/progress.c b/tools/perf/ui/progress.c index ae91c8148edf..b5a5df14d702 100644 --- a/tools/perf/ui/progress.c +++ b/tools/perf/ui/progress.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <linux/kernel.h> #include "../cache.h" #include "progress.h" diff --git a/tools/perf/ui/progress.h b/tools/perf/ui/progress.h index 717d39d3052b..594bbe6935dd 100644 --- a/tools/perf/ui/progress.h +++ b/tools/perf/ui/progress.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _PERF_UI_PROGRESS_H_ #define _PERF_UI_PROGRESS_H_ 1 diff --git a/tools/perf/ui/setup.c b/tools/perf/ui/setup.c index caf1ce6f5152..44fe824e96cd 100644 --- a/tools/perf/ui/setup.c +++ b/tools/perf/ui/setup.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <pthread.h> #include <dlfcn.h> diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c index 8bdb7a500181..de2810ae16be 100644 --- a/tools/perf/ui/stdio/hist.c +++ b/tools/perf/ui/stdio/hist.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <stdio.h> #include <linux/string.h> diff --git a/tools/perf/ui/tui/helpline.c b/tools/perf/ui/tui/helpline.c index 88f5143a5981..4ca799aadb4e 100644 --- a/tools/perf/ui/tui/helpline.c +++ b/tools/perf/ui/tui/helpline.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/tools/perf/ui/tui/progress.c b/tools/perf/ui/tui/progress.c index c4b99008e2c9..236bcb620ae4 100644 --- a/tools/perf/ui/tui/progress.c +++ b/tools/perf/ui/tui/progress.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "../cache.h" #include "../progress.h" #include "../libslang.h" diff --git a/tools/perf/ui/tui/setup.c b/tools/perf/ui/tui/setup.c index d9350a1da48b..d4ac41679721 100644 --- a/tools/perf/ui/tui/setup.c +++ b/tools/perf/ui/tui/setup.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <errno.h> #include <signal.h> #include <stdbool.h> diff --git a/tools/perf/ui/tui/tui.h b/tools/perf/ui/tui/tui.h index 18961c7b6ec5..8de06f634c56 100644 --- a/tools/perf/ui/tui/tui.h +++ b/tools/perf/ui/tui/tui.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _PERF_TUI_H_ #define _PERF_TUI_H_ 1 diff --git a/tools/perf/ui/tui/util.c b/tools/perf/ui/tui/util.c index d96ad7c8325d..b9794d6185af 100644 --- a/tools/perf/ui/tui/util.c +++ b/tools/perf/ui/tui/util.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "../../util/util.h" #include <signal.h> #include <stdbool.h> diff --git a/tools/perf/ui/ui.h b/tools/perf/ui/ui.h index 4b6fb6c7a542..9b6fdf06e1d2 100644 --- a/tools/perf/ui/ui.h +++ b/tools/perf/ui/ui.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _PERF_UI_H_ #define _PERF_UI_H_ 1 diff --git a/tools/perf/ui/util.c b/tools/perf/ui/util.c index e3e0a963d03a..63bf06e80ab9 100644 --- a/tools/perf/ui/util.c +++ b/tools/perf/ui/util.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "util.h" #include "../debug.h" diff --git a/tools/perf/ui/util.h b/tools/perf/ui/util.h index 361f08c52d37..5e44223b56fa 100644 --- a/tools/perf/ui/util.h +++ b/tools/perf/ui/util.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _PERF_UI_UTIL_H_ #define _PERF_UI_UTIL_H_ 1 diff --git a/tools/perf/util/PERF-VERSION-GEN b/tools/perf/util/PERF-VERSION-GEN index 39f17507578d..3802cee5e188 100755 --- a/tools/perf/util/PERF-VERSION-GEN +++ b/tools/perf/util/PERF-VERSION-GEN @@ -1,4 +1,5 @@ #!/bin/sh +# SPDX-License-Identifier: GPL-2.0 if [ $# -eq 1 ] ; then OUTPUT=$1 diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 4397a8b6e6cd..aa66791b1bfc 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c @@ -606,9 +606,19 @@ static struct arch *arch__find(const char *name) int symbol__alloc_hist(struct symbol *sym) { struct annotation *notes = symbol__annotation(sym); - const size_t size = symbol__size(sym); + size_t size = symbol__size(sym); size_t sizeof_sym_hist; + /* + * Add buffer of one element for zero length symbol. + * When sample is taken from first instruction of + * zero length symbol, perf still resolves it and + * shows symbol name in perf report and allows to + * annotate it. + */ + if (size == 0) + size = 1; + /* Check for overflow when calculating sizeof_sym_hist */ if (size > (SIZE_MAX - sizeof(struct sym_hist)) / sizeof(struct sym_hist_entry)) return -1; diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h index 9ce575c25fd9..f6ba3560de5e 100644 --- a/tools/perf/util/annotate.h +++ b/tools/perf/util/annotate.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_ANNOTATE_H #define __PERF_ANNOTATE_H diff --git a/tools/perf/util/block-range.c b/tools/perf/util/block-range.c index 7b3e1d75d803..f1451c987eec 100644 --- a/tools/perf/util/block-range.c +++ b/tools/perf/util/block-range.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "block-range.h" #include "annotate.h" diff --git a/tools/perf/util/block-range.h b/tools/perf/util/block-range.h index a8c841381131..a5ba719d69fb 100644 --- a/tools/perf/util/block-range.h +++ b/tools/perf/util/block-range.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_BLOCK_RANGE_H #define __PERF_BLOCK_RANGE_H diff --git a/tools/perf/util/bpf-loader.c b/tools/perf/util/bpf-loader.c index 4a1264c66101..72c107fcbc5a 100644 --- a/tools/perf/util/bpf-loader.c +++ b/tools/perf/util/bpf-loader.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * bpf-loader.c * diff --git a/tools/perf/util/bpf-loader.h b/tools/perf/util/bpf-loader.h index 48863867878b..5d3aefd6fae7 100644 --- a/tools/perf/util/bpf-loader.h +++ b/tools/perf/util/bpf-loader.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * Copyright (C) 2015, Wang Nan <wangnan0@huawei.com> * Copyright (C) 2015, Huawei Inc. diff --git a/tools/perf/util/bpf-prologue.c b/tools/perf/util/bpf-prologue.c index 827f9140f3b8..29347756b0af 100644 --- a/tools/perf/util/bpf-prologue.c +++ b/tools/perf/util/bpf-prologue.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * bpf-prologue.c * diff --git a/tools/perf/util/bpf-prologue.h b/tools/perf/util/bpf-prologue.h index ba564838375f..c50c7358009f 100644 --- a/tools/perf/util/bpf-prologue.h +++ b/tools/perf/util/bpf-prologue.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * Copyright (C) 2015, He Kuang <hekuang@huawei.com> * Copyright (C) 2015, Huawei Inc. diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c index c1a06fcd7e70..7f8553630c4d 100644 --- a/tools/perf/util/build-id.c +++ b/tools/perf/util/build-id.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * build-id.c * diff --git a/tools/perf/util/build-id.h b/tools/perf/util/build-id.h index c94b0dcbfd74..f0c565164a97 100644 --- a/tools/perf/util/build-id.h +++ b/tools/perf/util/build-id.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef PERF_BUILD_ID_H_ #define PERF_BUILD_ID_H_ 1 diff --git a/tools/perf/util/c++/clang-c.h b/tools/perf/util/c++/clang-c.h index ccafcf72b37a..e513366f2ee0 100644 --- a/tools/perf/util/c++/clang-c.h +++ b/tools/perf/util/c++/clang-c.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef PERF_UTIL_CLANG_C_H #define PERF_UTIL_CLANG_C_H diff --git a/tools/perf/util/c++/clang-test.cpp b/tools/perf/util/c++/clang-test.cpp index 9b11e8c82798..a4014d786676 100644 --- a/tools/perf/util/c++/clang-test.cpp +++ b/tools/perf/util/c++/clang-test.cpp @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "clang.h" #include "clang-c.h" #include "llvm/IR/Function.h" diff --git a/tools/perf/util/c++/clang.cpp b/tools/perf/util/c++/clang.cpp index 1e974152cac2..1bfc946e37dc 100644 --- a/tools/perf/util/c++/clang.cpp +++ b/tools/perf/util/c++/clang.cpp @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * llvm C frontend for perf. Support dynamically compile C file * diff --git a/tools/perf/util/c++/clang.h b/tools/perf/util/c++/clang.h index dd8b0427550d..6ce33e22f23c 100644 --- a/tools/perf/util/c++/clang.h +++ b/tools/perf/util/c++/clang.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef PERF_UTIL_CLANG_H #define PERF_UTIL_CLANG_H diff --git a/tools/perf/util/cache.h b/tools/perf/util/cache.h index 0175765c05b9..9f2e36ef5072 100644 --- a/tools/perf/util/cache.h +++ b/tools/perf/util/cache.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_CACHE_H #define __PERF_CACHE_H diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c index 510b513e0f01..6031933d811c 100644 --- a/tools/perf/util/callchain.c +++ b/tools/perf/util/callchain.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2009-2011, Frederic Weisbecker <fweisbec@gmail.com> * @@ -65,8 +66,6 @@ static int parse_callchain_mode(const char *value) callchain_param.mode = CHAIN_FOLDED; return 0; } - - pr_err("Invalid callchain mode: %s\n", value); return -1; } @@ -82,8 +81,6 @@ static int parse_callchain_order(const char *value) callchain_param.order_set = true; return 0; } - - pr_err("Invalid callchain order: %s\n", value); return -1; } @@ -105,8 +102,6 @@ static int parse_callchain_sort_key(const char *value) callchain_param.branch_callstack = 1; return 0; } - - pr_err("Invalid callchain sort key: %s\n", value); return -1; } @@ -124,8 +119,6 @@ static int parse_callchain_value(const char *value) callchain_param.value = CCVAL_COUNT; return 0; } - - pr_err("Invalid callchain config key: %s\n", value); return -1; } @@ -319,12 +312,27 @@ int perf_callchain_config(const char *var, const char *value) return ret; } - if (!strcmp(var, "print-type")) - return parse_callchain_mode(value); - if (!strcmp(var, "order")) - return parse_callchain_order(value); - if (!strcmp(var, "sort-key")) - return parse_callchain_sort_key(value); + if (!strcmp(var, "print-type")){ + int ret; + ret = parse_callchain_mode(value); + if (ret == -1) + pr_err("Invalid callchain mode: %s\n", value); + return ret; + } + if (!strcmp(var, "order")){ + int ret; + ret = parse_callchain_order(value); + if (ret == -1) + pr_err("Invalid callchain order: %s\n", value); + return ret; + } + if (!strcmp(var, "sort-key")){ + int ret; + ret = parse_callchain_sort_key(value); + if (ret == -1) + pr_err("Invalid callchain sort key: %s\n", value); + return ret; + } if (!strcmp(var, "threshold")) { callchain_param.min_percent = strtod(value, &endptr); if (value == endptr) { @@ -678,6 +686,8 @@ static enum match_result match_chain(struct callchain_cursor_node *node, { struct symbol *sym = node->sym; u64 left, right; + struct dso *left_dso = NULL; + struct dso *right_dso = NULL; if (callchain_param.key == CCKEY_SRCLINE) { enum match_result match = match_chain_srcline(node, cnode); @@ -689,12 +699,14 @@ static enum match_result match_chain(struct callchain_cursor_node *node, if (cnode->ms.sym && sym && callchain_param.key == CCKEY_FUNCTION) { left = cnode->ms.sym->start; right = sym->start; + left_dso = cnode->ms.map->dso; + right_dso = node->map->dso; } else { left = cnode->ip; right = node->ip; } - if (left == right) { + if (left == right && left_dso == right_dso) { if (node->branch) { cnode->branch_count++; diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h index 1ed6fc61d0a5..f967aa47d0a1 100644 --- a/tools/perf/util/callchain.h +++ b/tools/perf/util/callchain.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_CALLCHAIN_H #define __PERF_CALLCHAIN_H diff --git a/tools/perf/util/cgroup.c b/tools/perf/util/cgroup.c index 0e77bc9e5f3c..d9ffc1e6eb39 100644 --- a/tools/perf/util/cgroup.c +++ b/tools/perf/util/cgroup.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "util.h" #include "../perf.h" #include <subcmd/parse-options.h> diff --git a/tools/perf/util/cgroup.h b/tools/perf/util/cgroup.h index d91966b97cbd..afafc87e9201 100644 --- a/tools/perf/util/cgroup.h +++ b/tools/perf/util/cgroup.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __CGROUP_H__ #define __CGROUP_H__ diff --git a/tools/perf/util/cloexec.c b/tools/perf/util/cloexec.c index 4b4f00df58a8..ca0fff6272be 100644 --- a/tools/perf/util/cloexec.c +++ b/tools/perf/util/cloexec.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <errno.h> #include <sched.h> #include "util.h" diff --git a/tools/perf/util/cloexec.h b/tools/perf/util/cloexec.h index 94a5a7d829d5..78216b1015c4 100644 --- a/tools/perf/util/cloexec.h +++ b/tools/perf/util/cloexec.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_CLOEXEC_H #define __PERF_CLOEXEC_H diff --git a/tools/perf/util/color.c b/tools/perf/util/color.c index dbbf89b050a5..39e628b8938e 100644 --- a/tools/perf/util/color.c +++ b/tools/perf/util/color.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <linux/kernel.h> #include "cache.h" #include "config.h" diff --git a/tools/perf/util/color.h b/tools/perf/util/color.h index 52122bcc3170..22777b1812ee 100644 --- a/tools/perf/util/color.h +++ b/tools/perf/util/color.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_COLOR_H #define __PERF_COLOR_H diff --git a/tools/perf/util/comm.c b/tools/perf/util/comm.c index 7bc981b6bf29..8808570f8e9c 100644 --- a/tools/perf/util/comm.c +++ b/tools/perf/util/comm.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "comm.h" #include "util.h" #include <errno.h> diff --git a/tools/perf/util/comm.h b/tools/perf/util/comm.h index 71c9c39340d4..3e5c438fe85e 100644 --- a/tools/perf/util/comm.h +++ b/tools/perf/util/comm.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_COMM_H #define __PERF_COMM_H diff --git a/tools/perf/util/compress.h b/tools/perf/util/compress.h index 67fd1bb7c2b7..ecca688a25fb 100644 --- a/tools/perf/util/compress.h +++ b/tools/perf/util/compress.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef PERF_COMPRESS_H #define PERF_COMPRESS_H diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c index bc75596f9e79..4b893c622236 100644 --- a/tools/perf/util/config.c +++ b/tools/perf/util/config.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * config.c * diff --git a/tools/perf/util/config.h b/tools/perf/util/config.h index b6bb11f3f165..baf82bf227ac 100644 --- a/tools/perf/util/config.h +++ b/tools/perf/util/config.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_CONFIG_H #define __PERF_CONFIG_H diff --git a/tools/perf/util/counts.c b/tools/perf/util/counts.c index c4af82ab7808..03032b410c29 100644 --- a/tools/perf/util/counts.c +++ b/tools/perf/util/counts.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <errno.h> #include <stdlib.h> #include "evsel.h" diff --git a/tools/perf/util/counts.h b/tools/perf/util/counts.h index cb45a6aecf9d..0d1050ccc586 100644 --- a/tools/perf/util/counts.h +++ b/tools/perf/util/counts.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_COUNTS_H #define __PERF_COUNTS_H diff --git a/tools/perf/util/cpumap.c b/tools/perf/util/cpumap.c index 37b3bb79ee08..1ccbd3342069 100644 --- a/tools/perf/util/cpumap.c +++ b/tools/perf/util/cpumap.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "util.h" #include <api/fs/fs.h> #include "../perf.h" diff --git a/tools/perf/util/cpumap.h b/tools/perf/util/cpumap.h index 6b8bff87481d..ed8999d1a640 100644 --- a/tools/perf/util/cpumap.h +++ b/tools/perf/util/cpumap.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_CPUMAP_H #define __PERF_CPUMAP_H diff --git a/tools/perf/util/ctype.c b/tools/perf/util/ctype.c index 4b261c2ec0f1..ee4c1e8ed54b 100644 --- a/tools/perf/util/ctype.c +++ b/tools/perf/util/ctype.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Sane locale-independent, ASCII ctype. * diff --git a/tools/perf/util/data-convert-bt.h b/tools/perf/util/data-convert-bt.h index 9a3b587f76c1..821674d63c4e 100644 --- a/tools/perf/util/data-convert-bt.h +++ b/tools/perf/util/data-convert-bt.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __DATA_CONVERT_BT_H #define __DATA_CONVERT_BT_H #include "data-convert.h" diff --git a/tools/perf/util/data-convert.h b/tools/perf/util/data-convert.h index 5314962fe95b..af90b6076c06 100644 --- a/tools/perf/util/data-convert.h +++ b/tools/perf/util/data-convert.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __DATA_CONVERT_H #define __DATA_CONVERT_H diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c index 263f5a906ba5..79192758bdb3 100644 --- a/tools/perf/util/data.c +++ b/tools/perf/util/data.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <linux/compiler.h> #include <linux/kernel.h> #include <sys/types.h> diff --git a/tools/perf/util/data.h b/tools/perf/util/data.h index ae510ce16cb1..80241ba78101 100644 --- a/tools/perf/util/data.h +++ b/tools/perf/util/data.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_DATA_H #define __PERF_DATA_H diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c index a5b3777ffee6..dc8b53b6950e 100644 --- a/tools/perf/util/debug.c +++ b/tools/perf/util/debug.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* For general debugging purposes */ #include "../perf.h" diff --git a/tools/perf/util/debug.h b/tools/perf/util/debug.h index c818bdb1c1ab..77445dfc5c7d 100644 --- a/tools/perf/util/debug.h +++ b/tools/perf/util/debug.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* For debugging general purposes */ #ifndef __PERF_DEBUG_H #define __PERF_DEBUG_H diff --git a/tools/perf/util/demangle-java.c b/tools/perf/util/demangle-java.c index cb66d334f532..e4c486756053 100644 --- a/tools/perf/util/demangle-java.c +++ b/tools/perf/util/demangle-java.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <sys/types.h> #include <stdio.h> #include <string.h> diff --git a/tools/perf/util/demangle-java.h b/tools/perf/util/demangle-java.h index a981c1f968fe..f936c8eabe5d 100644 --- a/tools/perf/util/demangle-java.h +++ b/tools/perf/util/demangle-java.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_DEMANGLE_JAVA #define __PERF_DEMANGLE_JAVA 1 /* diff --git a/tools/perf/util/demangle-rust.c b/tools/perf/util/demangle-rust.c index f9dafa888c06..423afbbd386b 100644 --- a/tools/perf/util/demangle-rust.c +++ b/tools/perf/util/demangle-rust.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <string.h> #include "util.h" #include "debug.h" diff --git a/tools/perf/util/demangle-rust.h b/tools/perf/util/demangle-rust.h index 7b41ead7e0dd..2fca618b1aa5 100644 --- a/tools/perf/util/demangle-rust.h +++ b/tools/perf/util/demangle-rust.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_DEMANGLE_RUST #define __PERF_DEMANGLE_RUST 1 diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c index b9e087fb8247..00c98c968cb1 100644 --- a/tools/perf/util/dso.c +++ b/tools/perf/util/dso.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <asm/bug.h> #include <linux/kernel.h> #include <sys/time.h> diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h index f886141678eb..926ff2e7f668 100644 --- a/tools/perf/util/dso.h +++ b/tools/perf/util/dso.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_DSO #define __PERF_DSO diff --git a/tools/perf/util/dump-insn.c b/tools/perf/util/dump-insn.c index ffbdb19f05d0..10988d3de7ce 100644 --- a/tools/perf/util/dump-insn.c +++ b/tools/perf/util/dump-insn.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <linux/compiler.h> #include "dump-insn.h" diff --git a/tools/perf/util/dump-insn.h b/tools/perf/util/dump-insn.h index 90fb115981cf..0e06280a8860 100644 --- a/tools/perf/util/dump-insn.h +++ b/tools/perf/util/dump-insn.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_DUMP_INSN_H #define __PERF_DUMP_INSN_H 1 diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c index c708395b3cb6..db55eddce8cd 100644 --- a/tools/perf/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * dwarf-regs.c : Mapping of DWARF debug register numbers into register names. * diff --git a/tools/perf/util/env.c b/tools/perf/util/env.c index 9e21538c42ae..6276b340f893 100644 --- a/tools/perf/util/env.c +++ b/tools/perf/util/env.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "cpumap.h" #include "env.h" #include "util.h" diff --git a/tools/perf/util/env.h b/tools/perf/util/env.h index b164dfd2dcbf..1eb35b190b34 100644 --- a/tools/perf/util/env.h +++ b/tools/perf/util/env.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_ENV_H #define __PERF_ENV_H diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 1c905ba3641b..fc690fecbfd6 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <dirent.h> #include <errno.h> #include <inttypes.h> diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h index ee7bcc898d35..5524ee69279c 100644 --- a/tools/perf/util/event.h +++ b/tools/perf/util/event.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_RECORD_H #define __PERF_RECORD_H diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h index bf2c4936e35f..c1750a400bb7 100644 --- a/tools/perf/util/evlist.h +++ b/tools/perf/util/evlist.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_EVLIST_H #define __PERF_EVLIST_H 1 diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 4bb89373eb52..0dccdb89572c 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -271,12 +271,17 @@ struct perf_evsel *perf_evsel__new_idx(struct perf_event_attr *attr, int idx) return evsel; } +static bool perf_event_can_profile_kernel(void) +{ + return geteuid() == 0 || perf_event_paranoid() == -1; +} + struct perf_evsel *perf_evsel__new_cycles(bool precise) { struct perf_event_attr attr = { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CPU_CYCLES, - .exclude_kernel = geteuid() != 0, + .exclude_kernel = !perf_event_can_profile_kernel(), }; struct perf_evsel *evsel; diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index dd2c4b5112a5..b4df79d72329 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_EVSEL_H #define __PERF_EVSEL_H 1 diff --git a/tools/perf/util/evsel_fprintf.c b/tools/perf/util/evsel_fprintf.c index 583f3a602506..1fd7c2e46db2 100644 --- a/tools/perf/util/evsel_fprintf.c +++ b/tools/perf/util/evsel_fprintf.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <inttypes.h> #include <stdio.h> #include <stdbool.h> diff --git a/tools/perf/util/expr.h b/tools/perf/util/expr.h index 400ef9eab00a..046160831f90 100644 --- a/tools/perf/util/expr.h +++ b/tools/perf/util/expr.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef PARSE_CTX_H #define PARSE_CTX_H 1 diff --git a/tools/perf/util/find-vdso-map.c b/tools/perf/util/find-vdso-map.c index 95ef1cffc056..d7823e3508fc 100644 --- a/tools/perf/util/find-vdso-map.c +++ b/tools/perf/util/find-vdso-map.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 static int find_vdso_map(void **start, void **end) { FILE *maps; diff --git a/tools/perf/util/genelf.h b/tools/perf/util/genelf.h index 2424bd9862a3..de322d51c7fe 100644 --- a/tools/perf/util/genelf.h +++ b/tools/perf/util/genelf.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __GENELF_H__ #define __GENELF_H__ diff --git a/tools/perf/util/generate-cmdlist.sh b/tools/perf/util/generate-cmdlist.sh index 0ac2037c970c..9bbcec4e3365 100755 --- a/tools/perf/util/generate-cmdlist.sh +++ b/tools/perf/util/generate-cmdlist.sh @@ -1,4 +1,5 @@ #!/bin/sh +# SPDX-License-Identifier: GPL-2.0 echo "/* Automatically generated by $0 */ struct cmdname_help diff --git a/tools/perf/util/group.h b/tools/perf/util/group.h index 116debe7a995..f36c7e31780a 100644 --- a/tools/perf/util/group.h +++ b/tools/perf/util/group.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef GROUP_H #define GROUP_H 1 diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 605bbd5404fb..ba0cea8fef72 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <errno.h> #include <inttypes.h> #include "util.h" diff --git a/tools/perf/util/header.h b/tools/perf/util/header.h index f7a16ee527b8..29ccbfdf8724 100644 --- a/tools/perf/util/header.h +++ b/tools/perf/util/header.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_HEADER_H #define __PERF_HEADER_H diff --git a/tools/perf/util/help-unknown-cmd.c b/tools/perf/util/help-unknown-cmd.c index 15b95300d7f3..4f07a5ba5030 100644 --- a/tools/perf/util/help-unknown-cmd.c +++ b/tools/perf/util/help-unknown-cmd.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "cache.h" #include "config.h" #include <poll.h> diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index e60d8d8ea4c2..097473600d94 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "util.h" #include "build-id.h" #include "hist.h" diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index e60dda26a920..f6630cb95eff 100644 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_HIST_H #define __PERF_HIST_H diff --git a/tools/perf/util/include/asm/asm-offsets.h b/tools/perf/util/include/asm/asm-offsets.h index ed538942523d..3aff4cf44944 100644 --- a/tools/perf/util/include/asm/asm-offsets.h +++ b/tools/perf/util/include/asm/asm-offsets.h @@ -1 +1,2 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* stub */ diff --git a/tools/perf/util/include/asm/cpufeature.h b/tools/perf/util/include/asm/cpufeature.h index acffd5e4d1d4..2270481c7e0a 100644 --- a/tools/perf/util/include/asm/cpufeature.h +++ b/tools/perf/util/include/asm/cpufeature.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef PERF_CPUFEATURE_H #define PERF_CPUFEATURE_H diff --git a/tools/perf/util/include/asm/dwarf2.h b/tools/perf/util/include/asm/dwarf2.h index afe38199e922..e9876be63dbf 100644 --- a/tools/perf/util/include/asm/dwarf2.h +++ b/tools/perf/util/include/asm/dwarf2.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef PERF_DWARF2_H #define PERF_DWARF2_H diff --git a/tools/perf/util/include/asm/uaccess.h b/tools/perf/util/include/asm/uaccess.h index d0f72b8fcc35..6a6f4b990547 100644 --- a/tools/perf/util/include/asm/uaccess.h +++ b/tools/perf/util/include/asm/uaccess.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _PERF_ASM_UACCESS_H_ #define _PERF_ASM_UACCESS_H_ diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include/dwarf-regs.h index 43bfd8da7919..7d99a084e82d 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _PERF_DWARF_REGS_H_ #define _PERF_DWARF_REGS_H_ diff --git a/tools/perf/util/include/linux/linkage.h b/tools/perf/util/include/linux/linkage.h index 06387cffe125..f01d48a8d707 100644 --- a/tools/perf/util/include/linux/linkage.h +++ b/tools/perf/util/include/linux/linkage.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef PERF_LINUX_LINKAGE_H_ #define PERF_LINUX_LINKAGE_H_ diff --git a/tools/perf/util/intel-pt-decoder/gen-insn-attr-x86.awk b/tools/perf/util/intel-pt-decoder/gen-insn-attr-x86.awk index 54e961659514..ddd5c4c21129 100644 --- a/tools/perf/util/intel-pt-decoder/gen-insn-attr-x86.awk +++ b/tools/perf/util/intel-pt-decoder/gen-insn-attr-x86.awk @@ -1,4 +1,5 @@ #!/bin/awk -f +# SPDX-License-Identifier: GPL-2.0 # gen-insn-attr-x86.awk: Instruction attribute table generator # Written by Masami Hiramatsu <mhiramat@redhat.com> # diff --git a/tools/perf/util/intlist.h b/tools/perf/util/intlist.h index 020b9ca1b47e..85bab8735fa9 100644 --- a/tools/perf/util/intlist.h +++ b/tools/perf/util/intlist.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_INTLIST_H #define __PERF_INTLIST_H diff --git a/tools/perf/util/jit.h b/tools/perf/util/jit.h index 3f42ee4d2a0b..c2582fa9fe21 100644 --- a/tools/perf/util/jit.h +++ b/tools/perf/util/jit.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __JIT_H__ #define __JIT_H__ diff --git a/tools/perf/util/jitdump.c b/tools/perf/util/jitdump.c index 9084930e1757..36483db032e8 100644 --- a/tools/perf/util/jitdump.c +++ b/tools/perf/util/jitdump.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <sys/sysmacros.h> #include <sys/types.h> #include <errno.h> diff --git a/tools/perf/util/kvm-stat.h b/tools/perf/util/kvm-stat.h index d01e73592f6e..7b1f06567521 100644 --- a/tools/perf/util/kvm-stat.h +++ b/tools/perf/util/kvm-stat.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_KVM_STAT_H #define __PERF_KVM_STAT_H diff --git a/tools/perf/util/levenshtein.c b/tools/perf/util/levenshtein.c index f616e4f65b67..a217ecf0359d 100644 --- a/tools/perf/util/levenshtein.c +++ b/tools/perf/util/levenshtein.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "levenshtein.h" #include <errno.h> #include <stdlib.h> diff --git a/tools/perf/util/levenshtein.h b/tools/perf/util/levenshtein.h index b0fcb6d8a881..34ca173c557d 100644 --- a/tools/perf/util/levenshtein.h +++ b/tools/perf/util/levenshtein.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_LEVENSHTEIN_H #define __PERF_LEVENSHTEIN_H diff --git a/tools/perf/util/libunwind/arm64.c b/tools/perf/util/libunwind/arm64.c index 6559bc586643..66756e6be111 100644 --- a/tools/perf/util/libunwind/arm64.c +++ b/tools/perf/util/libunwind/arm64.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * This file setups defines to compile arch specific binary from the * generic one. diff --git a/tools/perf/util/libunwind/x86_32.c b/tools/perf/util/libunwind/x86_32.c index 957ffff72428..c5e568188e19 100644 --- a/tools/perf/util/libunwind/x86_32.c +++ b/tools/perf/util/libunwind/x86_32.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * This file setups defines to compile arch specific binary from the * generic one. diff --git a/tools/perf/util/llvm-utils.c b/tools/perf/util/llvm-utils.c index 209b0c82eff4..4952b429caa7 100644 --- a/tools/perf/util/llvm-utils.c +++ b/tools/perf/util/llvm-utils.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2015, Wang Nan <wangnan0@huawei.com> * Copyright (C) 2015, Huawei Inc. diff --git a/tools/perf/util/llvm-utils.h b/tools/perf/util/llvm-utils.h index c87a2a92a88f..d3ad8deb5db4 100644 --- a/tools/perf/util/llvm-utils.h +++ b/tools/perf/util/llvm-utils.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * Copyright (C) 2015, Wang Nan <wangnan0@huawei.com> * Copyright (C) 2015, Huawei Inc. diff --git a/tools/perf/util/lzma.c b/tools/perf/util/lzma.c index 4ca7c5c6cdcd..07498eaddc08 100644 --- a/tools/perf/util/lzma.c +++ b/tools/perf/util/lzma.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <errno.h> #include <lzma.h> #include <stdio.h> diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index df709363ef69..bd5d5b5e2218 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <dirent.h> #include <errno.h> #include <inttypes.h> diff --git a/tools/perf/util/machine.h b/tools/perf/util/machine.h index 3cdb1340f917..d551aa80a59b 100644 --- a/tools/perf/util/machine.h +++ b/tools/perf/util/machine.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_MACHINE_H #define __PERF_MACHINE_H diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c index bdaa0a4edc17..4e7bd2750122 100644 --- a/tools/perf/util/map.c +++ b/tools/perf/util/map.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "symbol.h" #include <errno.h> #include <inttypes.h> diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h index 73aacf7a7dc4..1fb9b8589adc 100644 --- a/tools/perf/util/map.h +++ b/tools/perf/util/map.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_MAP_H #define __PERF_MAP_H diff --git a/tools/perf/util/mem-events.c b/tools/perf/util/mem-events.c index 28afe5fa84d6..93f74d8d3cdd 100644 --- a/tools/perf/util/mem-events.c +++ b/tools/perf/util/mem-events.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <stddef.h> #include <stdlib.h> #include <string.h> diff --git a/tools/perf/util/mem-events.h b/tools/perf/util/mem-events.h index 40f72ee4f42a..a889ec2fa9f5 100644 --- a/tools/perf/util/mem-events.h +++ b/tools/perf/util/mem-events.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_MEM_EVENTS_H #define __PERF_MEM_EVENTS_H diff --git a/tools/perf/util/memswap.c b/tools/perf/util/memswap.c index 55f7faa8d9ec..c1317e4983bc 100644 --- a/tools/perf/util/memswap.c +++ b/tools/perf/util/memswap.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <byteswap.h> #include "memswap.h" #include <linux/types.h> diff --git a/tools/perf/util/memswap.h b/tools/perf/util/memswap.h index 7d1b1c34bb57..1e29ff903ca9 100644 --- a/tools/perf/util/memswap.h +++ b/tools/perf/util/memswap.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef PERF_MEMSWAP_H_ #define PERF_MEMSWAP_H_ diff --git a/tools/perf/util/ordered-events.c b/tools/perf/util/ordered-events.c index 4de398cfb577..8e09fd2d842f 100644 --- a/tools/perf/util/ordered-events.c +++ b/tools/perf/util/ordered-events.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <errno.h> #include <inttypes.h> #include <linux/list.h> diff --git a/tools/perf/util/ordered-events.h b/tools/perf/util/ordered-events.h index e11468a9a6e4..96e5292d88e2 100644 --- a/tools/perf/util/ordered-events.h +++ b/tools/perf/util/ordered-events.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __ORDERED_EVENTS_H #define __ORDERED_EVENTS_H diff --git a/tools/perf/util/parse-branch-options.c b/tools/perf/util/parse-branch-options.c index e71fb5f31e84..bd779d9f4d1e 100644 --- a/tools/perf/util/parse-branch-options.c +++ b/tools/perf/util/parse-branch-options.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "perf.h" #include "util/util.h" #include "util/debug.h" diff --git a/tools/perf/util/parse-branch-options.h b/tools/perf/util/parse-branch-options.h index 6086fd90eb23..11d1722733f2 100644 --- a/tools/perf/util/parse-branch-options.h +++ b/tools/perf/util/parse-branch-options.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _PERF_PARSE_BRANCH_OPTIONS_H #define _PERF_PARSE_BRANCH_OPTIONS_H 1 #include <stdint.h> diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index f6257fb4f08c..56694e3409ea 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <linux/hw_breakpoint.h> #include <linux/err.h> #include <dirent.h> @@ -309,10 +310,11 @@ static char *get_config_name(struct list_head *head_terms) static struct perf_evsel * __add_event(struct list_head *list, int *idx, struct perf_event_attr *attr, - char *name, struct cpu_map *cpus, + char *name, struct perf_pmu *pmu, struct list_head *config_terms, bool auto_merge_stats) { struct perf_evsel *evsel; + struct cpu_map *cpus = pmu ? pmu->cpus : NULL; event_attr_init(attr); @@ -323,7 +325,7 @@ __add_event(struct list_head *list, int *idx, (*idx)++; evsel->cpus = cpu_map__get(cpus); evsel->own_cpus = cpu_map__get(cpus); - evsel->system_wide = !!cpus; + evsel->system_wide = pmu ? pmu->is_uncore : false; evsel->auto_merge_stats = auto_merge_stats; if (name) @@ -1233,7 +1235,7 @@ static int __parse_events_add_pmu(struct parse_events_state *parse_state, if (!head_config) { attr.type = pmu->type; - evsel = __add_event(list, &parse_state->idx, &attr, NULL, pmu->cpus, NULL, auto_merge_stats); + evsel = __add_event(list, &parse_state->idx, &attr, NULL, pmu, NULL, auto_merge_stats); return evsel ? 0 : -ENOMEM; } @@ -1254,7 +1256,7 @@ static int __parse_events_add_pmu(struct parse_events_state *parse_state, return -EINVAL; evsel = __add_event(list, &parse_state->idx, &attr, - get_config_name(head_config), pmu->cpus, + get_config_name(head_config), pmu, &config_terms, auto_merge_stats); if (evsel) { evsel->unit = info.unit; diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h index 635135125111..eed50b54bab3 100644 --- a/tools/perf/util/parse-events.h +++ b/tools/perf/util/parse-events.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_PARSE_EVENTS_H #define __PERF_PARSE_EVENTS_H /* diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l index c42edeac451f..6680e4fb7967 100644 --- a/tools/perf/util/parse-events.l +++ b/tools/perf/util/parse-events.l @@ -8,6 +8,9 @@ %{ #include <errno.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> #include "../perf.h" #include "parse-events.h" #include "parse-events-bison.h" @@ -53,9 +56,8 @@ static int str(yyscan_t scanner, int token) return token; } -static bool isbpf(yyscan_t scanner) +static bool isbpf_suffix(char *text) { - char *text = parse_events_get_text(scanner); int len = strlen(text); if (len < 2) @@ -68,6 +70,17 @@ static bool isbpf(yyscan_t scanner) return false; } +static bool isbpf(yyscan_t scanner) +{ + char *text = parse_events_get_text(scanner); + struct stat st; + + if (!isbpf_suffix(text)) + return false; + + return stat(text, &st) == 0; +} + /* * This function is called when the parser gets two kind of input: * @@ -141,6 +154,10 @@ do { \ yycolumn += yyleng; \ } while (0); +#define USER_REJECT \ + yycolumn -= yyleng; \ + REJECT + %} %x mem @@ -322,8 +339,8 @@ r{num_raw_hex} { return raw(yyscanner); } {num_hex} { return value(yyscanner, 16); } {modifier_event} { return str(yyscanner, PE_MODIFIER_EVENT); } -{bpf_object} { if (!isbpf(yyscanner)) REJECT; return str(yyscanner, PE_BPF_OBJECT); } -{bpf_source} { if (!isbpf(yyscanner)) REJECT; return str(yyscanner, PE_BPF_SOURCE); } +{bpf_object} { if (!isbpf(yyscanner)) USER_REJECT; return str(yyscanner, PE_BPF_OBJECT); } +{bpf_source} { if (!isbpf(yyscanner)) USER_REJECT; return str(yyscanner, PE_BPF_SOURCE); } {name} { return pmu_str_check(yyscanner); } "/" { BEGIN(config); return '/'; } - { return '-'; } diff --git a/tools/perf/util/parse-regs-options.c b/tools/perf/util/parse-regs-options.c index 646ecf736aad..e6599e290f46 100644 --- a/tools/perf/util/parse-regs-options.c +++ b/tools/perf/util/parse-regs-options.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "perf.h" #include "util/util.h" #include "util/debug.h" diff --git a/tools/perf/util/parse-regs-options.h b/tools/perf/util/parse-regs-options.h index 7d762b188007..cdefb1acf6be 100644 --- a/tools/perf/util/parse-regs-options.h +++ b/tools/perf/util/parse-regs-options.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _PERF_PARSE_REGS_OPTIONS_H #define _PERF_PARSE_REGS_OPTIONS_H 1 struct option; diff --git a/tools/perf/util/path.c b/tools/perf/util/path.c index 50ec3bc87a60..933f5c6bffb4 100644 --- a/tools/perf/util/path.c +++ b/tools/perf/util/path.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * I'm tired of doing "vsnprintf()" etc just to open a * file, so here's a "return static buffer with printf" diff --git a/tools/perf/util/path.h b/tools/perf/util/path.h index 9a276a58e3c2..14a254ada7eb 100644 --- a/tools/perf/util/path.h +++ b/tools/perf/util/path.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _PERF_PATH_H #define _PERF_PATH_H diff --git a/tools/perf/util/perf-hooks.c b/tools/perf/util/perf-hooks.c index d55092964da2..4f3aa8d99ef4 100644 --- a/tools/perf/util/perf-hooks.c +++ b/tools/perf/util/perf-hooks.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * perf_hooks.c * diff --git a/tools/perf/util/perf-hooks.h b/tools/perf/util/perf-hooks.h index 838d5797bc1e..27fbec62d4fe 100644 --- a/tools/perf/util/perf-hooks.h +++ b/tools/perf/util/perf-hooks.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef PERF_UTIL_PERF_HOOKS_H #define PERF_UTIL_PERF_HOOKS_H diff --git a/tools/perf/util/perf_regs.c b/tools/perf/util/perf_regs.c index b2ae039eff85..2acfcc527cac 100644 --- a/tools/perf/util/perf_regs.c +++ b/tools/perf/util/perf_regs.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <errno.h> #include "perf_regs.h" #include "event.h" diff --git a/tools/perf/util/perf_regs.h b/tools/perf/util/perf_regs.h index 32b37d19dcc3..c9319f8d17a6 100644 --- a/tools/perf/util/perf_regs.h +++ b/tools/perf/util/perf_regs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_REGS_H #define __PERF_REGS_H diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index ac16a9db1fb5..b10b35a63138 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <linux/list.h> #include <linux/compiler.h> #include <sys/types.h> @@ -470,17 +471,36 @@ static void pmu_read_sysfs(void) closedir(dir); } +static struct cpu_map *__pmu_cpumask(const char *path) +{ + FILE *file; + struct cpu_map *cpus; + + file = fopen(path, "r"); + if (!file) + return NULL; + + cpus = cpu_map__read(file); + fclose(file); + return cpus; +} + +/* + * Uncore PMUs have a "cpumask" file under sysfs. CPU PMUs (e.g. on arm/arm64) + * may have a "cpus" file. + */ +#define CPUS_TEMPLATE_UNCORE "%s/bus/event_source/devices/%s/cpumask" +#define CPUS_TEMPLATE_CPU "%s/bus/event_source/devices/%s/cpus" + static struct cpu_map *pmu_cpumask(const char *name) { - struct stat st; char path[PATH_MAX]; - FILE *file; struct cpu_map *cpus; const char *sysfs = sysfs__mountpoint(); const char *templates[] = { - "%s/bus/event_source/devices/%s/cpumask", - "%s/bus/event_source/devices/%s/cpus", - NULL + CPUS_TEMPLATE_UNCORE, + CPUS_TEMPLATE_CPU, + NULL }; const char **template; @@ -489,20 +509,25 @@ static struct cpu_map *pmu_cpumask(const char *name) for (template = templates; *template; template++) { snprintf(path, PATH_MAX, *template, sysfs, name); - if (stat(path, &st) == 0) - break; + cpus = __pmu_cpumask(path); + if (cpus) + return cpus; } - if (!*template) - return NULL; + return NULL; +} - file = fopen(path, "r"); - if (!file) - return NULL; +static bool pmu_is_uncore(const char *name) +{ + char path[PATH_MAX]; + struct cpu_map *cpus; + const char *sysfs = sysfs__mountpoint(); - cpus = cpu_map__read(file); - fclose(file); - return cpus; + snprintf(path, PATH_MAX, CPUS_TEMPLATE_UNCORE, sysfs, name); + cpus = __pmu_cpumask(path); + cpu_map__put(cpus); + + return !!cpus; } /* @@ -617,6 +642,8 @@ static struct perf_pmu *pmu_lookup(const char *name) pmu->cpus = pmu_cpumask(name); + pmu->is_uncore = pmu_is_uncore(name); + INIT_LIST_HEAD(&pmu->format); INIT_LIST_HEAD(&pmu->aliases); list_splice(&format, &pmu->format); diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h index 389e9729331f..eca99435f4a0 100644 --- a/tools/perf/util/pmu.h +++ b/tools/perf/util/pmu.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PMU_H #define __PMU_H @@ -22,6 +23,7 @@ struct perf_pmu { char *name; __u32 type; bool selectable; + bool is_uncore; struct perf_event_attr *default_config; struct cpu_map *cpus; struct list_head format; /* HEAD struct perf_pmu_format -> list */ diff --git a/tools/perf/util/print_binary.c b/tools/perf/util/print_binary.c index e908177b9976..779e35c9e566 100644 --- a/tools/perf/util/print_binary.c +++ b/tools/perf/util/print_binary.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "print_binary.h" #include <linux/log2.h> #include "sane_ctype.h" diff --git a/tools/perf/util/print_binary.h b/tools/perf/util/print_binary.h index da0427263d2d..2be3075e2b05 100644 --- a/tools/perf/util/print_binary.h +++ b/tools/perf/util/print_binary.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef PERF_PRINT_BINARY_H #define PERF_PRINT_BINARY_H diff --git a/tools/perf/util/probe-event.h b/tools/perf/util/probe-event.h index 078681d12168..45b14f020558 100644 --- a/tools/perf/util/probe-event.h +++ b/tools/perf/util/probe-event.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _PROBE_EVENT_H #define _PROBE_EVENT_H diff --git a/tools/perf/util/probe-file.h b/tools/perf/util/probe-file.h index 2ca4163abafe..63f29b1d22c1 100644 --- a/tools/perf/util/probe-file.h +++ b/tools/perf/util/probe-file.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PROBE_FILE_H #define __PROBE_FILE_H diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h index 27f061551012..16252980ff00 100644 --- a/tools/perf/util/probe-finder.h +++ b/tools/perf/util/probe-finder.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _PROBE_FINDER_H #define _PROBE_FINDER_H diff --git a/tools/perf/util/pstack.c b/tools/perf/util/pstack.c index b234a6e3d0d4..797fe1ae2d2e 100644 --- a/tools/perf/util/pstack.c +++ b/tools/perf/util/pstack.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Simple pointer stack * diff --git a/tools/perf/util/pstack.h b/tools/perf/util/pstack.h index ded7f2e36624..8729b8be061d 100644 --- a/tools/perf/util/pstack.h +++ b/tools/perf/util/pstack.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _PERF_PSTACK_ #define _PERF_PSTACK_ diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c index c129e99114ae..8e49d9cafcfc 100644 --- a/tools/perf/util/python.c +++ b/tools/perf/util/python.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <Python.h> #include <structmember.h> #include <inttypes.h> diff --git a/tools/perf/util/quote.c b/tools/perf/util/quote.c index 1ba8920151d8..22eaa201aa27 100644 --- a/tools/perf/util/quote.c +++ b/tools/perf/util/quote.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <errno.h> #include <stdlib.h> #include "strbuf.h" diff --git a/tools/perf/util/quote.h b/tools/perf/util/quote.h index 055ca45bed99..274bf26d3511 100644 --- a/tools/perf/util/quote.h +++ b/tools/perf/util/quote.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_QUOTE_H #define __PERF_QUOTE_H diff --git a/tools/perf/util/rb_resort.h b/tools/perf/util/rb_resort.h index 808cc45611fe..7d8972b33f6b 100644 --- a/tools/perf/util/rb_resort.h +++ b/tools/perf/util/rb_resort.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _PERF_RESORT_RB_H_ #define _PERF_RESORT_RB_H_ /* diff --git a/tools/perf/util/rblist.h b/tools/perf/util/rblist.h index ff9913b994c2..4c8638a22571 100644 --- a/tools/perf/util/rblist.h +++ b/tools/perf/util/rblist.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_RBLIST_H #define __PERF_RBLIST_H diff --git a/tools/perf/util/record.c b/tools/perf/util/record.c index d91bdf5a1aa4..1e97937b03a9 100644 --- a/tools/perf/util/record.c +++ b/tools/perf/util/record.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "evlist.h" #include "evsel.h" #include "cpumap.h" diff --git a/tools/perf/util/sane_ctype.h b/tools/perf/util/sane_ctype.h index 4308c22c22ad..c2b42ff9ff32 100644 --- a/tools/perf/util/sane_ctype.h +++ b/tools/perf/util/sane_ctype.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _PERF_SANE_CTYPE_H #define _PERF_SANE_CTYPE_H diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index a7ebd9fe8e40..da55081aefc6 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <errno.h> #include <inttypes.h> #include <linux/kernel.h> @@ -374,6 +375,8 @@ void perf_tool__fill_defaults(struct perf_tool *tool) tool->mmap2 = process_event_stub; if (tool->comm == NULL) tool->comm = process_event_stub; + if (tool->namespaces == NULL) + tool->namespaces = process_event_stub; if (tool->fork == NULL) tool->fork = process_event_stub; if (tool->exit == NULL) diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h index 47b5e7dbcb18..41caa098ed15 100644 --- a/tools/perf/util/session.h +++ b/tools/perf/util/session.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_SESSION_H #define __PERF_SESSION_H diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c index eb3ab902a1c0..84a33f1e9ec9 100644 --- a/tools/perf/util/sort.c +++ b/tools/perf/util/sort.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <errno.h> #include <inttypes.h> #include <regex.h> diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h index f36dc4980a6c..b2b55e5149a7 100644 --- a/tools/perf/util/sort.h +++ b/tools/perf/util/sort.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_SORT_H #define __PERF_SORT_H #include "../builtin.h" diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c index ed8e8d2de942..4105682afc7a 100644 --- a/tools/perf/util/srcline.c +++ b/tools/perf/util/srcline.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <inttypes.h> #include <stdio.h> #include <stdlib.h> diff --git a/tools/perf/util/srcline.h b/tools/perf/util/srcline.h index 7b52ba88676e..8e73f607dfa3 100644 --- a/tools/perf/util/srcline.h +++ b/tools/perf/util/srcline.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef PERF_SRCLINE_H #define PERF_SRCLINE_H diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c index a04cf56d3517..37363869c9a1 100644 --- a/tools/perf/util/stat-shadow.c +++ b/tools/perf/util/stat-shadow.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <stdio.h> #include "evsel.h" #include "stat.h" diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c index 35e9848734d6..c9bae5fb8b47 100644 --- a/tools/perf/util/stat.c +++ b/tools/perf/util/stat.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <errno.h> #include <inttypes.h> #include <math.h> diff --git a/tools/perf/util/stat.h b/tools/perf/util/stat.h index eacaf958e19d..96326b1f9443 100644 --- a/tools/perf/util/stat.h +++ b/tools/perf/util/stat.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_STATS_H #define __PERF_STATS_H diff --git a/tools/perf/util/strbuf.c b/tools/perf/util/strbuf.c index aafe908b82b5..3d1cf5bf7f18 100644 --- a/tools/perf/util/strbuf.c +++ b/tools/perf/util/strbuf.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "debug.h" #include "util.h" #include <linux/kernel.h> diff --git a/tools/perf/util/strbuf.h b/tools/perf/util/strbuf.h index 802d743378af..ea94d8628980 100644 --- a/tools/perf/util/strbuf.h +++ b/tools/perf/util/strbuf.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_STRBUF_H #define __PERF_STRBUF_H diff --git a/tools/perf/util/strfilter.c b/tools/perf/util/strfilter.c index 4dc0af669a30..7f3253d44afd 100644 --- a/tools/perf/util/strfilter.c +++ b/tools/perf/util/strfilter.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "util.h" #include "string2.h" #include "strfilter.h" diff --git a/tools/perf/util/strfilter.h b/tools/perf/util/strfilter.h index cff5eda88728..e0c25a40f796 100644 --- a/tools/perf/util/strfilter.h +++ b/tools/perf/util/strfilter.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_STRFILTER_H #define __PERF_STRFILTER_H /* General purpose glob matching filter */ diff --git a/tools/perf/util/string.c b/tools/perf/util/string.c index cca53b693a48..aaa08ee8c717 100644 --- a/tools/perf/util/string.c +++ b/tools/perf/util/string.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "string2.h" #include <linux/kernel.h> #include <linux/string.h> diff --git a/tools/perf/util/string2.h b/tools/perf/util/string2.h index 2f619681bd6a..ee14ca5451ab 100644 --- a/tools/perf/util/string2.h +++ b/tools/perf/util/string2.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef PERF_STRING_H #define PERF_STRING_H diff --git a/tools/perf/util/strlist.h b/tools/perf/util/strlist.h index 19207e50fce5..d58f1e08b170 100644 --- a/tools/perf/util/strlist.h +++ b/tools/perf/util/strlist.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_STRLIST_H #define __PERF_STRLIST_H diff --git a/tools/perf/util/svghelper.h b/tools/perf/util/svghelper.h index 946fdf2db97c..e55338d5c3bd 100644 --- a/tools/perf/util/svghelper.h +++ b/tools/perf/util/svghelper.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_SVGHELPER_H #define __PERF_SVGHELPER_H diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index 5c39f420111e..2de770511e70 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <fcntl.h> #include <stdio.h> #include <errno.h> @@ -810,12 +811,6 @@ static u64 ref_reloc(struct kmap *kmap) void __weak arch__sym_update(struct symbol *s __maybe_unused, GElf_Sym *sym __maybe_unused) { } -void __weak arch__adjust_sym_map_offset(GElf_Sym *sym, GElf_Shdr *shdr, - struct map *map __maybe_unused) -{ - sym->st_value -= shdr->sh_addr - shdr->sh_offset; -} - int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *syms_ss, struct symsrc *runtime_ss, int kmodule) { @@ -996,7 +991,7 @@ int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *syms_ss, /* Adjust symbol to map to file offset */ if (adjust_kernel_syms) - arch__adjust_sym_map_offset(&sym, &shdr, map); + sym.st_value -= shdr.sh_addr - shdr.sh_offset; if (strcmp(section_name, (curr_dso->short_name + diff --git a/tools/perf/util/symbol-minimal.c b/tools/perf/util/symbol-minimal.c index 1a5aa35b0100..ff48d0d49584 100644 --- a/tools/perf/util/symbol-minimal.c +++ b/tools/perf/util/symbol-minimal.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "symbol.h" #include "util.h" diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 5909ee4c7ade..6492ef38b090 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <dirent.h> #include <errno.h> #include <stdlib.h> diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h index 2bd6a1f01a1c..6352022593c6 100644 --- a/tools/perf/util/symbol.h +++ b/tools/perf/util/symbol.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_SYMBOL #define __PERF_SYMBOL 1 @@ -344,9 +345,6 @@ int setup_intlist(struct intlist **list, const char *list_str, #ifdef HAVE_LIBELF_SUPPORT bool elf__needs_adjust_symbols(GElf_Ehdr ehdr); void arch__sym_update(struct symbol *s, GElf_Sym *sym); -void arch__adjust_sym_map_offset(GElf_Sym *sym, - GElf_Shdr *shdr __maybe_unused, - struct map *map __maybe_unused); #endif #define SYMBOL_A 0 diff --git a/tools/perf/util/symbol_fprintf.c b/tools/perf/util/symbol_fprintf.c index 63694e174e5c..6dd2cb88ccbe 100644 --- a/tools/perf/util/symbol_fprintf.c +++ b/tools/perf/util/symbol_fprintf.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <elf.h> #include <inttypes.h> #include <stdio.h> diff --git a/tools/perf/util/syscalltbl.c b/tools/perf/util/syscalltbl.c index 19e5db90394c..6eea7cff3d4e 100644 --- a/tools/perf/util/syscalltbl.c +++ b/tools/perf/util/syscalltbl.c @@ -15,9 +15,9 @@ #include "syscalltbl.h" #include <stdlib.h> +#include <linux/compiler.h> #ifdef HAVE_SYSCALL_TABLE -#include <linux/compiler.h> #include <string.h> #include "string2.h" #include "util.h" diff --git a/tools/perf/util/syscalltbl.h b/tools/perf/util/syscalltbl.h index e9fb8786da7c..c8e7e9ce0f01 100644 --- a/tools/perf/util/syscalltbl.h +++ b/tools/perf/util/syscalltbl.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_SYSCALLTBL_H #define __PERF_SYSCALLTBL_H diff --git a/tools/perf/util/target.h b/tools/perf/util/target.h index 7381b1ca4041..446aa7a56f25 100644 --- a/tools/perf/util/target.h +++ b/tools/perf/util/target.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _PERF_TARGET_H #define _PERF_TARGET_H diff --git a/tools/perf/util/term.c b/tools/perf/util/term.c index 8f254a74d97d..e7aa82c06c76 100644 --- a/tools/perf/util/term.c +++ b/tools/perf/util/term.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "term.h" #include <stdlib.h> #include <termios.h> diff --git a/tools/perf/util/term.h b/tools/perf/util/term.h index 2c06a61846a1..607b170a9017 100644 --- a/tools/perf/util/term.h +++ b/tools/perf/util/term.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_TERM_H #define __PERF_TERM_H diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c index aee9a42102ba..1dbcd3c8dee0 100644 --- a/tools/perf/util/thread.c +++ b/tools/perf/util/thread.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "../perf.h" #include <errno.h> #include <stdlib.h> diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h index cb1a5dd5c2b9..fdcea7c0cac1 100644 --- a/tools/perf/util/thread.h +++ b/tools/perf/util/thread.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_THREAD_H #define __PERF_THREAD_H diff --git a/tools/perf/util/thread_map.c b/tools/perf/util/thread_map.c index 63ead7b06324..be0d5a736dea 100644 --- a/tools/perf/util/thread_map.c +++ b/tools/perf/util/thread_map.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <dirent.h> #include <errno.h> #include <limits.h> diff --git a/tools/perf/util/thread_map.h b/tools/perf/util/thread_map.h index bd34d7a0b9fa..f15803985435 100644 --- a/tools/perf/util/thread_map.h +++ b/tools/perf/util/thread_map.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_THREAD_MAP_H #define __PERF_THREAD_MAP_H diff --git a/tools/perf/util/time-utils.c b/tools/perf/util/time-utils.c index 5b5d0214debd..81927d027417 100644 --- a/tools/perf/util/time-utils.c +++ b/tools/perf/util/time-utils.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <stdlib.h> #include <string.h> #include <sys/time.h> diff --git a/tools/perf/util/time-utils.h b/tools/perf/util/time-utils.h index 8656be08513b..15b475c50ccf 100644 --- a/tools/perf/util/time-utils.h +++ b/tools/perf/util/time-utils.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _TIME_UTILS_H_ #define _TIME_UTILS_H_ diff --git a/tools/perf/util/tool.h b/tools/perf/util/tool.h index d549e50db397..2532b558099b 100644 --- a/tools/perf/util/tool.h +++ b/tools/perf/util/tool.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_TOOL_H #define __PERF_TOOL_H diff --git a/tools/perf/util/top.h b/tools/perf/util/top.h index 9bdfb78a9a35..506150a75bd0 100644 --- a/tools/perf/util/top.h +++ b/tools/perf/util/top.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_TOP_H #define __PERF_TOP_H 1 diff --git a/tools/perf/util/trace-event.c b/tools/perf/util/trace-event.c index c330780674fc..16a776371d03 100644 --- a/tools/perf/util/trace-event.c +++ b/tools/perf/util/trace-event.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <stdio.h> #include <unistd.h> diff --git a/tools/perf/util/trace-event.h b/tools/perf/util/trace-event.h index 1fbc044f9eb0..dcbdb53dc702 100644 --- a/tools/perf/util/trace-event.h +++ b/tools/perf/util/trace-event.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _PERF_UTIL_TRACE_EVENT_H #define _PERF_UTIL_TRACE_EVENT_H diff --git a/tools/perf/util/trigger.h b/tools/perf/util/trigger.h index e97d7016d771..370138e7e35c 100644 --- a/tools/perf/util/trigger.h +++ b/tools/perf/util/trigger.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __TRIGGER_H_ #define __TRIGGER_H_ 1 diff --git a/tools/perf/util/tsc.c b/tools/perf/util/tsc.c index 1b741646eed0..bfa782421cbd 100644 --- a/tools/perf/util/tsc.c +++ b/tools/perf/util/tsc.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <linux/compiler.h> #include <linux/types.h> diff --git a/tools/perf/util/tsc.h b/tools/perf/util/tsc.h index d5b11e2b85e0..e0c3af34ac8d 100644 --- a/tools/perf/util/tsc.h +++ b/tools/perf/util/tsc.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_TSC_H #define __PERF_TSC_H diff --git a/tools/perf/util/units.c b/tools/perf/util/units.c index 4767ec2c5ef6..a46762aec4c9 100644 --- a/tools/perf/util/units.c +++ b/tools/perf/util/units.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "units.h" #include <inttypes.h> #include <limits.h> diff --git a/tools/perf/util/units.h b/tools/perf/util/units.h index f02c87317150..99263b6a23f7 100644 --- a/tools/perf/util/units.h +++ b/tools/perf/util/units.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef PERF_UNIT_H #define PERF_UNIT_H diff --git a/tools/perf/util/unwind-libdw.c b/tools/perf/util/unwind-libdw.c index 7755a5e0fe5e..1e9c974faf67 100644 --- a/tools/perf/util/unwind-libdw.c +++ b/tools/perf/util/unwind-libdw.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <linux/compiler.h> #include <elfutils/libdw.h> #include <elfutils/libdwfl.h> diff --git a/tools/perf/util/unwind-libdw.h b/tools/perf/util/unwind-libdw.h index 4a2b269a7b3b..0cbd2650e280 100644 --- a/tools/perf/util/unwind-libdw.h +++ b/tools/perf/util/unwind-libdw.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_UNWIND_LIBDW_H #define __PERF_UNWIND_LIBDW_H diff --git a/tools/perf/util/unwind-libunwind-local.c b/tools/perf/util/unwind-libunwind-local.c index 672c2ada9357..7a42f703e858 100644 --- a/tools/perf/util/unwind-libunwind-local.c +++ b/tools/perf/util/unwind-libunwind-local.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Post mortem Dwarf CFI based unwinding on top of regs and stack dumps. * diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c index 8aef572d0889..647a1e6b4c7b 100644 --- a/tools/perf/util/unwind-libunwind.c +++ b/tools/perf/util/unwind-libunwind.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "unwind.h" #include "thread.h" #include "session.h" diff --git a/tools/perf/util/unwind.h b/tools/perf/util/unwind.h index bfbdcc6198c9..8a44a1569a21 100644 --- a/tools/perf/util/unwind.h +++ b/tools/perf/util/unwind.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __UNWIND_H #define __UNWIND_H diff --git a/tools/perf/util/usage.c b/tools/perf/util/usage.c index 6cc9d9888ce0..070d25ceea6a 100644 --- a/tools/perf/util/usage.c +++ b/tools/perf/util/usage.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * usage.c * diff --git a/tools/perf/util/util-cxx.h b/tools/perf/util/util-cxx.h index 0e0e019c9f34..80a99e458d4e 100644 --- a/tools/perf/util/util-cxx.h +++ b/tools/perf/util/util-cxx.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * Support C++ source use utilities defined in util.h */ diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c index 4c360daa4e24..3687b720327a 100644 --- a/tools/perf/util/util.c +++ b/tools/perf/util/util.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "../perf.h" #include "util.h" #include "debug.h" diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h index b136c271125f..b52765e6d7b4 100644 --- a/tools/perf/util/util.h +++ b/tools/perf/util/util.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef GIT_COMPAT_UTIL_H #define GIT_COMPAT_UTIL_H diff --git a/tools/perf/util/values.c b/tools/perf/util/values.c index 8a32bb0095e5..4b7a303e4ba8 100644 --- a/tools/perf/util/values.c +++ b/tools/perf/util/values.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <inttypes.h> #include <stdio.h> #include <stdlib.h> diff --git a/tools/perf/util/values.h b/tools/perf/util/values.h index 808ff9c73bf5..8c41f22f42cf 100644 --- a/tools/perf/util/values.h +++ b/tools/perf/util/values.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_VALUES_H #define __PERF_VALUES_H diff --git a/tools/perf/util/vdso.c b/tools/perf/util/vdso.c index d3c39eec89a8..cffcda448c28 100644 --- a/tools/perf/util/vdso.c +++ b/tools/perf/util/vdso.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <errno.h> #include <unistd.h> #include <stdio.h> diff --git a/tools/perf/util/vdso.h b/tools/perf/util/vdso.h index cdc4fabfc212..bc74ace603ae 100644 --- a/tools/perf/util/vdso.h +++ b/tools/perf/util/vdso.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __PERF_VDSO__ #define __PERF_VDSO__ diff --git a/tools/perf/util/xyarray.c b/tools/perf/util/xyarray.c index c8f415d9877b..dc95154f5646 100644 --- a/tools/perf/util/xyarray.c +++ b/tools/perf/util/xyarray.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include "xyarray.h" #include "util.h" #include <stdlib.h> diff --git a/tools/perf/util/xyarray.h b/tools/perf/util/xyarray.h index 4ba726c90870..7ffe562e7ae7 100644 --- a/tools/perf/util/xyarray.h +++ b/tools/perf/util/xyarray.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _PERF_XYARRAY_H_ #define _PERF_XYARRAY_H_ 1 @@ -23,12 +24,12 @@ static inline void *xyarray__entry(struct xyarray *xy, int x, int y) static inline int xyarray__max_y(struct xyarray *xy) { - return xy->max_x; + return xy->max_y; } static inline int xyarray__max_x(struct xyarray *xy) { - return xy->max_y; + return xy->max_x; } #endif /* _PERF_XYARRAY_H_ */ diff --git a/tools/perf/util/zlib.c b/tools/perf/util/zlib.c index 1329d843eb7b..008fe68d7b76 100644 --- a/tools/perf/util/zlib.c +++ b/tools/perf/util/zlib.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <stdio.h> #include <unistd.h> #include <sys/stat.h> |