Commit | Line | Data |
---|---|---|
d6748385 | 1 | #!/bin/bash |
b2441318 | 2 | # SPDX-License-Identifier: GPL-2.0 |
aeafd623 | 3 | |
d6748385 IR |
4 | YELLOW='\033[0;33m' |
5 | NC='\033[0m' # No Color | |
6 | ||
7 | declare -a FILES | |
8 | FILES=( | |
9 | "include/uapi/linux/const.h" | |
10 | "include/uapi/drm/drm.h" | |
11 | "include/uapi/drm/i915_drm.h" | |
12 | "include/uapi/linux/fadvise.h" | |
13 | "include/uapi/linux/fcntl.h" | |
14 | "include/uapi/linux/fs.h" | |
15 | "include/uapi/linux/fscrypt.h" | |
16 | "include/uapi/linux/kcmp.h" | |
17 | "include/uapi/linux/kvm.h" | |
18 | "include/uapi/linux/in.h" | |
19 | "include/uapi/linux/mount.h" | |
20 | "include/uapi/linux/openat2.h" | |
21 | "include/uapi/linux/perf_event.h" | |
22 | "include/uapi/linux/prctl.h" | |
23 | "include/uapi/linux/sched.h" | |
417ecb61 | 24 | "include/uapi/linux/seccomp.h" |
d6748385 IR |
25 | "include/uapi/linux/stat.h" |
26 | "include/uapi/linux/usbdevice_fs.h" | |
27 | "include/uapi/linux/vhost.h" | |
28 | "include/uapi/sound/asound.h" | |
29 | "include/linux/bits.h" | |
30 | "include/vdso/bits.h" | |
31 | "include/linux/const.h" | |
32 | "include/vdso/const.h" | |
33 | "include/linux/hash.h" | |
34 | "include/linux/list-sort.h" | |
35 | "include/uapi/linux/hw_breakpoint.h" | |
36 | "arch/x86/include/asm/disabled-features.h" | |
37 | "arch/x86/include/asm/required-features.h" | |
38 | "arch/x86/include/asm/cpufeatures.h" | |
39 | "arch/x86/include/asm/inat_types.h" | |
40 | "arch/x86/include/asm/emulate_prefix.h" | |
41 | "arch/x86/include/asm/irq_vectors.h" | |
42 | "arch/x86/include/asm/msr-index.h" | |
43 | "arch/x86/include/uapi/asm/prctl.h" | |
44 | "arch/x86/lib/x86-opcode-map.txt" | |
45 | "arch/x86/tools/gen-insn-attr-x86.awk" | |
46 | "arch/arm/include/uapi/asm/perf_regs.h" | |
47 | "arch/arm64/include/uapi/asm/perf_regs.h" | |
48 | "arch/loongarch/include/uapi/asm/perf_regs.h" | |
49 | "arch/mips/include/uapi/asm/perf_regs.h" | |
50 | "arch/powerpc/include/uapi/asm/perf_regs.h" | |
51 | "arch/s390/include/uapi/asm/perf_regs.h" | |
52 | "arch/x86/include/uapi/asm/perf_regs.h" | |
53 | "arch/x86/include/uapi/asm/kvm.h" | |
54 | "arch/x86/include/uapi/asm/kvm_perf.h" | |
55 | "arch/x86/include/uapi/asm/svm.h" | |
56 | "arch/x86/include/uapi/asm/unistd.h" | |
57 | "arch/x86/include/uapi/asm/vmx.h" | |
58 | "arch/powerpc/include/uapi/asm/kvm.h" | |
59 | "arch/s390/include/uapi/asm/kvm.h" | |
60 | "arch/s390/include/uapi/asm/kvm_perf.h" | |
61 | "arch/s390/include/uapi/asm/sie.h" | |
62 | "arch/arm/include/uapi/asm/kvm.h" | |
63 | "arch/arm64/include/uapi/asm/kvm.h" | |
64 | "arch/arm64/include/uapi/asm/unistd.h" | |
65 | "arch/alpha/include/uapi/asm/errno.h" | |
66 | "arch/mips/include/asm/errno.h" | |
67 | "arch/mips/include/uapi/asm/errno.h" | |
68 | "arch/parisc/include/uapi/asm/errno.h" | |
69 | "arch/powerpc/include/uapi/asm/errno.h" | |
70 | "arch/sparc/include/uapi/asm/errno.h" | |
71 | "arch/x86/include/uapi/asm/errno.h" | |
72 | "include/asm-generic/bitops/arch_hweight.h" | |
73 | "include/asm-generic/bitops/const_hweight.h" | |
74 | "include/asm-generic/bitops/__fls.h" | |
75 | "include/asm-generic/bitops/fls.h" | |
76 | "include/asm-generic/bitops/fls64.h" | |
77 | "include/linux/coresight-pmu.h" | |
78 | "include/uapi/asm-generic/errno.h" | |
79 | "include/uapi/asm-generic/errno-base.h" | |
80 | "include/uapi/asm-generic/ioctls.h" | |
81 | "include/uapi/asm-generic/mman-common.h" | |
82 | "include/uapi/asm-generic/unistd.h" | |
83 | ) | |
84 | ||
85 | declare -a SYNC_CHECK_FILES | |
86 | SYNC_CHECK_FILES=( | |
87 | "arch/x86/include/asm/inat.h" | |
88 | "arch/x86/include/asm/insn.h" | |
89 | "arch/x86/lib/inat.c" | |
90 | "arch/x86/lib/insn.c" | |
91 | ) | |
d30c7b82 | 92 | |
d758d5d4 ACM |
93 | # These copies are under tools/perf/trace/beauty/ as they are not used to in |
94 | # building object files only by scripts in tools/perf/trace/beauty/ to generate | |
95 | # tables that then gets included in .c files for things like id->string syscall | |
96 | # tables (and the reverse lookup as well: string -> id) | |
97 | ||
d6748385 IR |
98 | declare -a BEAUTY_FILES |
99 | BEAUTY_FILES=( | |
100 | "include/linux/socket.h" | |
101 | ) | |
102 | ||
103 | declare -a FAILURES | |
d758d5d4 | 104 | |
58247297 | 105 | check_2 () { |
d6748385 IR |
106 | tools_file=$1 |
107 | orig_file=$2 | |
aeafd623 | 108 | |
58247297 | 109 | shift |
aeafd623 | 110 | shift |
aeafd623 | 111 | |
d6748385 | 112 | cmd="diff $* $tools_file $orig_file > /dev/null" |
aeafd623 | 113 | |
d6748385 IR |
114 | if [ -f "$orig_file" ] && ! eval "$cmd" |
115 | then | |
116 | FAILURES+=( | |
117 | "$tools_file $orig_file" | |
118 | ) | |
119 | fi | |
aeafd623 JO |
120 | } |
121 | ||
58247297 JO |
122 | check () { |
123 | file=$1 | |
124 | ||
125 | shift | |
126 | ||
e9365842 | 127 | check_2 "tools/$file" "$file" "$@" |
58247297 | 128 | } |
aeafd623 | 129 | |
d758d5d4 ACM |
130 | beauty_check () { |
131 | file=$1 | |
132 | ||
133 | shift | |
134 | ||
e9365842 | 135 | check_2 "tools/perf/trace/beauty/$file" "$file" "$@" |
d758d5d4 ACM |
136 | } |
137 | ||
d7e05cea ACM |
138 | # Check if we have the kernel headers (tools/perf/../../include), else |
139 | # we're probably on a detached tarball, so no point in trying to check | |
140 | # differences. | |
d6748385 IR |
141 | if ! [ -d ../../include ] |
142 | then | |
143 | echo -e "${YELLOW}Warning${NC}: Skipped check-headers due to missing ../../include" | |
144 | exit 0 | |
145 | fi | |
d7e05cea | 146 | |
7ea6e983 JO |
147 | cd ../.. |
148 | ||
aeafd623 | 149 | # simple diff check |
d6748385 IR |
150 | for i in "${FILES[@]}" |
151 | do | |
152 | check "$i" -B | |
aeafd623 JO |
153 | done |
154 | ||
d6748385 IR |
155 | for i in "${SYNC_CHECK_FILES[@]}" |
156 | do | |
157 | check "$i" '-I "^.*\/\*.*__ignore_sync_check__.*\*\/.*$"' | |
d30c7b82 BP |
158 | done |
159 | ||
aeafd623 | 160 | # diff with extra ignore lines |
4402e360 | 161 | check arch/x86/lib/memcpy_64.S '-I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>" -I"^SYM_FUNC_START\(_LOCAL\)*(memcpy_\(erms\|orig\))" -I"^#include <linux/cfi_types.h>"' |
bd5c6b81 | 162 | check arch/x86/lib/memset_64.S '-I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>" -I"^SYM_FUNC_START\(_LOCAL\)*(memset_\(erms\|orig\))"' |
dde994dd | 163 | check arch/x86/include/asm/amd-ibs.h '-I "^#include [<\"]\(asm/\)*msr-index.h"' |
1314376d | 164 | check arch/arm64/include/asm/cputype.h '-I "^#include [<\"]\(asm/\)*sysreg.h"' |
a91c9872 | 165 | check include/asm-generic/unaligned.h '-I "^#include <linux/unaligned/packed_struct.h>" -I "^#include <asm/byteorder.h>" -I "^#pragma GCC diagnostic"' |
be709d48 | 166 | check include/uapi/asm-generic/mman.h '-I "^#include <\(uapi/\)*asm-generic/mman-common\(-tools\)*.h>"' |
15019e98 | 167 | check include/uapi/linux/mman.h '-I "^#include <\(uapi/\)*asm/mman.h>"' |
e3698b23 | 168 | check include/linux/build_bug.h '-I "^#\(ifndef\|endif\)\( \/\/\)* static_assert$"' |
3052ba56 ACM |
169 | check include/linux/ctype.h '-I "isdigit("' |
170 | check lib/ctype.c '-I "^EXPORT_SYMBOL" -I "^#include <linux/export.h>" -B' | |
92ec3cc9 | 171 | check lib/list_sort.c '-I "^#include <linux/bug.h>"' |
7ea6e983 | 172 | |
c9b51a01 JO |
173 | # diff non-symmetric files |
174 | check_2 tools/perf/arch/x86/entry/syscalls/syscall_64.tbl arch/x86/entry/syscalls/syscall_64.tbl | |
9bad32b2 | 175 | check_2 tools/perf/arch/powerpc/entry/syscalls/syscall.tbl arch/powerpc/kernel/syscalls/syscall.tbl |
22ffc3f5 | 176 | check_2 tools/perf/arch/s390/entry/syscalls/syscall.tbl arch/s390/kernel/syscalls/syscall.tbl |
d9fd5a71 | 177 | check_2 tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl arch/mips/kernel/syscalls/syscall_n64.tbl |
c9b51a01 | 178 | |
d6748385 IR |
179 | for i in "${BEAUTY_FILES[@]}" |
180 | do | |
181 | beauty_check "$i" -B | |
d758d5d4 | 182 | done |
f3cf7fa9 | 183 | |
eee19501 IR |
184 | # check duplicated library files |
185 | check_2 tools/perf/util/hashmap.h tools/lib/bpf/hashmap.h | |
186 | check_2 tools/perf/util/hashmap.c tools/lib/bpf/hashmap.c | |
187 | ||
e9365842 | 188 | cd tools/perf || exit |
d6748385 IR |
189 | |
190 | if [ ${#FAILURES[@]} -gt 0 ] | |
191 | then | |
192 | echo -e "${YELLOW}Warning${NC}: Kernel ABI header differences:" | |
193 | for i in "${FAILURES[@]}" | |
194 | do | |
195 | echo " diff -u $i" | |
196 | done | |
197 | fi |