• Mark Rutland's avatar
    atomics: Fix atomic64_{read_acquire,set_release} fallbacks · dc1b4df0
    Mark Rutland authored
    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...
    dc1b4df0
set_release 242 Bytes