Re: [PATCH] lockdep: lock_set_subclass - reset a held lock's subclass

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linus Torvalds
Date: Friday, August 1, 2008 - 4:26 pm

On Fri, 1 Aug 2008, David Miller wrote:

It's not always wrong.

If you can guarantee that anybody that takes more than one lock of a 
particular class will always take a single top-level lock _first_, then 
that's all good. You can obviously screw up and take the same lock _twice_ 
(which will deadlock), but at least you cannot get into ABBA situations.

So maybe the right thing to do is to just teach lockdep about "lock 
protection locks". That would have solved the multi-queue issues for 
networking too - all the actual network drivers would still have taken 
just their single queue lock, but the one case that needs to take all of 
them would have taken a separate top-level lock first.

Never mind that the multi-queue locks were always taken in the same order: 
it's never wrong to just have some top-level serialization, and anybody 
who needs to take <n> locks might as well do <n+1>, because they sure as 
hell aren't going to be on _any_ fastpaths.

So the simplest solution really sounds like just teaching lockdep about 
that one special case. It's not "nesting" exactly, although it's obviously 
related to it.

			Linus
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[git pull] scheduler fixes, Ingo Molnar, (Thu Jul 31, 2:43 pm)
Re: [git pull] scheduler fixes, David Miller, (Thu Jul 31, 3:04 pm)
Re: [git pull] scheduler fixes, Ingo Molnar, (Thu Jul 31, 3:26 pm)
Re: [git pull] scheduler fixes, David Miller, (Thu Jul 31, 3:55 pm)
Re: [git pull] scheduler fixes, David Miller, (Fri Aug 1, 1:11 am)
Re: [git pull] scheduler fixes, Ingo Molnar, (Fri Aug 1, 2:01 am)
Re: [git pull] scheduler fixes, David Miller, (Fri Aug 1, 2:13 am)
[PATCH] lockdep: re-annotate scheduler runqueues, Peter Zijlstra, (Fri Aug 1, 4:08 am)
Re: [PATCH] lockdep: re-annotate scheduler runqueues, Linus Torvalds, (Fri Aug 1, 10:04 am)
Re: [PATCH] lockdep: lock_set_subclass - reset a held lock ..., Jeremy Fitzhardinge, (Fri Aug 1, 11:06 am)
Re: [PATCH] lockdep: lock_set_subclass - reset a held lock ..., Jeremy Fitzhardinge, (Fri Aug 1, 12:10 pm)
Re: [PATCH] lockdep: lock_set_subclass - reset a held lock ..., Jeremy Fitzhardinge, (Fri Aug 1, 1:08 pm)
Re: [PATCH] lockdep: lock_set_subclass - reset a held lock ..., Jeremy Fitzhardinge, (Fri Aug 1, 1:22 pm)
Re: [PATCH] lockdep: lock_set_subclass - reset a held lock ..., Linus Torvalds, (Fri Aug 1, 4:26 pm)
Re: [PATCH] lockdep: re-annotate scheduler runqueues, David Miller, (Sat Aug 2, 1:34 am)