Re: [patch V2 08/15] Documentation: Add lock ordering and nesting documentation

From
Davidlohr Bueso <dave@stgolabs.net>
Date
2020-03-19 08:52:21
Also in
linux-pci, linux-usb, linuxppc-dev, lkml, netdev
Reply to
Thomas Gleixner, 2020-03-18
On Wed, 18 Mar 2020, Thomas Gleixner wrote:
quoted hunk ↗ jump to hunk
+Owner semantics
+===============
+
+Most lock types in the Linux kernel have strict owner semantics, i.e. the
+context (task) which acquires a lock has to release it.
+
+There are two exceptions:
+
+  - semaphores
+  - rwsems
+
+semaphores have no strict owner semantics for historical reasons. They are
I would rephrase this to:

semaphores have no owner semantics for historical reason, and as such
trylock and release operations can be called from interrupt context. They
are ...
quoted hunk ↗ jump to hunk
+often used for both serialization and waiting purposes. That's generally
+discouraged and should be replaced by separate serialization and wait
+mechanisms.
           ^ , such as mutexes or completions.
quoted hunk ↗ jump to hunk
+
+rwsems have grown interfaces which allow non owner release for special
+purposes. This usage is problematic on PREEMPT_RT because PREEMPT_RT
+substitutes all locking primitives except semaphores with RT-mutex based
+implementations to provide priority inheritance for all lock types except
+the truly spinning ones. Priority inheritance on ownerless locks is
+obviously impossible.
+
+For now the rwsem non-owner release excludes code which utilizes it from
+being used on PREEMPT_RT enabled kernels. In same cases this can be
+mitigated by disabling portions of the code, in other cases the complete
+functionality has to be disabled until a workable solution has been found.
Thanks,
Davidlohr
Thread (72 messages) 72 messages, 17 authors, last reply 2020-03-22
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help