locking, sched: The PREEMPT-RT locking infrastructure
Status from this message: The following commit has been merged into the locking/core branch of tip:
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v5 Latest72 patches 10 repliesApplied
- v468 patches 1 replySuperseded
- v364 patches 14 repliesSuperseded
Earlier versions · 1
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v1 | 63 patches | 28 replies | Superseded |
Changes in v5 from the cover letter
- A few lockdep wait_type fixes in static and runtime initializers. Sebastian noticed while working on getting the lockdep selftests reenabled on RT.
- Missing might_sleep() invocations in RT spin/rwlocks (Sebastian)
- Add explicit owner init for local locks when lockdep is enabled instead of relying on zero initialized memory.
- Add the RT variants for local locks, which is the last lock type getting special treatment on RT.
Patches in v5 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/72 | locking/local_lock: Add missing owner initializationinclude/ | +23 | 0 replies | |
| 2/72 | locking/rtmutex: Set proper wait context for lockdepinclude/ kernel/ | +13 | 0 replies | |
| 3/72 | sched: Split out the wakeup state checkkernel/ | +18 | 0 replies | |
| 4/72 | sched: Introduce TASK_RTLOCK_WAITinclude/ | +3 | 0 replies | |
| 5/72 | sched: Reorganize current::__state helpersinclude/ | +23 | 0 replies | |
| 6/72 | sched: Prepare for RT sleeping spin/rwlocksinclude/ kernel/ | +99 | 0 replies | |
| 7/72 | sched: Rework the __schedule() preempt argumentkernel/ | +23 | 0 replies | |
| 8/72 | sched: Provide schedule point for RT locksinclude/ kernel/ | +22 | 0 replies | |
| 9/72 | sched/wake_q: Provide WAKE_Q_HEAD_INITIALIZERinclude/ | +5 | 0 replies | |
| 10/72 | media/atomisp: Use lockdep instead of *mutex_is_locked()drivers/ | +2 | 0 replies | |
| 11/72 | rtmutex: Remove rt_mutex_is_locked()include/ | +0 | 0 replies | |
| 12/72 | rtmutex: Convert macros to inlineskernel/ | +27 | 0 replies | |
| 13/72 | rtmutex: Switch to try_cmpxchg()kernel/ | +2 | 0 replies | |
| 14/72 | rtmutex: Split API and implementationkernel/ kernel/ kernel/ +1 more | +514 | 0 replies | |
| 15/72 | rtmutex: Split out the inner parts of struct rtmutexinclude/ kernel/ kernel/ +3 more | +97 | 0 replies | |
| 16/72 | locking/rtmutex: Provide rt_mutex_slowlock_locked()kernel/ kernel/ | +59 | 0 replies | |
| 17/72 | rtmutex: Provide rt_mutex_base_is_locked()include/ | +12 | 0 replies | |
| 18/72 | locking: Add base code for RT rw_semaphore and rwlockinclude/ kernel/ | +301 | 1 reply | |
| 19/72 | locking/rwsem: Add rtmutex based R/W semaphore implementationinclude/ kernel/ | +176 | 0 replies | |
| 20/72 | locking/rtmutex: Add wake_state to rt_mutex_waiterkernel/ kernel/ | +10 | 0 replies | |
| 21/72 | locking/rtmutex: Provide rt_wake_q and helperskernel/ kernel/ | +29 | 0 replies | |
| 22/72 | locking/rtmutex: Use rt_mutex_wake_q_headkernel/ kernel/ kernel/ +1 more | +20 | 0 replies | |
| 23/72 | locking/rtmutex: Prepare RT rt_mutex_wake_q for RT locksinclude/ kernel/ kernel/ | +20 | 0 replies | |
| 24/72 | locking/rtmutex: Guard regular sleeping locks specific functionskernel/ kernel/ kernel/ | +133 | 0 replies | |
| 25/72 | locking/spinlock: Split the lock types headerinclude/ include/ include/ +1 more | +74 | 0 replies | |
| 26/72 | locking/rtmutex: Prevent future include recursion hellinclude/ | +1 | 0 replies | |
| 27/72 | locking/lockdep: Reduce includes in debug_locks.hinclude/ | +1 | 0 replies | |
| 28/72 | rbtree: Split out the rbtree type definitionsinclude/ include/ | +35 | 0 replies | |
| 29/72 | locking/rtmutex: Include only rbtree typesinclude/ | +1 | 0 replies | |
| 30/72 | locking/spinlock: Provide RT specific spinlock typeinclude/ | +26 | 0 replies | |
| 31/72 | locking/spinlock: Provide RT variant headerinclude/ include/ include/ | +162 | 0 replies | |
| 32/72 | locking/rtmutex: Provide the spin/rwlock core lock functionkernel/ kernel/ | +61 | 2 replies | |
| 33/72 | locking/spinlock: Provide RT variantkernel/ kernel/ | +130 | 0 replies | |
| 34/72 | locking/rwlock: Provide RT variantinclude/ include/ include/ +4 more | +323 | 2 replies | |
| 35/72 | locking/rtmutex: Squash !RT tasks to DEFAULT_PRIOkernel/ | +20 | 0 replies | |
| 36/72 | locking/mutex: Consolidate core headerskernel/ kernel/ kernel/ +1 more | +25 | 0 replies | |
| 37/72 | locking/mutex: Move waiter to core headerinclude/ kernel/ | +13 | 0 replies | |
| 38/72 | locking/ww_mutex: Move ww_mutex declarations into ww_mutex.hinclude/ include/ | +8 | 0 replies | |
| 39/72 | locking/mutex: Make mutex::wait_lock rawinclude/ kernel/ | +13 | 0 replies | |
| 40/72 | locking/ww_mutex: Simplify lockdep annotationkernel/ | +10 | 0 replies | |
| 41/72 | locking/ww_mutex: Gather mutex_waiter initializationkernel/ kernel/ | +4 | 8 replies | |
| 42/72 | locking/ww_mutex: Split up ww_mutex_unlock()kernel/ | +13 | 0 replies | |
| 43/72 | locking/ww_mutex: Split W/W implementation logickernel/ kernel/ | +370 | 0 replies | |
| 44/72 | locking/ww_mutex: Remove __sched annotationkernel/ | +6 | 0 replies | |
| 45/72 | locking/ww_mutex: Abstract waiter iterationkernel/ | +53 | 0 replies | |
| 46/72 | locking/ww_mutex: Abstract waiter enqueueingkernel/ | +13 | 0 replies | |
| 47/72 | locking/ww_mutex: Abstract mutex accessorskernel/ | +14 | 0 replies | |
| 48/72 | locking/ww_mutex: Abstract mutex typeskernel/ | +13 | 0 replies | |
| 49/72 | locking/ww_mutex: Abstract internal lock accessinclude/ kernel/ | +28 | 0 replies | |
| 50/72 | locking/ww_mutex: Implement rt_mutex accessorskernel/ | +80 | 0 replies | |
| 51/72 | locking/ww_mutex: Add RT priority to W/W orderkernel/ | +49 | 0 replies | |
| 52/72 | locking/ww_mutex: Add rt_mutex based lock type and accessorsinclude/ kernel/ | +27 | 0 replies | |
| 53/72 | locking/rtmutex: Extend the rtmutex core to support ww_mutexkernel/ kernel/ kernel/ +1 more | +114 | 0 replies | |
| 54/72 | locking/ww_mutex: Implement rtmutex based ww_mutex API functionskernel/ kernel/ | +77 | 0 replies | |
| 55/72 | locking/rtmutex: Add mutex variant for RTinclude/ kernel/ kernel/ +1 more | +187 | 0 replies | |
| 56/72 | lib/test_lockup: Adapt to changed variables.lib/ | +4 | 0 replies | |
| 57/72 | futex: Validate waiter correctly in futex_proxy_trylock_atomic()kernel/ | +7 | 0 replies | |
| 58/72 | futex: Cleanup stale commentskernel/ | +7 | 0 replies | |
| 59/72 | futex: Clarify futex_requeue() PI handlingkernel/ | +23 | 0 replies | |
| 60/72 | futex: Remove bogus condition for requeue PIkernel/ | +1 | 0 replies | |
| 61/72 | futex: Correct the number of requeued waiters for PIkernel/ | +4 | 0 replies | |
| 62/72 | futex: Restructure futex_requeue()kernel/ | +41 | 0 replies | |
| 63/72 | futex: Clarify comment in futex_requeue()kernel/ | +20 | 0 replies | |
| 64/72 | futex: Reorder sanity checks in futex_requeue()kernel/ | +7 | 0 replies | |
| 65/72 | futex: Simplify handle_early_requeue_pi_wakeup()kernel/ | +23 | 0 replies | |
| 66/72 | futex: Prevent requeue_pi() lock nesting issue on RTkernel/ | +259 | 0 replies | |
| 67/72 | rtmutex: Prevent lockdep false positive with PI futexeskernel/ | +12 | 0 replies | |
| 68/72 | preempt: Adjust PREEMPT_LOCK_OFFSET for RTinclude/ | +4 | 0 replies | |
| 69/72 | locking/rtmutex: Implement equal priority lock stealingkernel/ | +35 | 0 replies | |
| 70/72 | locking/rtmutex: Add adaptive spinwait mechanismkernel/ | +65 | 0 replies | |
| 71/72 | locking/spinlock/rt: Prepare for RT local_lockinclude/ include/ include/ +1 more | +35 | 0 replies | |
| 72/72 | locking/local_lock: Add PREEMPT_RT supportinclude/ | +48 | 0 replies |
Reviews trailers per patch
None of the 72 patches has a Reviewed-by or Acked-by.
| Patch | Gregory Haskins |
|---|---|
| 1/72 | |
| 2/72 | |
| 3/72 | |
| 4/72 | |
| 5/72 | |
| 6/72 | |
| 7/72 | |
| 8/72 | |
| 9/72 | |
| 10/72 | |
| 11/72 | |
| 12/72 | |
| 13/72 | |
| 14/72 | |
| 15/72 | |
| 16/72 | |
| 17/72 | |
| 18/72 | |
| 19/72 | |
| 20/72 | |
| 21/72 | |
| 22/72 | |
| 23/72 | |
| 24/72 | |
| 25/72 | |
| 26/72 | |
| 27/72 | |
| 28/72 | |
| 29/72 | |
| 30/72 | |
| 31/72 | |
| 32/72 | |
| 33/72 | |
| 34/72 | |
| 35/72 | |
| 36/72 | |
| 37/72 | |
| 38/72 | |
| 39/72 | |
| 40/72 | |
| 41/72 | |
| 42/72 | |
| 43/72 | |
| 44/72 | |
| 45/72 | |
| 46/72 | |
| 47/72 | |
| 48/72 | |
| 49/72 | |
| 50/72 | |
| 51/72 | |
| 52/72 | |
| 53/72 | |
| 54/72 | |
| 55/72 | |
| 56/72 | |
| 57/72 | |
| 58/72 | |
| 59/72 | |
| 60/72 | |
| 61/72 | |
| 62/72 | |
| 63/72 | |
| 64/72 | |
| 65/72 | |
| 66/72 | |
| 67/72 | |
| 68/72 | |
| 69/72 | |
| 70/72 | Originally-by |
| 71/72 | |
| 72/72 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [patch V5 00/72] locking, sched: The PREEMPT-RT locking infrastructure
Folks,
the following series is an update to V4 which can be found here:
https://lore.kernel.org/r/[email protected]
It 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, ww_mutex, rw_semaphore, spinlock, rwlock
semaphores are not substituted because they do not provide strict owner semantics.
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 new rtmutex based ww_mutex implementation.
- 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 internal testing in RT kernels and is part of the upcoming v5.14-rc6-rt9 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
Changes vs. V4
- A few lockdep wait_type fixes in static and runtime initializers. Sebastian noticed while working on getting the lockdep selftests reenabled on RT.
- Missing might_sleep() invocations in RT spin/rwlocks (Sebastian)
- Add explicit owner init for local locks when lockdep is enabled instead of relying on zero initialized memory.
- Add the RT variants for local locks, which is the last lock type getting special treatment on RT.
The lockdep selftest changes are not yet ready and will be posted in a separate submission.
Thanks,
tglx
--- b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 4 b/include/linux/debug_locks.h | 3 b/include/linux/local_lock_internal.h | 90 + b/include/linux/mutex.h | 92 + b/include/linux/preempt.h | 4 b/include/linux/rbtree.h | 30 b/include/linux/rbtree_types.h | 34 b/include/linux/rtmutex.h | 63 - b/include/linux/rwbase_rt.h | 38 b/include/linux/rwlock_rt.h | 140 ++ b/include/linux/rwlock_types.h | 53 b/include/linux/rwsem.h | 78 + b/include/linux/sched.h | 119 +- b/include/linux/sched/wake_q.h | 8 b/include/linux/spinlock.h | 15 b/include/linux/spinlock_api_smp.h | 3 b/include/linux/spinlock_rt.h | 159 ++ b/include/linux/spinlock_types.h | 89 - b/include/linux/spinlock_types_raw.h | 73 + b/include/linux/ww_mutex.h | 50 b/kernel/Kconfig.locks | 2 b/kernel/futex.c | 556 ++++++--- b/kernel/locking/Makefile | 3 b/kernel/locking/mutex-debug.c | 5 b/kernel/locking/mutex.c | 431 ------- b/kernel/locking/mutex.h | 48 b/kernel/locking/rtmutex.c | 1134 +++++++++----------- b/kernel/locking/rtmutex_api.c | 590 ++++++++++ b/kernel/locking/rtmutex_common.h | 122 +- b/kernel/locking/rwbase_rt.c | 263 ++++ b/kernel/locking/rwsem.c | 109 + b/kernel/locking/spinlock.c | 7 b/kernel/locking/spinlock_debug.c | 5 b/kernel/locking/spinlock_rt.c | 263 ++++ b/kernel/locking/ww_mutex.h | 569 ++++++++++ b/kernel/locking/ww_rt_mutex.c | 76 + b/kernel/rcu/tree_plugin.h | 6 b/kernel/sched/core.c | 109 + b/lib/Kconfig.debug | 11 b/lib/test_lockup.c | 8 kernel/locking/mutex-debug.h | 29 41 files changed, 3940 insertions(+), 1551 deletions(-)