History

Merge tag 'locking-urgent-2020-06-11' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull atomics rework from Thomas Gleixner: "Peter Zijlstras rework of atomics and fallbacks. This solves two problems: 1) Compilers uninline small atomic_* static inline functions which can expose them to instrumentation. 2) The instrumentation of atomic primitives was done at the architecture level while composites or fallbacks were provided at the generic level. As a result there are no uninstrumented variants of the fallbacks. Both issues were in the way of fully isolating fragile entry code pathes and especially the text poke int3 handler which is prone to an endless recursion problem when anything in that code path is about to be instrumented. This was always a problem, but got elevated due to the new batch mode updates of tracing. The solution is to mark the functions __always_inline and to flip the fallback and instrumentation so the non-instrumented variants are at the architecture level and the instrumentation is done in generic code. The latter introduces another fallback variant which will go away once all architectures have been moved over to arch_atomic_*" * tag 'locking-urgent-2020-06-11' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: locking/atomics: Flip fallbacks and instrumentation asm-generic/atomic: Use __always_inline for fallback wrappers

Linus Torvalds committed 6 years ago

Commit 9716e572 parents b1a6274 37f817328 files · +2594 −269Browse files

Showing the changes to scripts (21 of 28 files). Show all

Unified · Split

21 files
  1. scripts/atomic/fallbacks/acquire +3 −3
  2. scripts/atomic/fallbacks/add_negative +4 −4
  3. scripts/atomic/fallbacks/add_unless +4 −4
  4. scripts/atomic/fallbacks/andnot +3 −3
  5. scripts/atomic/fallbacks/dec +3 −3
  6. scripts/atomic/fallbacks/dec_and_test +4 −4
  7. scripts/atomic/fallbacks/dec_if_positive +4 −4
  8. scripts/atomic/fallbacks/dec_unless_positive +4 −4
  9. scripts/atomic/fallbacks/fence +3 −3
  10. scripts/atomic/fallbacks/fetch_add_unless +5 −5
  11. scripts/atomic/fallbacks/inc +3 −3
  12. scripts/atomic/fallbacks/inc_and_test +4 −4
  13. scripts/atomic/fallbacks/inc_not_zero +4 −4
  14. scripts/atomic/fallbacks/inc_unless_negative +4 −4
  15. scripts/atomic/fallbacks/read_acquire +2 −2
  16. scripts/atomic/fallbacks/release +3 −3
  17. scripts/atomic/fallbacks/set_release +2 −2
  18. scripts/atomic/fallbacks/sub_and_test +4 −4
  19. scripts/atomic/fallbacks/try_cmpxchg +3 −3
  20. scripts/atomic/gen-atomic-fallback.sh +15 −16
  21. scripts/atomic/gen-atomics.sh +3 −2
