1 From 9f95e3260a37233228392a4e1ec4c7738ae9c956 Mon Sep 17 00:00:00 2001
2 From: Thomas Gleixner <tglx@linutronix.de>
3 Date: Fri, 1 Mar 2013 11:17:42 +0100
4 Subject: [PATCH 117/366] futex: Ensure lock/unlock symetry versus pi_lock and
7 In exit_pi_state_list() we have the following locking construct:
10 raw_spin_lock_irq(&curr->pi_lock);
13 spin_unlock(&hb->lock);
15 In !RT this works, but on RT the migrate_enable() function which is
16 called from spin_unlock() sees atomic context due to the held pi_lock
17 and just decrements the migrate_disable_atomic counter of the
18 task. Now the next call to migrate_disable() sees the counter being
19 negative and issues a warning. That check should be in
20 migrate_enable() already.
22 Fix this by dropping pi_lock before unlocking hb->lock and reaquire
23 pi_lock after that again. This is safe as the loop code reevaluates
24 head again under the pi_lock.
26 Reported-by: Yong Zhang <yong.zhang@windriver.com>
27 Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
28 Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
31 1 file changed, 2 insertions(+)
33 diff --git a/kernel/futex.c b/kernel/futex.c
34 index 33ddc99..1ec060b 100644
37 @@ -815,7 +815,9 @@ void exit_pi_state_list(struct task_struct *curr)
38 * task still owns the PI-state:
40 if (head->next != next) {
41 + raw_spin_unlock_irq(&curr->pi_lock);
42 spin_unlock(&hb->lock);
43 + raw_spin_lock_irq(&curr->pi_lock);