atomics: Fix atomic64_{read_acquire,set_release} fallbacks
Arnd reports that on 32-bit architectures, the fallbacks for atomic64_read_acquire() and atomic64_set_release() are broken as they use smp_load_acquire() and smp_store_release() respectively, which do not work on types larger than the native word size. Since those contain compiletime_assert_atomic_type(), any attempt to use those fallbacks will result in a build-time error. e.g. with the following added to arch/arm/kernel/setup.c: | void test_atomic64(atomic64_t *v) | { | atomic64_set_release(v, 5); | atomic64_read_acquire(v); | } The compiler will complain as follows: | In file included from <command-line>: | In function 'arch_atomic64_set_release', | inlined from 'test_atomic64' at ./include/linux/atomic/atomic-instrumented.h:669:2: | ././include/linux/compiler_types.h:346:38: error: call to '__compiletime_assert_9' declared with attribute error: Need native word sized stores/loads for atomicity. | 346 | _compiletime_ass...
Showing
- include/linux/atomic/atomic-arch-fallback.h 33 additions, 5 deletionsinclude/linux/atomic/atomic-arch-fallback.h
- scripts/atomic/fallbacks/read_acquire 10 additions, 1 deletionscripts/atomic/fallbacks/read_acquire
- scripts/atomic/fallbacks/set_release 6 additions, 1 deletionscripts/atomic/fallbacks/set_release
Please register or sign in to comment