blob: f1e46277e8226b5aa7f0692a60e2cbfec1ef7c4a [file] [log] [blame]
Jiri Olsaaeafd622016-12-06 14:18:51 +01001#!/bin/sh
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01002# SPDX-License-Identifier: GPL-2.0
Jiri Olsaaeafd622016-12-06 14:18:51 +01003
Josh Poimboeuf00a26392019-08-29 17:41:21 -05004FILES='
Arnaldo Carvalho de Meloaaa6ef82019-08-19 11:00:54 -03005include/uapi/linux/const.h
Arnaldo Carvalho de Meloc1737f22017-07-31 16:45:32 -03006include/uapi/drm/drm.h
7include/uapi/drm/i915_drm.h
Arnaldo Carvalho de Melof9cdd632018-12-18 16:15:53 -03008include/uapi/linux/fadvise.h
Arnaldo Carvalho de Melo67ef2872017-03-30 11:16:59 -03009include/uapi/linux/fcntl.h
Arnaldo Carvalho de Melof443f382018-10-24 14:31:12 -030010include/uapi/linux/fs.h
Arnaldo Carvalho de Melo0ae40612019-09-27 12:01:26 -030011include/uapi/linux/fscrypt.h
Arnaldo Carvalho de Melo735e2152017-10-31 10:04:11 -030012include/uapi/linux/kcmp.h
Arnaldo Carvalho de Melo3ce97512017-07-31 16:45:32 -030013include/uapi/linux/kvm.h
Arnaldo Carvalho de Meloa4b20612018-07-26 09:26:13 -030014include/uapi/linux/in.h
Arnaldo Carvalho de Melo250bfc82019-01-08 13:42:37 -030015include/uapi/linux/mount.h
Arnaldo Carvalho de Meloc4528332020-02-11 11:58:56 -030016include/uapi/linux/openat2.h
Jiri Olsaaeafd622016-12-06 14:18:51 +010017include/uapi/linux/perf_event.h
Arnaldo Carvalho de Melo43372792017-10-26 14:41:01 -030018include/uapi/linux/prctl.h
Arnaldo Carvalho de Melo450c86c2017-07-20 10:46:34 -030019include/uapi/linux/sched.h
Arnaldo Carvalho de Melo67ef2872017-03-30 11:16:59 -030020include/uapi/linux/stat.h
Arnaldo Carvalho de Melo2bd71d12018-12-27 14:18:13 -030021include/uapi/linux/usbdevice_fs.h
Arnaldo Carvalho de Melod02b3952017-07-31 16:45:32 -030022include/uapi/linux/vhost.h
Arnaldo Carvalho de Meloa215684e2017-07-31 16:45:32 -030023include/uapi/sound/asound.h
Arnaldo Carvalho de Meloba4aa022018-09-25 10:55:59 -030024include/linux/bits.h
Arnaldo Carvalho de Meloe3698b22020-04-14 10:27:39 -030025include/vdso/bits.h
Arnaldo Carvalho de Meloaaa6ef82019-08-19 11:00:54 -030026include/linux/const.h
Arnaldo Carvalho de Meloca64d842020-04-14 08:52:23 -030027include/vdso/const.h
Jiri Olsaaeafd622016-12-06 14:18:51 +010028include/linux/hash.h
29include/uapi/linux/hw_breakpoint.h
30arch/x86/include/asm/disabled-features.h
31arch/x86/include/asm/required-features.h
32arch/x86/include/asm/cpufeatures.h
Josh Poimboeuf00a26392019-08-29 17:41:21 -050033arch/x86/include/asm/inat_types.h
Masami Hiramatsu4d65adf2019-09-06 22:14:10 +090034arch/x86/include/asm/emulate_prefix.h
Arnaldo Carvalho de Melod2b72b72019-10-15 15:40:23 -030035arch/x86/include/asm/irq_vectors.h
Arnaldo Carvalho de Melo444e2ff2019-09-26 15:26:39 -030036arch/x86/include/asm/msr-index.h
Arnaldo Carvalho de Meloc22e2682018-12-17 16:15:27 -030037arch/x86/include/uapi/asm/prctl.h
Josh Poimboeuf00a26392019-08-29 17:41:21 -050038arch/x86/lib/x86-opcode-map.txt
39arch/x86/tools/gen-insn-attr-x86.awk
Jiri Olsaaeafd622016-12-06 14:18:51 +010040arch/arm/include/uapi/asm/perf_regs.h
41arch/arm64/include/uapi/asm/perf_regs.h
Tiezhu Yang6c1ced22021-06-01 19:53:56 +080042arch/mips/include/uapi/asm/perf_regs.h
Jiri Olsaaeafd622016-12-06 14:18:51 +010043arch/powerpc/include/uapi/asm/perf_regs.h
Arnaldo Carvalho de Melo10b9baa2017-11-28 11:08:41 -030044arch/s390/include/uapi/asm/perf_regs.h
Jiri Olsaaeafd622016-12-06 14:18:51 +010045arch/x86/include/uapi/asm/perf_regs.h
46arch/x86/include/uapi/asm/kvm.h
47arch/x86/include/uapi/asm/kvm_perf.h
48arch/x86/include/uapi/asm/svm.h
Arnaldo Carvalho de Melo047726d2017-07-18 17:09:21 -030049arch/x86/include/uapi/asm/unistd.h
Jiri Olsaaeafd622016-12-06 14:18:51 +010050arch/x86/include/uapi/asm/vmx.h
51arch/powerpc/include/uapi/asm/kvm.h
52arch/s390/include/uapi/asm/kvm.h
53arch/s390/include/uapi/asm/kvm_perf.h
Hendrik Bruecknera81c4212017-12-04 10:56:49 +010054arch/s390/include/uapi/asm/ptrace.h
Jiri Olsaaeafd622016-12-06 14:18:51 +010055arch/s390/include/uapi/asm/sie.h
56arch/arm/include/uapi/asm/kvm.h
57arch/arm64/include/uapi/asm/kvm.h
Kim Phillips34b009cf2018-07-06 16:34:34 -050058arch/arm64/include/uapi/asm/unistd.h
Hendrik Brueckner95f28192018-01-19 09:56:13 +010059arch/alpha/include/uapi/asm/errno.h
60arch/mips/include/asm/errno.h
61arch/mips/include/uapi/asm/errno.h
62arch/parisc/include/uapi/asm/errno.h
63arch/powerpc/include/uapi/asm/errno.h
64arch/sparc/include/uapi/asm/errno.h
65arch/x86/include/uapi/asm/errno.h
Jiri Olsaaeafd622016-12-06 14:18:51 +010066include/asm-generic/bitops/arch_hweight.h
67include/asm-generic/bitops/const_hweight.h
68include/asm-generic/bitops/__fls.h
69include/asm-generic/bitops/fls.h
70include/asm-generic/bitops/fls64.h
71include/linux/coresight-pmu.h
Hendrik Brueckner28b8f952018-01-19 09:56:14 +010072include/uapi/asm-generic/errno.h
73include/uapi/asm-generic/errno-base.h
Arnaldo Carvalho de Melo6375f0a2017-07-31 22:52:28 -030074include/uapi/asm-generic/ioctls.h
Jiri Olsaaeafd622016-12-06 14:18:51 +010075include/uapi/asm-generic/mman-common.h
Kim Phillips34b009cf2018-07-06 16:34:34 -050076include/uapi/asm-generic/unistd.h
Jiri Olsaaeafd622016-12-06 14:18:51 +010077'
78
Borislav Petkovd30c7b82021-02-22 13:34:40 +010079SYNC_CHECK_FILES='
80arch/x86/include/asm/inat.h
81arch/x86/include/asm/insn.h
82arch/x86/lib/inat.c
83arch/x86/lib/insn.c
84'
85
Arnaldo Carvalho de Melod758d5d2020-09-29 08:56:38 -030086# These copies are under tools/perf/trace/beauty/ as they are not used to in
87# building object files only by scripts in tools/perf/trace/beauty/ to generate
88# tables that then gets included in .c files for things like id->string syscall
89# tables (and the reverse lookup as well: string -> id)
90
91BEAUTY_FILES='
92include/linux/socket.h
93'
94
Jiri Olsa582472972018-04-23 11:08:16 +020095check_2 () {
96 file1=$1
97 file2=$2
98
99 shift
100 shift
101
102 cmd="diff $* $file1 $file2 > /dev/null"
103
Alexander Kapshuk51d8aac2018-08-11 11:39:15 +0300104 test -f $file2 && {
105 eval $cmd || {
Jiri Olsa7ea6e982018-08-13 13:15:03 +0200106 echo "Warning: Kernel ABI header at '$file1' differs from latest version at '$file2'" >&2
107 echo diff -u $file1 $file2
Alexander Kapshuk51d8aac2018-08-11 11:39:15 +0300108 }
109 }
Jiri Olsa582472972018-04-23 11:08:16 +0200110}
111
Jiri Olsaaeafd622016-12-06 14:18:51 +0100112check () {
113 file=$1
Jiri Olsaaeafd622016-12-06 14:18:51 +0100114
115 shift
Jiri Olsaaeafd622016-12-06 14:18:51 +0100116
Jiri Olsa7ea6e982018-08-13 13:15:03 +0200117 check_2 tools/$file $file $*
Jiri Olsaaeafd622016-12-06 14:18:51 +0100118}
119
Arnaldo Carvalho de Melod758d5d2020-09-29 08:56:38 -0300120beauty_check () {
121 file=$1
122
123 shift
124
125 check_2 tools/perf/trace/beauty/$file $file $*
126}
127
Arnaldo Carvalho de Melod7e05ce2017-10-16 15:53:08 -0300128# Check if we have the kernel headers (tools/perf/../../include), else
129# we're probably on a detached tarball, so no point in trying to check
130# differences.
131test -d ../../include || exit 0
132
Jiri Olsa7ea6e982018-08-13 13:15:03 +0200133cd ../..
134
Jiri Olsaaeafd622016-12-06 14:18:51 +0100135# simple diff check
Josh Poimboeuf00a26392019-08-29 17:41:21 -0500136for i in $FILES; do
Jiri Olsaaeafd622016-12-06 14:18:51 +0100137 check $i -B
138done
139
Borislav Petkovd30c7b82021-02-22 13:34:40 +0100140for i in $SYNC_CHECK_FILES; do
141 check $i '-I "^.*\/\*.*__ignore_sync_check__.*\*\/.*$"'
142done
143
Jiri Olsaaeafd622016-12-06 14:18:51 +0100144# diff with extra ignore lines
Arnaldo Carvalho de Melobd5c6b82019-12-02 11:40:57 -0300145check arch/x86/lib/memcpy_64.S '-I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>" -I"^SYM_FUNC_START\(_LOCAL\)*(memcpy_\(erms\|orig\))"'
146check arch/x86/lib/memset_64.S '-I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>" -I"^SYM_FUNC_START\(_LOCAL\)*(memset_\(erms\|orig\))"'
Kim Phillipsdde994d2021-08-17 17:15:08 -0500147check arch/x86/include/asm/amd-ibs.h '-I "^#include [<\"]\(asm/\)*msr-index.h"'
Arnaldo Carvalho de Melobe709d42019-03-25 14:06:07 -0300148check include/uapi/asm-generic/mman.h '-I "^#include <\(uapi/\)*asm-generic/mman-common\(-tools\)*.h>"'
Jiri Olsa15019e92018-04-23 11:08:15 +0200149check include/uapi/linux/mman.h '-I "^#include <\(uapi/\)*asm/mman.h>"'
Arnaldo Carvalho de Meloe3698b22020-04-14 10:27:39 -0300150check include/linux/build_bug.h '-I "^#\(ifndef\|endif\)\( \/\/\)* static_assert$"'
Arnaldo Carvalho de Melo3052ba52019-06-25 17:27:31 -0300151check include/linux/ctype.h '-I "isdigit("'
152check lib/ctype.c '-I "^EXPORT_SYMBOL" -I "^#include <linux/export.h>" -B'
Jiri Olsa7ea6e982018-08-13 13:15:03 +0200153
Jiri Olsac9b51a02018-08-13 13:15:04 +0200154# diff non-symmetric files
155check_2 tools/perf/arch/x86/entry/syscalls/syscall_64.tbl arch/x86/entry/syscalls/syscall_64.tbl
Tiezhu Yang9bad32b2020-12-18 15:59:21 +0800156check_2 tools/perf/arch/powerpc/entry/syscalls/syscall.tbl arch/powerpc/kernel/syscalls/syscall.tbl
Tiezhu Yang22ffc3f2020-12-18 15:59:22 +0800157check_2 tools/perf/arch/s390/entry/syscalls/syscall.tbl arch/s390/kernel/syscalls/syscall.tbl
Tiezhu Yangd9fd5a72021-02-04 11:35:24 +0800158check_2 tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl arch/mips/kernel/syscalls/syscall_n64.tbl
Jiri Olsac9b51a02018-08-13 13:15:04 +0200159
Arnaldo Carvalho de Melod758d5d2020-09-29 08:56:38 -0300160for i in $BEAUTY_FILES; do
161 beauty_check $i -B
162done
Arnaldo Carvalho de Melof3cf7fa2020-08-12 08:43:51 -0300163
Ian Rogerseee19502020-05-15 15:17:29 -0700164# check duplicated library files
165check_2 tools/perf/util/hashmap.h tools/lib/bpf/hashmap.h
166check_2 tools/perf/util/hashmap.c tools/lib/bpf/hashmap.c
167
Jiri Olsa7ea6e982018-08-13 13:15:03 +0200168cd tools/perf