2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-28 07:04:00 +08:00
linux-next/Documentation/locking
Ahmed S. Darwish 80793c3471 seqlock: Introduce seqcount_latch_t
Latch sequence counters are a multiversion concurrency control mechanism
where the seqcount_t counter even/odd value is used to switch between
two copies of protected data. This allows the seqcount_t read path to
safely interrupt its write side critical section (e.g. from NMIs).

Initially, latch sequence counters were implemented as a single write
function above plain seqcount_t: raw_write_seqcount_latch(). The read
side was expected to use plain seqcount_t raw_read_seqcount().

A specialized latch read function, raw_read_seqcount_latch(), was later
added. It became the standardized way for latch read paths.  Due to the
dependent load, it has one read memory barrier less than the plain
seqcount_t raw_read_seqcount() API.

Only raw_write_seqcount_latch() and raw_read_seqcount_latch() should be
used with latch sequence counters. Having *unique* read and write path
APIs means that latch sequence counters are actually a data type of
their own -- just inappropriately overloading plain seqcount_t.

Introduce seqcount_latch_t. This adds type-safety and ensures that only
the correct latch-safe APIs are to be used.

Not to break bisection, let the latch APIs also accept plain seqcount_t
or seqcount_raw_spinlock_t. After converting all call sites to
seqcount_latch_t, only that new data type will be allowed.

References: 9b0fd802e8 ("seqcount: Add raw_write_seqcount_latch()")
References: 7fc26327b7 ("seqlock: Introduce raw_read_seqcount_latch()")
References: aadd6e5caa ("time/sched_clock: Use raw_read_seqcount_latch()")
Signed-off-by: Ahmed S. Darwish <a.darwish@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20200827114044.11173-4-a.darwish@linutronix.de
2020-09-10 11:19:28 +02:00
..
futex-requeue-pi.rst docs: move locking-specific documents to locking/ 2020-05-15 12:05:07 -06:00
hwspinlock.rst docs: move locking-specific documents to locking/ 2020-05-15 12:05:07 -06:00
index.rst Documentation: locking: Describe seqlock design and usage 2020-07-29 16:14:22 +02:00
lockdep-design.rst lockdep/Documention: Recursive read lock detection reasoning 2020-08-26 12:42:03 +02:00
lockstat.rst docs: locking: convert docs to ReST and rename to *.rst 2019-07-15 08:53:27 -03:00
locktorture.rst docs: RCU: Convert torture.txt to ReST 2020-06-29 11:58:11 -07:00
locktypes.rst Documentation/locking/locktypes: Fix local_locks documentation 2020-08-26 12:42:02 +02:00
mutex-design.rst docs: locking: Replace HTTP links with HTTPS ones 2020-07-16 23:19:51 +02:00
percpu-rw-semaphore.rst docs: move locking-specific documents to locking/ 2020-05-15 12:05:07 -06:00
pi-futex.rst docs: move locking-specific documents to locking/ 2020-05-15 12:05:07 -06:00
preempt-locking.rst docs: move locking-specific documents to locking/ 2020-05-15 12:05:07 -06:00
robust-futex-ABI.rst docs: move locking-specific documents to locking/ 2020-05-15 12:05:07 -06:00
robust-futexes.rst docs: move locking-specific documents to locking/ 2020-05-15 12:05:07 -06:00
rt-mutex-design.rst docs: locking: convert docs to ReST and rename to *.rst 2019-07-15 08:53:27 -03:00
rt-mutex.rst docs: move locking-specific documents to locking/ 2020-05-15 12:05:07 -06:00
seqlock.rst seqlock: Introduce seqcount_latch_t 2020-09-10 11:19:28 +02:00
spinlocks.rst docs/locking: Fix outdated section names 2020-02-05 10:21:12 -07:00
ww-mutex-design.rst Documentation: locking: ww-mutex-design: drop duplicated word 2020-07-13 09:48:31 -06:00