Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1533575
| From | Thomas Gleixner <tglx@linutronix.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [patch 4/4] rtmutex: Explain locking rules for rt_mutex_proxy_unlock()/init_proxy_locked() |
| Date | 2016-11-30 22:10 +0100 |
| Message-ID | <sJkiB-2NQ-25@gated-at.bofh.it> (permalink) |
| References | <sJkiB-2NQ-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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> --- kernel/locking/rtmutex.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) --- a/kernel/locking/rtmutex.c +++ b/kernel/locking/rtmutex.c @@ -1617,11 +1617,15 @@ EXPORT_SYMBOL_GPL(__rt_mutex_init); * rt_mutex_init_proxy_locked - initialize and lock a rt_mutex on behalf of a * proxy owner * - * @lock: the rt_mutex to be locked + * @lock: the rt_mutex to be locked * @proxy_owner:the task to set as owner * * No locking. Caller has to do serializing itself - * Special API call for PI-futex support + * + * Special API call for PI-futex support. This initializes the rtmutex and + * assigns it to @proxy_owner. Concurrent operations on the rtmutex are not + * possible at this point because the pi_state which contains the rtmutex + * is not yet visible to other tasks. */ void rt_mutex_init_proxy_locked(struct rt_mutex *lock, struct task_struct *proxy_owner) @@ -1635,10 +1639,14 @@ void rt_mutex_init_proxy_locked(struct r /** * rt_mutex_proxy_unlock - release a lock on behalf of owner * - * @lock: the rt_mutex to be locked + * @lock: the rt_mutex to be locked * * No locking. Caller has to do serializing itself - * Special API call for PI-futex support + * + * Special API call for PI-futex support. This merily cleans up the rtmutex + * (debugging) state. Concurrent operations on this rt_mutex are not + * possible because it belongs to the pi_state which is about to be freed + * and it is not longer visible to other tasks. */ void rt_mutex_proxy_unlock(struct rt_mutex *lock, struct task_struct *proxy_owner)
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[patch 0/4] rtmutex: Plug unlock vs. requeue race Thomas Gleixner <tglx@linutronix.de> - 2016-11-30 22:10 +0100
[patch 4/4] rtmutex: Explain locking rules for rt_mutex_proxy_unlock()/init_proxy_locked() Thomas Gleixner <tglx@linutronix.de> - 2016-11-30 22:10 +0100
[tip:locking/core] locking/rtmutex: Explain locking rules for rt_mutex_proxy_unlock()/init_proxy_locked() tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2016-12-02 12:20 +0100
[patch 2/4] rtmutex: Use READ_ONCE() in rt_mutex_owner() Thomas Gleixner <tglx@linutronix.de> - 2016-11-30 22:10 +0100
[tip:locking/core] locking/rtmutex: Use READ_ONCE() in rt_mutex_owner() tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2016-12-02 11:50 +0100
Re: [patch 0/4] rtmutex: Plug unlock vs. requeue race Peter Zijlstra <peterz@infradead.org> - 2016-12-01 19:40 +0100
csiph-web