diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2013-03-01 11:17:42 +0100 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2015-06-18 18:16:25 -0400 |
commit | 6cbc3ccf417114578045a7ff477d666d65e3df58 (patch) | |
tree | 0598864681a3b28befe49ae91bd4b02f75fe12df /kernel/futex.c | |
parent | e127e26db48b7a259e0bf12f2204f337197cbee9 (diff) | |
download | linux-rt-6cbc3ccf417114578045a7ff477d666d65e3df58.tar.gz |
futex: Ensure lock/unlock symetry versus pi_lock and hash bucket lock
In exit_pi_state_list() we have the following locking construct:
spin_lock(&hb->lock);
raw_spin_lock_irq(&curr->pi_lock);
...
spin_unlock(&hb->lock);
In !RT this works, but on RT the migrate_enable() function which is
called from spin_unlock() sees atomic context due to the held pi_lock
and just decrements the migrate_disable_atomic counter of the
task. Now the next call to migrate_disable() sees the counter being
negative and issues a warning. That check should be in
migrate_enable() already.
Fix this by dropping pi_lock before unlocking hb->lock and reaquire
pi_lock after that again. This is safe as the loop code reevaluates
head again under the pi_lock.
Reported-by: Yong Zhang <yong.zhang@windriver.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/futex.c')
-rw-r--r-- | kernel/futex.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/futex.c b/kernel/futex.c index 636210a780e8..21cbb3a8fdc7 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -738,7 +738,9 @@ void exit_pi_state_list(struct task_struct *curr) * task still owns the PI-state: */ if (head->next != next) { + raw_spin_unlock_irq(&curr->pi_lock); spin_unlock(&hb->lock); + raw_spin_lock_irq(&curr->pi_lock); continue; } |