Add full memory fence for test_and_*_bit operation
OK, semi-big-hammer to enforce full memory fence on ia64 for test_and_set_bittest_and_clear_bittest_and_change_bit
It's sad we don't have something like:
test_and_set_bit_used_like_a_locktest_and_set_bit_used_like_an_unlocktest_and_set_bit_full_memory_fencetest_and_clear_bit_used_like_a_locktest_and_clear_bit_used_like_an_unlocktest_and_clear_bit_full_memory_fencetest_and_change_bit_used_like_a_locktest_and_change_bit_used_like_an_unlocktest_and_change_bit_full_memory_fence
- Ken
include/asm-ia64/bitops.h renamed from include/asm-ia64/bitops.h.orig +3 -3
@@ -166,7 +166,7 @@ test_and_set_bit (int nr, volatile voidCMPXCHG_BUGCHECK (m); old = *m; new = old | bit; - }while (cmpxchg_acq (m, old, new) != old); + }while (cmpxchg_rel (m, old, new) != old);return (old & bit) !=0 ; }
@@ -211,7 +211,7 @@ test_and_clear_bit (int nr, volatile voiCMPXCHG_BUGCHECK (m); old = *m; new = old & mask; - }while (cmpxchg_acq (m, old, new) != old); + }while (cmpxchg_rel (m, old, new) != old);return (old & ~mask) !=0 ; }
@@ -256,7 +256,7 @@ test_and_change_bit (int nr, volatile voCMPXCHG_BUGCHECK (m); old = *m; new = old ^ bit; - }while (cmpxchg_acq (m, old, new) != old); + }while (cmpxchg_rel (m, old, new) != old);return (old & bit) !=0 ; }
Quoted 8 lines · Kenneth W
OK, semi-big-hammer to enforce full memory fence on ia64 for
test_and_set_bittest_and_clear_bittest_and_change_bitIt's sad we don't have something like:
test_and_set_bit_used_like_a_lock
...
Normally the arch specific (e.g. __set_bit or __raw_readl) provide different semantics than the "portable" versions (e.g set_bit and readl). Can folks who know what they are doing can use arch specific versions at the expense of portability?
I expect the driver to compile and work correctly on all arches, it will just be a bit more of a PITA to maintain.
grant