scripts/atomic/fallbacks/acquire+3−3
@@ -1,8 +1,8 @@
1cat <<EOF1cat <<EOF
2static inline ${ret}2static __always_inline ${ret}
3${atomic}_${pfx}${name}${sfx}_acquire(${params})3${arch}${atomic}_${pfx}${name}${sfx}_acquire(${params})
4{4{
5 ${ret} ret = ${atomic}_${pfx}${name}${sfx}_relaxed(${args});5 ${ret} ret = ${arch}${atomic}_${pfx}${name}${sfx}_relaxed(${args});
6 __atomic_acquire_fence();6 __atomic_acquire_fence();
7 return ret;7 return ret;
8}8}
scripts/atomic/fallbacks/add_negative+4−4
@@ -1,6 +1,6 @@
1cat <<EOF1cat <<EOF
2/**2/**
3 * ${atomic}_add_negative - add and test if negative3 * ${arch}${atomic}_add_negative - add and test if negative
4 * @i: integer value to add4 * @i: integer value to add
5 * @v: pointer of type ${atomic}_t5 * @v: pointer of type ${atomic}_t
6 *6 *
@@ -8,9 +8,9 @@ cat <<EOF · 1 unmodified line
8 * if the result is negative, or false when8 * if the result is negative, or false when
9 * result is greater than or equal to zero.9 * result is greater than or equal to zero.
10 */10 */
11static inline bool11static __always_inline bool
12${atomic}_add_negative(${int} i, ${atomic}_t *v)12${arch}${atomic}_add_negative(${int} i, ${atomic}_t *v)
13{13{
14 return ${atomic}_add_return(i, v) < 0;14 return ${arch}${atomic}_add_return(i, v) < 0;
15}15}
16EOF16EOF
scripts/atomic/fallbacks/add_unless+4−4
@@ -1,6 +1,6 @@
1cat << EOF1cat << EOF
2/**2/**
3 * ${atomic}_add_unless - add unless the number is already a given value3 * ${arch}${atomic}_add_unless - add unless the number is already a given value
4 * @v: pointer of type ${atomic}_t4 * @v: pointer of type ${atomic}_t
5 * @a: the amount to add to v...5 * @a: the amount to add to v...
6 * @u: ...unless v is equal to u.6 * @u: ...unless v is equal to u.
@@ -8,9 +8,9 @@ cat << EOF · 1 unmodified line
8 * Atomically adds @a to @v, if @v was not already @u.8 * Atomically adds @a to @v, if @v was not already @u.
9 * Returns true if the addition was done.9 * Returns true if the addition was done.
10 */10 */
11static inline bool11static __always_inline bool
12${atomic}_add_unless(${atomic}_t *v, ${int} a, ${int} u)12${arch}${atomic}_add_unless(${atomic}_t *v, ${int} a, ${int} u)
13{13{
14 return ${atomic}_fetch_add_unless(v, a, u) != u;14 return ${arch}${atomic}_fetch_add_unless(v, a, u) != u;
15}15}
16EOF16EOF
scripts/atomic/fallbacks/andnot+3−3
@@ -1,7 +1,7 @@
1cat <<EOF1cat <<EOF
2static inline ${ret}2static __always_inline ${ret}
3${atomic}_${pfx}andnot${sfx}${order}(${int} i, ${atomic}_t *v)3${arch}${atomic}_${pfx}andnot${sfx}${order}(${int} i, ${atomic}_t *v)
4{4{
5 ${retstmt}${atomic}_${pfx}and${sfx}${order}(~i, v);5 ${retstmt}${arch}${atomic}_${pfx}and${sfx}${order}(~i, v);
6}6}
7EOF7EOF
scripts/atomic/fallbacks/dec+3−3
@@ -1,7 +1,7 @@
1cat <<EOF1cat <<EOF
2static inline ${ret}2static __always_inline ${ret}
3${atomic}_${pfx}dec${sfx}${order}(${atomic}_t *v)3${arch}${atomic}_${pfx}dec${sfx}${order}(${atomic}_t *v)
4{4{
5 ${retstmt}${atomic}_${pfx}sub${sfx}${order}(1, v);5 ${retstmt}${arch}${atomic}_${pfx}sub${sfx}${order}(1, v);
6}6}
7EOF7EOF
scripts/atomic/fallbacks/dec_and_test+4−4
@@ -1,15 +1,15 @@
1cat <<EOF1cat <<EOF
2/**2/**
3 * ${atomic}_dec_and_test - decrement and test3 * ${arch}${atomic}_dec_and_test - decrement and test
4 * @v: pointer of type ${atomic}_t4 * @v: pointer of type ${atomic}_t
5 *5 *
6 * Atomically decrements @v by 1 and6 * Atomically decrements @v by 1 and
7 * returns true if the result is 0, or false for all other7 * returns true if the result is 0, or false for all other
8 * cases.8 * cases.
9 */9 */
10static inline bool10static __always_inline bool
11${atomic}_dec_and_test(${atomic}_t *v)11${arch}${atomic}_dec_and_test(${atomic}_t *v)
12{12{
13 return ${atomic}_dec_return(v) == 0;13 return ${arch}${atomic}_dec_return(v) == 0;
14}14}
15EOF15EOF
scripts/atomic/fallbacks/dec_if_positive+4−4
@@ -1,14 +1,14 @@
1cat <<EOF1cat <<EOF
2static inline ${ret}2static __always_inline ${ret}
3${atomic}_dec_if_positive(${atomic}_t *v)3${arch}${atomic}_dec_if_positive(${atomic}_t *v)
4{4{
5 ${int} dec, c = ${atomic}_read(v);5 ${int} dec, c = ${arch}${atomic}_read(v);
6 6
7 do {7 do {
8 dec = c - 1;8 dec = c - 1;
9 if (unlikely(dec < 0))9 if (unlikely(dec < 0))
10 break;10 break;
11 } while (!${atomic}_try_cmpxchg(v, &c, dec));11 } while (!${arch}${atomic}_try_cmpxchg(v, &c, dec));
12 12
13 return dec;13 return dec;
14}14}
scripts/atomic/fallbacks/dec_unless_positive+4−4
@@ -1,13 +1,13 @@
1cat <<EOF1cat <<EOF
2static inline bool2static __always_inline bool
3${atomic}_dec_unless_positive(${atomic}_t *v)3${arch}${atomic}_dec_unless_positive(${atomic}_t *v)
4{4{
5 ${int} c = ${atomic}_read(v);5 ${int} c = ${arch}${atomic}_read(v);
6 6
7 do {7 do {
8 if (unlikely(c > 0))8 if (unlikely(c > 0))
9 return false;9 return false;
10 } while (!${atomic}_try_cmpxchg(v, &c, c - 1));10 } while (!${arch}${atomic}_try_cmpxchg(v, &c, c - 1));
11 11
12 return true;12 return true;
13}13}
scripts/atomic/fallbacks/fence+3−3
@@ -1,10 +1,10 @@
1cat <<EOF1cat <<EOF
2static inline ${ret}2static __always_inline ${ret}
3${atomic}_${pfx}${name}${sfx}(${params})3${arch}${atomic}_${pfx}${name}${sfx}(${params})
4{4{
5 ${ret} ret;5 ${ret} ret;
6 __atomic_pre_full_fence();6 __atomic_pre_full_fence();
7 ret = ${atomic}_${pfx}${name}${sfx}_relaxed(${args});7 ret = ${arch}${atomic}_${pfx}${name}${sfx}_relaxed(${args});
8 __atomic_post_full_fence();8 __atomic_post_full_fence();
9 return ret;9 return ret;
10}10}
scripts/atomic/fallbacks/fetch_add_unless+5−5
@@ -1,6 +1,6 @@
1cat << EOF1cat << EOF
2/**2/**
3 * ${atomic}_fetch_add_unless - add unless the number is already a given value3 * ${arch}${atomic}_fetch_add_unless - add unless the number is already a given value
4 * @v: pointer of type ${atomic}_t4 * @v: pointer of type ${atomic}_t
5 * @a: the amount to add to v...5 * @a: the amount to add to v...
6 * @u: ...unless v is equal to u.6 * @u: ...unless v is equal to u.
@@ -8,15 +8,15 @@ cat << EOF · 1 unmodified line
8 * Atomically adds @a to @v, so long as @v was not already @u.8 * Atomically adds @a to @v, so long as @v was not already @u.
9 * Returns original value of @v9 * Returns original value of @v
10 */10 */
11static inline ${int}11static __always_inline ${int}
12${atomic}_fetch_add_unless(${atomic}_t *v, ${int} a, ${int} u)12${arch}${atomic}_fetch_add_unless(${atomic}_t *v, ${int} a, ${int} u)
13{13{
14 ${int} c = ${atomic}_read(v);14 ${int} c = ${arch}${atomic}_read(v);
15 15
16 do {16 do {
17 if (unlikely(c == u))17 if (unlikely(c == u))
18 break;18 break;
19 } while (!${atomic}_try_cmpxchg(v, &c, c + a));19 } while (!${arch}${atomic}_try_cmpxchg(v, &c, c + a));
20 20
21 return c;21 return c;
22}22}
scripts/atomic/fallbacks/inc+3−3
@@ -1,7 +1,7 @@
1cat <<EOF1cat <<EOF
2static inline ${ret}2static __always_inline ${ret}
3${atomic}_${pfx}inc${sfx}${order}(${atomic}_t *v)3${arch}${atomic}_${pfx}inc${sfx}${order}(${atomic}_t *v)
4{4{
5 ${retstmt}${atomic}_${pfx}add${sfx}${order}(1, v);5 ${retstmt}${arch}${atomic}_${pfx}add${sfx}${order}(1, v);
6}6}
7EOF7EOF
scripts/atomic/fallbacks/inc_and_test+4−4
@@ -1,15 +1,15 @@
1cat <<EOF1cat <<EOF
2/**2/**
3 * ${atomic}_inc_and_test - increment and test3 * ${arch}${atomic}_inc_and_test - increment and test
4 * @v: pointer of type ${atomic}_t4 * @v: pointer of type ${atomic}_t
5 *5 *
6 * Atomically increments @v by 16 * Atomically increments @v by 1
7 * and returns true if the result is zero, or false for all7 * and returns true if the result is zero, or false for all
8 * other cases.8 * other cases.
9 */9 */
10static inline bool10static __always_inline bool
11${atomic}_inc_and_test(${atomic}_t *v)11${arch}${atomic}_inc_and_test(${atomic}_t *v)
12{12{
13 return ${atomic}_inc_return(v) == 0;13 return ${arch}${atomic}_inc_return(v) == 0;
14}14}
15EOF15EOF
scripts/atomic/fallbacks/inc_not_zero+4−4
@@ -1,14 +1,14 @@
1cat <<EOF1cat <<EOF
2/**2/**
3 * ${atomic}_inc_not_zero - increment unless the number is zero3 * ${arch}${atomic}_inc_not_zero - increment unless the number is zero
4 * @v: pointer of type ${atomic}_t4 * @v: pointer of type ${atomic}_t
5 *5 *
6 * Atomically increments @v by 1, if @v is non-zero.6 * Atomically increments @v by 1, if @v is non-zero.
7 * Returns true if the increment was done.7 * Returns true if the increment was done.
8 */8 */
9static inline bool9static __always_inline bool
10${atomic}_inc_not_zero(${atomic}_t *v)10${arch}${atomic}_inc_not_zero(${atomic}_t *v)
11{11{
12 return ${atomic}_add_unless(v, 1, 0);12 return ${arch}${atomic}_add_unless(v, 1, 0);
13}13}
14EOF14EOF
scripts/atomic/fallbacks/inc_unless_negative+4−4
@@ -1,13 +1,13 @@
1cat <<EOF1cat <<EOF
2static inline bool2static __always_inline bool
3${atomic}_inc_unless_negative(${atomic}_t *v)3${arch}${atomic}_inc_unless_negative(${atomic}_t *v)
4{4{
5 ${int} c = ${atomic}_read(v);5 ${int} c = ${arch}${atomic}_read(v);
6 6
7 do {7 do {
8 if (unlikely(c < 0))8 if (unlikely(c < 0))
9 return false;9 return false;
10 } while (!${atomic}_try_cmpxchg(v, &c, c + 1));10 } while (!${arch}${atomic}_try_cmpxchg(v, &c, c + 1));
11 11
12 return true;12 return true;
13}13}
scripts/atomic/fallbacks/read_acquire+2−2
@@ -1,6 +1,6 @@
1cat <<EOF1cat <<EOF
2static inline ${ret}2static __always_inline ${ret}
3${atomic}_read_acquire(const ${atomic}_t *v)3${arch}${atomic}_read_acquire(const ${atomic}_t *v)
4{4{
5 return smp_load_acquire(&(v)->counter);5 return smp_load_acquire(&(v)->counter);
6}6}
scripts/atomic/fallbacks/release+3−3
@@ -1,8 +1,8 @@
1cat <<EOF1cat <<EOF
2static inline ${ret}2static __always_inline ${ret}
3${atomic}_${pfx}${name}${sfx}_release(${params})3${arch}${atomic}_${pfx}${name}${sfx}_release(${params})
4{4{
5 __atomic_release_fence();5 __atomic_release_fence();
6 ${retstmt}${atomic}_${pfx}${name}${sfx}_relaxed(${args});6 ${retstmt}${arch}${atomic}_${pfx}${name}${sfx}_relaxed(${args});
7}7}
8EOF8EOF
scripts/atomic/fallbacks/set_release+2−2
@@ -1,6 +1,6 @@
1cat <<EOF1cat <<EOF
2static inline void2static __always_inline void
3${atomic}_set_release(${atomic}_t *v, ${int} i)3${arch}${atomic}_set_release(${atomic}_t *v, ${int} i)
4{4{
5 smp_store_release(&(v)->counter, i);5 smp_store_release(&(v)->counter, i);
6}6}
scripts/atomic/fallbacks/sub_and_test+4−4
@@ -1,6 +1,6 @@
1cat <<EOF1cat <<EOF
2/**2/**
3 * ${atomic}_sub_and_test - subtract value from variable and test result3 * ${arch}${atomic}_sub_and_test - subtract value from variable and test result
4 * @i: integer value to subtract4 * @i: integer value to subtract
5 * @v: pointer of type ${atomic}_t5 * @v: pointer of type ${atomic}_t
6 *6 *
@@ -8,9 +8,9 @@ cat <<EOF · 1 unmodified line
8 * true if the result is zero, or false for all8 * true if the result is zero, or false for all
9 * other cases.9 * other cases.
10 */10 */
11static inline bool11static __always_inline bool
12${atomic}_sub_and_test(${int} i, ${atomic}_t *v)12${arch}${atomic}_sub_and_test(${int} i, ${atomic}_t *v)
13{13{
14 return ${atomic}_sub_return(i, v) == 0;14 return ${arch}${atomic}_sub_return(i, v) == 0;
15}15}
16EOF16EOF
scripts/atomic/fallbacks/try_cmpxchg+3−3
@@ -1,9 +1,9 @@
1cat <<EOF1cat <<EOF
2static inline bool2static __always_inline bool
3${atomic}_try_cmpxchg${order}(${atomic}_t *v, ${int} *old, ${int} new)3${arch}${atomic}_try_cmpxchg${order}(${atomic}_t *v, ${int} *old, ${int} new)
4{4{
5 ${int} r, o = *old;5 ${int} r, o = *old;
6 r = ${atomic}_cmpxchg${order}(v, o, new);6 r = ${arch}${atomic}_cmpxchg${order}(v, o, new);
7 if (unlikely(r != o))7 if (unlikely(r != o))
8 *old = r;8 *old = r;
9 return likely(r == o);9 return likely(r == o);
scripts/atomic/gen-atomic-fallback.sh+15−16
@@ -2,10 +2,11 @@ · 1 unmodified line
2# SPDX-License-Identifier: GPL-2.02# SPDX-License-Identifier: GPL-2.0
3 3
4ATOMICDIR=$(dirname $0)4ATOMICDIR=$(dirname $0)
5ARCH=$2
5 6
6. ${ATOMICDIR}/atomic-tbl.sh7. ${ATOMICDIR}/atomic-tbl.sh
7 8
8#gen_template_fallback(template, meta, pfx, name, sfx, order, atomic, int, args...)9#gen_template_fallback(template, meta, pfx, name, sfx, order, arch, atomic, int, args...)
9gen_template_fallback()10gen_template_fallback()
10{11{
11 local template="$1"; shift12 local template="$1"; shift
@@ -14,10 +15,11 @@ gen_template_fallback() · 2 unmodified lines
14 local name="$1"; shift15 local name="$1"; shift
15 local sfx="$1"; shift16 local sfx="$1"; shift
16 local order="$1"; shift17 local order="$1"; shift
18 local arch="$1"; shift
17 local atomic="$1"; shift19 local atomic="$1"; shift
18 local int="$1"; shift20 local int="$1"; shift
19 21
20 local atomicname="${atomic}_${pfx}${name}${sfx}${order}"22 local atomicname="${arch}${atomic}_${pfx}${name}${sfx}${order}"
21 23
22 local ret="$(gen_ret_type "${meta}" "${int}")"24 local ret="$(gen_ret_type "${meta}" "${int}")"
23 local retstmt="$(gen_ret_stmt "${meta}")"25 local retstmt="$(gen_ret_stmt "${meta}")"
@@ -32,7 +34,7 @@ gen_template_fallback() · 8 unmodified lines
32 fi34 fi
33}35}
34 36
35#gen_proto_fallback(meta, pfx, name, sfx, order, atomic, int, args...)37#gen_proto_fallback(meta, pfx, name, sfx, order, arch, atomic, int, args...)
36gen_proto_fallback()38gen_proto_fallback()
37{39{
38 local meta="$1"; shift40 local meta="$1"; shift
@@ -56,16 +58,17 @@ cat << EOF · 17 unmodified lines
56EOF58EOF
57}59}
58 60
59#gen_proto_order_variants(meta, pfx, name, sfx, atomic, int, args...)61#gen_proto_order_variants(meta, pfx, name, sfx, arch, atomic, int, args...)
60gen_proto_order_variants()62gen_proto_order_variants()
61{63{
62 local meta="$1"; shift64 local meta="$1"; shift
63 local pfx="$1"; shift65 local pfx="$1"; shift
64 local name="$1"; shift66 local name="$1"; shift
65 local sfx="$1"; shift67 local sfx="$1"; shift
66 local atomic="$1"68 local arch="$1"
69 local atomic="$2"
67 70
68 local basename="${atomic}_${pfx}${name}${sfx}"71 local basename="${arch}${atomic}_${pfx}${name}${sfx}"
69 72
70 local template="$(find_fallback_template "${pfx}" "${name}" "${sfx}" "${order}")"73 local template="$(find_fallback_template "${pfx}" "${name}" "${sfx}" "${order}")"
71 74
@@ -94,7 +97,7 @@ gen_proto_order_variants() · 22 unmodified lines
94 gen_basic_fallbacks "${basename}"97 gen_basic_fallbacks "${basename}"
95 98
96 if [ ! -z "${template}" ]; then99 if [ ! -z "${template}" ]; then
97 printf "#endif /* ${atomic}_${pfx}${name}${sfx} */\n\n"100 printf "#endif /* ${arch}${atomic}_${pfx}${name}${sfx} */\n\n"
98 gen_proto_fallback "${meta}" "${pfx}" "${name}" "${sfx}" "" "$@"101 gen_proto_fallback "${meta}" "${pfx}" "${name}" "${sfx}" "" "$@"
99 gen_proto_fallback "${meta}" "${pfx}" "${name}" "${sfx}" "_acquire" "$@"102 gen_proto_fallback "${meta}" "${pfx}" "${name}" "${sfx}" "_acquire" "$@"
100 gen_proto_fallback "${meta}" "${pfx}" "${name}" "${sfx}" "_release" "$@"103 gen_proto_fallback "${meta}" "${pfx}" "${name}" "${sfx}" "_release" "$@"
@@ -149,20 +152,19 @@ cat << EOF · 48 unmodified lines
149#ifndef _LINUX_ATOMIC_FALLBACK_H152#ifndef _LINUX_ATOMIC_FALLBACK_H
150#define _LINUX_ATOMIC_FALLBACK_H153#define _LINUX_ATOMIC_FALLBACK_H
151 154
155#include <linux/compiler.h>
156
152EOF157EOF
153 158
154for xchg in "xchg" "cmpxchg" "cmpxchg64"; do159for xchg in "${ARCH}xchg" "${ARCH}cmpxchg" "${ARCH}cmpxchg64"; do
155 gen_xchg_fallbacks "${xchg}"160 gen_xchg_fallbacks "${xchg}"
156done161done
157 162
158grep '^[a-z]' "$1" | while read name meta args; do163grep '^[a-z]' "$1" | while read name meta args; do
159 gen_proto "${meta}" "${name}" "atomic" "int" ${args}164 gen_proto "${meta}" "${name}" "${ARCH}" "atomic" "int" ${args}
160done165done
161 166
162cat <<EOF167cat <<EOF
163#define atomic_cond_read_acquire(v, c) smp_cond_load_acquire(&(v)->counter, (c))
164#define atomic_cond_read_relaxed(v, c) smp_cond_load_relaxed(&(v)->counter, (c))
165
166#ifdef CONFIG_GENERIC_ATOMIC64168#ifdef CONFIG_GENERIC_ATOMIC64
167#include <asm-generic/atomic64.h>169#include <asm-generic/atomic64.h>
168#endif170#endif
@@ -170,12 +172,9 @@ cat <<EOF · 1 unmodified line
170EOF172EOF
171 173
172grep '^[a-z]' "$1" | while read name meta args; do174grep '^[a-z]' "$1" | while read name meta args; do
173 gen_proto "${meta}" "${name}" "atomic64" "s64" ${args}175 gen_proto "${meta}" "${name}" "${ARCH}" "atomic64" "s64" ${args}
174done176done
175 177
176cat <<EOF178cat <<EOF
177#define atomic64_cond_read_acquire(v, c) smp_cond_load_acquire(&(v)->counter, (c))
178#define atomic64_cond_read_relaxed(v, c) smp_cond_load_relaxed(&(v)->counter, (c))
179
180#endif /* _LINUX_ATOMIC_FALLBACK_H */179#endif /* _LINUX_ATOMIC_FALLBACK_H */
181EOF180EOF
scripts/atomic/gen-atomics.sh+3−2
@@ -10,10 +10,11 @@ LINUXDIR=${ATOMICDIR}/../.. · 9 unmodified lines
10cat <<EOF |10cat <<EOF |
11gen-atomic-instrumented.sh asm-generic/atomic-instrumented.h11gen-atomic-instrumented.sh asm-generic/atomic-instrumented.h
12gen-atomic-long.sh asm-generic/atomic-long.h12gen-atomic-long.sh asm-generic/atomic-long.h
13gen-atomic-fallback.sh linux/atomic-arch-fallback.h arch_
13gen-atomic-fallback.sh linux/atomic-fallback.h14gen-atomic-fallback.sh linux/atomic-fallback.h
14EOF15EOF
15while read script header; do16while read script header args; do
16 /bin/sh ${ATOMICDIR}/${script} ${ATOMICTBL} > ${LINUXDIR}/include/${header}17 /bin/sh ${ATOMICDIR}/${script} ${ATOMICTBL} ${args} > ${LINUXDIR}/include/${header}
17 HASH="$(sha1sum ${LINUXDIR}/include/${header})"18 HASH="$(sha1sum ${LINUXDIR}/include/${header})"
18 HASH="${HASH%% *}"19 HASH="${HASH%% *}"
19 printf "// %s\n" "${HASH}" >> ${LINUXDIR}/include/${header}20 printf "// %s\n" "${HASH}" >> ${LINUXDIR}/include/${header}