README 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. ============
  2. LITMUS TESTS
  3. ============
  4. Each subdirectory contains litmus tests that are typical to describe the
  5. semantics of respective kernel APIs.
  6. For more information about how to "run" a litmus test or how to generate
  7. a kernel test module based on a litmus test, please see
  8. tools/memory-model/README.
  9. atomic (/atomic directory)
  10. --------------------------
  11. Atomic-RMW+mb__after_atomic-is-stronger-than-acquire.litmus
  12. Test that an atomic RMW followed by a smp_mb__after_atomic() is
  13. stronger than a normal acquire: both the read and write parts of
  14. the RMW are ordered before the subsequential memory accesses.
  15. Atomic-RMW-ops-are-atomic-WRT-atomic_set.litmus
  16. Test that atomic_set() cannot break the atomicity of atomic RMWs.
  17. NOTE: Require herd7 7.56 or later which supports "(void)expr".
  18. cmpxchg-fail-ordered-1.litmus
  19. Demonstrate that a failing cmpxchg() operation acts as a full barrier
  20. when followed by smp_mb__after_atomic().
  21. cmpxchg-fail-ordered-2.litmus
  22. Demonstrate that a failing cmpxchg() operation acts as an acquire
  23. operation when followed by smp_mb__after_atomic().
  24. cmpxchg-fail-unordered-1.litmus
  25. Demonstrate that a failing cmpxchg() operation does not act as a
  26. full barrier.
  27. cmpxchg-fail-unordered-2.litmus
  28. Demonstrate that a failing cmpxchg() operation does not act as an
  29. acquire operation.
  30. locking (/locking directory)
  31. ----------------------------
  32. DCL-broken.litmus
  33. Demonstrates that double-checked locking needs more than just
  34. the obvious lock acquisitions and releases.
  35. DCL-fixed.litmus
  36. Demonstrates corrected double-checked locking that uses
  37. smp_store_release() and smp_load_acquire() in addition to the
  38. obvious lock acquisitions and releases.
  39. RM-broken.litmus
  40. Demonstrates problems with "roach motel" locking, where code is
  41. freely moved into lock-based critical sections. This example also
  42. shows how to use the "filter" clause to discard executions that
  43. would be excluded by other code not modeled in the litmus test.
  44. Note also that this "roach motel" optimization is emulated by
  45. physically moving P1()'s two reads from x under the lock.
  46. What is a roach motel? This is from an old advertisement for
  47. a cockroach trap, much later featured in one of the "Men in
  48. Black" movies. "The roaches check in. They don't check out."
  49. RM-fixed.litmus
  50. The counterpart to RM-broken.litmus, showing P0()'s two loads from
  51. x safely outside of the critical section.
  52. RCU (/rcu directory)
  53. --------------------
  54. MP+onceassign+derefonce.litmus (under tools/memory-model/litmus-tests/)
  55. Demonstrates the use of rcu_assign_pointer() and rcu_dereference() to
  56. ensure that an RCU reader will not see pre-initialization garbage.
  57. RCU+sync+read.litmus
  58. RCU+sync+free.litmus
  59. Both the above litmus tests demonstrate the RCU grace period guarantee
  60. that an RCU read-side critical section can never span a grace period.