aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2016-11-30 16:04:45 -0500
committerIngo Molnar <mingo@kernel.org>2016-12-02 05:13:57 -0500
commit84d82ec5b9046ecdf16031d3e93a66ef50257402 (patch)
tree716c8ca677edf6cc92677f7a647cdd9bfa641af9
parentb5016e8203003c44264ec88fe2276ff54a51f689 (diff)
locking/rtmutex: Explain locking rules for rt_mutex_proxy_unlock()/init_proxy_locked()
While debugging the unlock vs. dequeue race which resulted in state corruption of futexes the lockless nature of rt_mutex_proxy_unlock() caused some confusion. Add commentry to explain why it is safe to do this lockless. Add matching comments to rt_mutex_init_proxy_locked() for completeness sake. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: David Daney <ddaney@caviumnetworks.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Sebastian Siewior <bigeasy@linutronix.de> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Will Deacon <will.deacon@arm.com> Link: http://lkml.kernel.org/r/20161130210030.591941927@linutronix.de Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--kernel/locking/rtmutex.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c
index 6e6cab7ac12f..2f443ed2320a 100644
--- a/kernel/locking/rtmutex.c
+++ b/kernel/locking/rtmutex.c
@@ -1619,11 +1619,15 @@ EXPORT_SYMBOL_GPL(__rt_mutex_init);
1619 * rt_mutex_init_proxy_locked - initialize and lock a rt_mutex on behalf of a 1619 * rt_mutex_init_proxy_locked - initialize and lock a rt_mutex on behalf of a
1620 * proxy owner 1620 * proxy owner
1621 * 1621 *
1622 * @lock: the rt_mutex to be locked 1622 * @lock: the rt_mutex to be locked
1623 * @proxy_owner:the task to set as owner 1623 * @proxy_owner:the task to set as owner
1624 * 1624 *
1625 * No locking. Caller has to do serializing itself 1625 * No locking. Caller has to do serializing itself
1626 * Special API call for PI-futex support 1626 *
1627 * Special API call for PI-futex support. This initializes the rtmutex and
1628 * assigns it to @proxy_owner. Concurrent operations on the rtmutex are not
1629 * possible at this point because the pi_state which contains the rtmutex
1630 * is not yet visible to other tasks.
1627 */ 1631 */
1628void rt_mutex_init_proxy_locked(struct rt_mutex *lock, 1632void rt_mutex_init_proxy_locked(struct rt_mutex *lock,
1629 struct task_struct *proxy_owner) 1633 struct task_struct *proxy_owner)
@@ -1637,10 +1641,14 @@ void rt_mutex_init_proxy_locked(struct rt_mutex *lock,
1637/** 1641/**
1638 * rt_mutex_proxy_unlock - release a lock on behalf of owner 1642 * rt_mutex_proxy_unlock - release a lock on behalf of owner
1639 * 1643 *
1640 * @lock: the rt_mutex to be locked 1644 * @lock: the rt_mutex to be locked
1641 * 1645 *
1642 * No locking. Caller has to do serializing itself 1646 * No locking. Caller has to do serializing itself
1643 * Special API call for PI-futex support 1647 *
1648 * Special API call for PI-futex support. This merrily cleans up the rtmutex
1649 * (debugging) state. Concurrent operations on this rt_mutex are not
1650 * possible because it belongs to the pi_state which is about to be freed
1651 * and it is not longer visible to other tasks.
1644 */ 1652 */
1645void rt_mutex_proxy_unlock(struct rt_mutex *lock, 1653void rt_mutex_proxy_unlock(struct rt_mutex *lock,
1646 struct task_struct *proxy_owner) 1654 struct task_struct *proxy_owner)