diff options
author | Oleg Nesterov <[email protected]> | 2014-01-20 19:20:10 +0100 |
---|---|---|
committer | Ingo Molnar <[email protected]> | 2014-02-09 21:18:57 +0100 |
commit | 1b5ff816cab708ba44c7d7b56b613516269eb577 (patch) | |
tree | 999f1b9973ba0fe76ee3003124f7ac522873a08b /include/linux/fpga/fpga-mgr.h | |
parent | fb9edbe98493fcd9df66de926ae9157cbe0e4dcd (diff) |
lockdep: Don't create the wrong dependency on hlock->check == 0
Test-case:
DEFINE_MUTEX(m1);
DEFINE_MUTEX(m2);
DEFINE_MUTEX(mx);
void lockdep_should_complain(void)
{
lockdep_set_novalidate_class(&mx);
// m1 -> mx -> m2
mutex_lock(&m1);
mutex_lock(&mx);
mutex_lock(&m2);
mutex_unlock(&m2);
mutex_unlock(&mx);
mutex_unlock(&m1);
// m2 -> m1 ; should trigger the warning
mutex_lock(&m2);
mutex_lock(&m1);
mutex_unlock(&m1);
mutex_unlock(&m2);
}
this doesn't trigger any warning, lockdep can't detect the trivial
deadlock.
This is because lock(&mx) correctly avoids m1 -> mx dependency, it
skips validate_chain() due to mx->check == 0. But lock(&m2) wrongly
adds mx -> m2 and thus m1 -> m2 is not created.
rcu_lock_acquire()->lock_acquire(check => 0) is fine due to read == 2,
so currently only __lockdep_no_validate__ can trigger this problem.
Signed-off-by: Oleg Nesterov <[email protected]>
Cc: Dave Jones <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Paul McKenney <[email protected]>
Cc: Steven Rostedt <[email protected]>
Cc: Alan Stern <[email protected]>
Cc: Sasha Levin <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
Diffstat (limited to 'include/linux/fpga/fpga-mgr.h')
0 files changed, 0 insertions, 0 deletions