Skip to content

Commit 8d32588

Browse files
mrutland-armIngo Molnar
authored andcommitted
locking/atomics: Check generated headers are up-to-date
Now that all the generated atomic headers are in place, it would be good to ensure that: a) the headers are up-to-date when scripting changes. b) developers don't directly modify the generated headers. To ensure both of these properties, let's add a Kbuild step to check that the generated headers are up-to-date. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: linux-arm-kernel@lists.infradead.org Cc: catalin.marinas@arm.com Cc: Will Deacon <will.deacon@arm.com> Cc: linuxdrivers@attotech.com Cc: dvyukov@google.com Cc: Boqun Feng <boqun.feng@gmail.com> Cc: arnd@arndb.de Cc: aryabinin@virtuozzo.com Cc: glider@google.com Link: http://lkml.kernel.org/r/20180904104830.2975-6-mark.rutland@arm.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent aa525d0 commit 8d32588

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

Kbuild

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
# 2) Generate timeconst.h
77
# 3) Generate asm-offsets.h (may need bounds.h and timeconst.h)
88
# 4) Check for missing system calls
9-
# 5) Generate constants.py (may need bounds.h)
9+
# 5) check atomics headers are up-to-date
10+
# 6) Generate constants.py (may need bounds.h)
1011

1112
#####
1213
# 1) Generate bounds.h
@@ -72,7 +73,20 @@ missing-syscalls: scripts/checksyscalls.sh $(offsets-file) FORCE
7273
$(call cmd,syscalls)
7374

7475
#####
75-
# 5) Generate constants for Python GDB integration
76+
# 5) Check atomic headers are up-to-date
77+
#
78+
79+
always += old-atomics
80+
targets += old-atomics
81+
82+
quiet_cmd_atomics = CALL $<
83+
cmd_atomics = $(CONFIG_SHELL) scripts/atomic/check-atomics.sh
84+
85+
old-atomics: scripts/atomic/check-atomics.sh FORCE
86+
$(call cmd,atomics)
87+
88+
#####
89+
# 6) Generate constants for Python GDB integration
7690
#
7791

7892
extra-$(CONFIG_GDB_SCRIPTS) += build_constants_py

scripts/atomic/check-atomics.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/sh
2+
# SPDX-License-Identifier: GPL-2.0
3+
#
4+
# Check if atomic headers are up-to-date
5+
6+
ATOMICDIR=$(dirname $0)
7+
ATOMICTBL=${ATOMICDIR}/atomics.tbl
8+
LINUXDIR=${ATOMICDIR}/../..
9+
10+
cat <<EOF |
11+
gen-atomic-instrumented.sh asm-generic/atomic-instrumented.h
12+
gen-atomic-long.sh asm-generic/atomic-long.h
13+
gen-atomic-fallback.sh linux/atomic-fallback.h
14+
EOF
15+
while read script header; do
16+
if ! (${ATOMICDIR}/${script} ${ATOMICTBL} | diff - ${LINUXDIR}/include/${header} > /dev/null); then
17+
printf "warning: include/${header} is out-of-date.\n"
18+
fi
19+
done

0 commit comments

Comments
 (0)