locking, sched: The PREEMPT-RT locking infrastructure
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest50 patches 25 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/50 | sched: Split out the wakeup state checkkernel/ | +18 | 0 replies | |
| 2/50 | sched: Introduce TASK_RTLOCK_WAITinclude/ | +3 | 0 replies | |
| 3/50 | sched: Prepare for RT sleeping spin/rwlocksinclude/ kernel/ | +103 | 4 replies | |
| 4/50 | sched: Rework the __schedule() preempt argumentkernel/ | +25 | 1 reply | |
| 5/50 | sched: Provide schedule point for RT locksinclude/ kernel/ | +23 | 4 replies | |
| 6/50 | sched/wake_q: Provide WAKE_Q_HEAD_INITIALIZERinclude/ | +5 | 0 replies | |
| 7/50 | rtmutex: Convert macros to inlineskernel/ | +27 | 0 replies | |
| 8/50 | rtmutex: Switch to try_cmpxchg()kernel/ | +2 | 0 replies | |
| 9/50 | rtmutex: Split API and implementationkernel/ kernel/ kernel/ +1 more | +514 | 0 replies | |
| 10/50 | locking/rtmutex: Provide rt_mutex_slowlock_locked()kernel/ kernel/ kernel/ | +72 | 2 replies | |
| 11/50 | locking/rtmutex: Provide lockdep less variants of rtmutex interfaceskernel/ kernel/ | +53 | 0 replies | |
| 12/50 | locking: Add base code for RT rw_semaphore and rwlockinclude/ kernel/ | +300 | 0 replies | |
| 13/50 | locking/rwsem: Add rtmutex based R/W semaphore implementationinclude/ kernel/ | +166 | 0 replies | |
| 14/50 | locking/rtmutex: Add wake_state to rt_mutex_waiterkernel/ kernel/ | +10 | 2 replies | |
| 15/50 | locking/rtmutex: Provide rt_mutex_wake_q and helperskernel/ kernel/ | +29 | 0 replies | |
| 16/50 | locking/rtmutex: Use rt_mutex_wake_q_headkernel/ kernel/ kernel/ +1 more | +19 | 2 replies | |
| 17/50 | locking/rtmutex: Prepare RT rt_mutex_wake_q for RT lockskernel/ kernel/ | +17 | 2 replies | |
| 18/50 | locking/rtmutex: Guard regular sleeping locks specific functionskernel/ kernel/ | +132 | 0 replies | |
| 19/50 | locking/spinlock: Split the lock types headerinclude/ include/ include/ +1 more | +74 | 0 replies | |
| 20/50 | locking/rtmutex: Prevent future include recursion hellinclude/ | +1 | 0 replies | |
| 21/50 | locking/lockdep: Reduce includes in debug_locks.hinclude/ | +1 | 0 replies | |
| 22/50 | rbtree: Split out the rbtree type definitionsinclude/ include/ | +35 | 2 replies | |
| 23/50 | locking/rtmutex: Include only rbtree typesinclude/ | +1 | 0 replies | |
| 24/50 | locking/spinlock: Provide RT specific spinlock typeinclude/ | +26 | 2 replies | |
| 25/50 | locking/spinlock: Provide RT variant headerinclude/ include/ include/ | +162 | 0 replies | |
| 26/50 | locking/rtmutex: Provide the spin/rwlock core lock functionkernel/ kernel/ | +61 | 1 reply | |
| 27/50 | locking/spinlock: Provide RT variantkernel/ kernel/ | +129 | 1 reply | |
| 28/50 | locking/rwlock: Provide RT variantinclude/ include/ include/ +4 more | +317 | 0 replies | |
| 29/50 | locking/mutex: Consolidate core headerskernel/ kernel/ kernel/ +1 more | +19 | 0 replies | |
| 30/50 | locking/mutex: Move waiter to core headerinclude/ kernel/ | +13 | 0 replies | |
| 31/50 | locking/ww_mutex: Move ww_mutex declarations into ww_mutex.hinclude/ include/ | +8 | 0 replies | |
| 32/50 | locking/mutex: Make mutex::wait_lock rawinclude/ kernel/ | +13 | 0 replies | |
| 33/50 | locking/mutex: Introduce _mutex_tinclude/ | +8 | 1 reply | |
| 34/50 | locking/mutex: Rename the ww_mutex relevant functionsinclude/ include/ kernel/ +1 more | +52 | 0 replies | |
| 35/50 | locking/ww_mutex: Switch to _mutex_tinclude/ | +4 | 0 replies | |
| 36/50 | locking/mutex: Replace struct mutex in core codekernel/ kernel/ kernel/ | +39 | 0 replies | |
| 37/50 | locking/mutex: Rearrange items in mutex.hinclude/ | +10 | 0 replies | |
| 38/50 | locking/mutex: Exclude non-ww_mutex API for RTkernel/ | +23 | 0 replies | |
| 39/50 | locking/rtmutex: Add mutex variant for RTinclude/ kernel/ | +173 | 0 replies | |
| 40/50 | lib/test_lockup: Adapt to changed variables.lib/ | +4 | 0 replies | |
| 41/50 | futex: Validate waiter correctly in futex_proxy_trylock_atomic()kernel/ | +4 | 0 replies | |
| 42/50 | futex: Cleanup stale commentskernel/ | +3 | 1 reply | |
| 43/50 | futex: Correct the number of requeued waiters for PIkernel/ | +4 | 0 replies | |
| 44/50 | futex: Restructure futex_requeue()kernel/ | +41 | 0 replies | |
| 45/50 | futex: Clarify comment in futex_requeue()kernel/ | +20 | 0 replies | |
| 46/50 | futex: Prevent requeue_pi() lock nesting issue on RTkernel/ | +278 | 0 replies | |
| 47/50 | rtmutex: Prevent lockdep false positive with PI futexeskernel/ | +12 | 0 replies | |
| 48/50 | preempt: Adjust PREEMPT_LOCK_OFFSET for RTinclude/ | +4 | 0 replies | |
| 49/50 | locking/rtmutex: Implement equal priority lock stealingkernel/ | +35 | 0 replies | |
| 50/50 | locking/rtmutex: Add adaptive spinwait mechanismkernel/ | +49 | 0 replies |
Reviews trailers per patch
None of the 50 patches has a Reviewed-by or Acked-by.
| Patch | Gregory Haskins | Valentin Schneider |
|---|---|---|
| Series | T-b | |
| 1/50 | ||
| 2/50 | ||
| 3/50 | ||
| 4/50 | ||
| 5/50 | ||
| 6/50 | ||
| 7/50 | ||
| 8/50 | ||
| 9/50 | ||
| 10/50 | ||
| 11/50 | ||
| 12/50 | ||
| 13/50 | ||
| 14/50 | ||
| 15/50 | ||
| 16/50 | ||
| 17/50 | ||
| 18/50 | ||
| 19/50 | ||
| 20/50 | ||
| 21/50 | ||
| 22/50 | ||
| 23/50 | ||
| 24/50 | ||
| 25/50 | ||
| 26/50 | ||
| 27/50 | ||
| 28/50 | ||
| 29/50 | ||
| 30/50 | ||
| 31/50 | ||
| 32/50 | ||
| 33/50 | ||
| 34/50 | ||
| 35/50 | ||
| 36/50 | ||
| 37/50 | ||
| 38/50 | ||
| 39/50 | ||
| 40/50 | ||
| 41/50 | ||
| 42/50 | ||
| 43/50 | ||
| 44/50 | ||
| 45/50 | ||
| 46/50 | ||
| 47/50 | ||
| 48/50 | ||
| 49/50 | ||
| 50/50 | Originally-by |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [patch 00/50] locking, sched: The PREEMPT-RT locking infrastructure
Folks,
the following series contains the bulk of the PREEMPT-RT locking infrastructure. In PREEMPT-RT enabled kernels the following locking primitives are substituted by RT-Mutex based variants:
mutex, rw_semaphore, spinlock, rwlock
semaphores are not substituted because they do not provide strict owner semantics.
ww_mutexes are also not substituted because the usage sites are not really RT relevant and it would require a full reimplementation to make them work correctly based on rtmutex. That might change in the future, but for now utilizing the existing variant is considered a safe and sane choice.
Of course raw_spinlocks are not touched either as they protect low level operations in the scheduler, timers and hardware access.
The most interesting parts of the series which need a lot of eyeballs are:
- the scheduler bits which provide the infrastructure for spinlock and rwlock substitution to ensure that the task state is preserved when blocking on such a lock and a regular wakeup is handled correctly and not lost
- the rtmutex core implementation to handle lock contention on spinlocks and rwlocks correctly vs. the task state
- the rw_semaphore/rwlock substitutions which utilize the same implementation vs. the reader/writer handling
- the isolation of the ww_mutex code which allows to build it stand alone. The typedef based solution might look a bit odd on the first glance, but that turned out to be the least intrusive variant.
- the PI futex related bits to handle the interaction between blocking on the underlying rtmutex and contention on the hash bucket lock which is converted to a 'sleeping spinlock'.
The rest surely needs a thorough review as well, but those parts are pretty straight forward. Quite some code restructuring and the actual wrapper functions to replace the existing !RT implementations.
The series survived quite some internal testing in RT kernels and is part of the recent 5.13-rt1 release.
For !RT kernels there is no functional change.
The series is also available from git:
git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git rtmutex
Thanks,
tglx
--- a/kernel/locking/mutex-debug.h | 29 - b/include/linux/mutex.h | 165 ++++-- b/include/linux/rbtree_types.h | 34 + b/include/linux/rwbase_rt.h | 37 + b/include/linux/rwlock_rt.h | 140 +++++ b/include/linux/spinlock_rt.h | 151 +++++ b/include/linux/spinlock_types_raw.h | 65 ++ b/kernel/locking/rtmutex_api.c | 647 ++++++++++++++++++++++++ b/kernel/locking/rwbase_rt.c | 263 +++++++++ b/kernel/locking/spinlock_rt.c | 257 +++++++++ include/linux/debug_locks.h | 3 include/linux/preempt.h | 4 include/linux/rbtree.h | 30 - include/linux/rtmutex.h | 4 include/linux/rwlock_types.h | 39 + include/linux/rwsem.h | 58 ++ include/linux/sched.h | 77 ++ include/linux/sched/wake_q.h | 7 include/linux/spinlock.h | 15 include/linux/spinlock_api_smp.h | 3 include/linux/spinlock_types.h | 45 + include/linux/ww_mutex.h | 16 kernel/Kconfig.locks | 2 kernel/futex.c | 466 ++++++++++++----- kernel/locking/Makefile | 3 kernel/locking/mutex-debug.c | 25 kernel/locking/mutex.c | 139 ++--- kernel/locking/mutex.h | 35 + kernel/locking/rtmutex.c | 930 ++++++++++++----------------------- kernel/locking/rtmutex_common.h | 110 ++-- kernel/locking/rwsem.c | 108 ++++ kernel/locking/spinlock.c | 7 kernel/locking/spinlock_debug.c | 5 kernel/sched/core.c | 111 +++- lib/test_lockup.c | 8 35 files changed, 3031 insertions(+), 1007 deletions(-)