alistair23-linux/kernel/locking
Thomas Gleixner b4abf91047 rtmutex: Make wait_lock irq safe
Sasha reported a lockdep splat about a potential deadlock between RCU boosting
rtmutex and the posix timer it_lock.

CPU0					CPU1

rtmutex_lock(&rcu->rt_mutex)
  spin_lock(&rcu->rt_mutex.wait_lock)
					local_irq_disable()
					spin_lock(&timer->it_lock)
					spin_lock(&rcu->mutex.wait_lock)
--> Interrupt
    spin_lock(&timer->it_lock)

This is caused by the following code sequence on CPU1

     rcu_read_lock()
     x = lookup();
     if (x)
     	spin_lock_irqsave(&x->it_lock);
     rcu_read_unlock();
     return x;

We could fix that in the posix timer code by keeping rcu read locked across
the spinlocked and irq disabled section, but the above sequence is common and
there is no reason not to support it.

Taking rt_mutex.wait_lock irq safe prevents the deadlock.

Reported-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Paul McKenney <paulmck@linux.vnet.ibm.com>
2016-01-26 11:08:35 +01:00
..
lglock.c sched/stop_machine: Fix deadlock between multiple stop_two_cpus() 2015-06-19 10:03:12 +02:00
lockdep.c treewide: Remove old email address 2015-11-23 09:44:58 +01:00
lockdep_internals.h
lockdep_proc.c treewide: Remove old email address 2015-11-23 09:44:58 +01:00
lockdep_states.h
locktorture.c Merge branches 'doc.2015.10.06a', 'percpu-rwsem.2015.10.06a' and 'torture.2015.10.06a' into HEAD 2015-10-07 16:06:25 -07:00
Makefile Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2015-09-05 20:34:28 -07:00
mcs_spinlock.h locking/mcs: Use acquire/release semantics 2015-10-06 17:28:23 +02:00
mutex-debug.c
mutex-debug.h
mutex.c locking/mutex: Use acquire/release semantics 2015-10-06 17:28:20 +02:00
mutex.h
osq_lock.c locking/osq: Fix ordering of node initialisation in osq_lock 2015-12-17 11:40:29 -08:00
percpu-rwsem.c locking/percpu-rwsem: Clean up the lockdep annotations in percpu_down_read() 2015-10-06 11:25:40 -07:00
qrwlock.c locking/qrwlock: Rename ->lock to ->wait_lock 2015-09-18 09:27:29 +02:00
qspinlock.c locking/pvqspinlock: Queue node adaptive spinning 2015-12-04 11:39:51 +01:00
qspinlock_paravirt.h locking/pvqspinlock: Queue node adaptive spinning 2015-12-04 11:39:51 +01:00
qspinlock_stat.h locking/pvqspinlock: Queue node adaptive spinning 2015-12-04 11:39:51 +01:00
rtmutex-debug.c
rtmutex-debug.h
rtmutex.c rtmutex: Make wait_lock irq safe 2016-01-26 11:08:35 +01:00
rtmutex.h
rtmutex_common.h rtmutex: Delete scriptable tester 2015-07-20 11:45:45 +02:00
rwsem-spinlock.c
rwsem-xadd.c locking/rwsem: Use acquire/release semantics 2015-10-06 17:28:24 +02:00
rwsem.c
rwsem.h
semaphore.c
spinlock.c
spinlock_debug.c