History

locking/atomic: add arch_atomic_long*()

Now that all architectures provide arch_{atomic,atomic64}_*(), we can build arch_atomic_long_*() atop these, which can be safely used in noinstr code. The regular atomic_long_*() wrappers are built atop these, as we do for {atomic,atomic64}_*() atop arch_{atomic,atomic64}_*(). We don't provide arch_* versions of the cond_read*() variants, as we don't have arch_* versions of the underlying atomic/atomic64 functions (nor the smp_cond_load*() helpers these are typically based on). Note that the headers in this patch under include/linux/atomic/ are generated by the scripts in scripts/atomic/.

Mark Rutland committed 5 years ago

Commit 67d1b0d1 parent e3d18ce5 files · +916 −333Browse files

Showing the changes to scripts (2 of 5 files). Show all

Unified · Split

2 files
  1. scripts/atomic/gen-atomic-instrumented.sh +5 −0
  2. scripts/atomic/gen-atomic-long.sh +2 −2
scripts/atomic/gen-atomic-instrumented.sh+5−0
@@ -138,6 +138,11 @@ grep '^[a-z]' "$1" | while read name meta args; do · 137 unmodified lines
138138 gen_proto "${meta}" "${name}" "atomic64" "s64" ${args}
139139 done
140140
141+grep '^[a-z]' "$1" | while read name meta args; do
142+ gen_proto "${meta}" "${name}" "atomic_long" "long" ${args}
143+done
144+
145+
141146 for xchg in "xchg" "cmpxchg" "cmpxchg64" "try_cmpxchg"; do
142147 for order in "" "_acquire" "_release" "_relaxed"; do
143148 gen_xchg "${xchg}${order}" ""
scripts/atomic/gen-atomic-long.sh+2−2
@@ -47,9 +47,9 @@ gen_proto_order_variant() · 46 unmodified lines
4747
4848 cat <<EOF
4949 static __always_inline ${ret}
50−atomic_long_${name}(${params})
50+arch_atomic_long_${name}(${params})
5151 {
52− ${retstmt}${atomic}_${name}(${argscast});
52+ ${retstmt}arch_${atomic}_${name}(${argscast});
5353 }
5454
5555 EOF