Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) =============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) Atomic bitops
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) =============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) While our bitmap_{}() functions are non-atomic, we have a number of operations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) operating on single bits in a bitmap that are atomic.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) API
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) ---
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) The single bit operations are:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) Non-RMW ops:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)   test_bit()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) RMW atomic operations without return value:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)   {set,clear,change}_bit()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)   clear_bit_unlock()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) RMW atomic operations with return value:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)   test_and_{set,clear,change}_bit()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)   test_and_set_bit_lock()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) Barriers:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)   smp_mb__{before,after}_atomic()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) All RMW atomic operations have a '__' prefixed variant which is non-atomic.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) SEMANTICS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) ---------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) Non-atomic ops:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) In particular __clear_bit_unlock() suffers the same issue as atomic_set(),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) which is why the generic version maps to clear_bit_unlock(), see atomic_t.txt.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) RMW ops:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) The test_and_{}_bit() operations return the original value of the bit.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) ORDERING
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) --------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) Like with atomic_t, the rule of thumb is:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)  - non-RMW operations are unordered;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)  - RMW operations that have no return value are unordered;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)  - RMW operations that have a return value are fully ordered.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)  - RMW operations that are conditional are unordered on FAILURE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)    otherwise the above rules apply. In the case of test_and_{}_bit() operations,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)    if the bit in memory is unchanged by the operation then it is deemed to have
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)    failed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) Except for a successful test_and_set_bit_lock() which has ACQUIRE semantics and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) clear_bit_unlock() which has RELEASE semantics.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) Since a platform only has a single means of achieving atomic operations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) the same barriers as for atomic_t are used, see atomic_t.txt.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)