public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 000 of 4] Introduction
@ 2006-10-11  6:09 NeilBrown
  2006-10-11  6:09 ` [PATCH 001 of 4] Remove lock_key approach to managing nested bd_mutex locks NeilBrown
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: NeilBrown @ 2006-10-11  6:09 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Ingo Molnar, Peter Zijlstra, Al Viro

Following 4 patches address issues with lockdep, particularly around bd_mutex.

They are against 2.6.18-mm3 and do *not* apply against -linus as -mm already has
some changes to the handling of bd_mutex nesting.  2-4 probably apply on top of -linus plus
-mm/broken-out/remove-the-old-bd_mutex-lockdep-annotation.patch  

I believe they are probably ok for 2.6.19.

The core issue is that blkdev_get when called on a partition needs to
lock (bd_mutex) the partition and the whole device.  lockdep would
normally see this as a possible deadlock and needs to be told that
this particular nesting is known to be safe.

The code to do this is in -linus is rather messy, largely because the
locking itself is messy.  The bd_mutex for the whole is taken several
times while bd_mutex for the partition is held, and it is taken at
both levels of the recursion (blkdev_get calls blkdev_get - only to
one level).

As key observation to simplifying the locking is to observer that a
lot of the locking is there to protect the updating of bd_part_count.
If those updates are moved, the locking can become simpler.

The first patch removes the current approach in -mm to handling this
nesting and explains why it is not ideal.
This reverts new-bd_mutex-lockdep-annotation.patch

The second simplifies the locking as explained above.

The third adds the mutex_lock_nested annotations, which are now trivial.

The last fixes a tangentially related lockdep problem in md - there is
a false relationship between bd_mutex and md->reconfig_mutex which
needs to be clarified.

 [PATCH 000 of 4] Introduction
 [PATCH 001 of 4] Remove lock_key approach to managing nested bd_mutex locks.
 [PATCH 002 of 4] Simplify some aspects of bd_mutex nesting.
 [PATCH 003 of 4] Use mutex_lock_nested for bd_mutex to avoid  lockdep warning.
 [PATCH 004 of 4] Avoid lockdep warning in md.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2006-10-11  9:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-11  6:09 [PATCH 000 of 4] Introduction NeilBrown
2006-10-11  6:09 ` [PATCH 001 of 4] Remove lock_key approach to managing nested bd_mutex locks NeilBrown
2006-10-11  6:09 ` [PATCH 002 of 4] Simplify some aspects of bd_mutex nesting NeilBrown
2006-10-11  6:09 ` [PATCH 003 of 4] Use mutex_lock_nested for bd_mutex to avoid lockdep warning NeilBrown
2006-10-11  6:09 ` [PATCH 004 of 4] Avoid lockdep warning in md NeilBrown
2006-10-11  8:44 ` [PATCH 000 of 4] Introduction Peter Zijlstra
2006-10-11  8:52 ` Ingo Molnar
2006-10-11  9:20   ` Neil Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox