]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - rpmsg/rpmsg.git/blob - Documentation/atomic_bitops.txt
Revert "HACK: ARM: dts: dra7-ipu-common: Revert to CMA pools for IPU early boots"
[rpmsg/rpmsg.git] / Documentation / atomic_bitops.txt
2 On atomic bitops.
5 While our bitmap_{}() functions are non-atomic, we have a number of operations
6 operating on single bits in a bitmap that are atomic.
9 API
10 ---
12 The single bit operations are:
14 Non-RMW ops:
16   test_bit()
18 RMW atomic operations without return value:
20   {set,clear,change}_bit()
21   clear_bit_unlock()
23 RMW atomic operations with return value:
25   test_and_{set,clear,change}_bit()
26   test_and_set_bit_lock()
28 Barriers:
30   smp_mb__{before,after}_atomic()
33 All RMW atomic operations have a '__' prefixed variant which is non-atomic.
36 SEMANTICS
37 ---------
39 Non-atomic ops:
41 In particular __clear_bit_unlock() suffers the same issue as atomic_set(),
42 which is why the generic version maps to clear_bit_unlock(), see atomic_t.txt.
45 RMW ops:
47 The test_and_{}_bit() operations return the original value of the bit.
50 ORDERING
51 --------
53 Like with atomic_t, the rule of thumb is:
55  - non-RMW operations are unordered;
57  - RMW operations that have no return value are unordered;
59  - RMW operations that have a return value are fully ordered.
61  - RMW operations that are conditional are unordered on FAILURE,
62    otherwise the above rules apply. In the case of test_and_{}_bit() operations,
63    if the bit in memory is unchanged by the operation then it is deemed to have
64    failed.
66 Except for a successful test_and_set_bit_lock() which has ACQUIRE semantics and
67 clear_bit_unlock() which has RELEASE semantics.
69 Since a platform only has a single means of achieving atomic operations
70 the same barriers as for atomic_t are used, see atomic_t.txt.