• Peter Zijlstra's avatar
    lockdep: Introduce wait-type checks · de8f5e4f
    Peter Zijlstra authored
    Extend lockdep to validate lock wait-type context.
    
    The current wait-types are:
    
    	LD_WAIT_FREE,		/* wait free, rcu etc.. */
    	LD_WAIT_SPIN,		/* spin loops, raw_spinlock_t etc.. */
    	LD_WAIT_CONFIG,		/* CONFIG_PREEMPT_LOCK, spinlock_t etc.. */
    	LD_WAIT_SLEEP,		/* sleeping locks, mutex_t etc.. */
    
    Where lockdep validates that the current lock (the one being acquired)
    fits in the current wait-context (as generated by the held stack).
    
    This ensures that there is no attempt to acquire mutexes while holding
    spinlocks, to acquire spinlocks while holding raw_spinlocks and so on. In
    other words, its a more fancy might_sleep().
    
    Obviously RCU made the entire ordeal more complex than a simple single
    value test because RCU can be acquired in (pretty much) any context and
    while it presents a context to nested locks it is not the same as it
    got acquired in.
    
    Therefore its necessary to split the wait_type into two values, one
    representing the acquire (outer) and one representing the nes...
    de8f5e4f
rwsem.c 47 KB