Re: lockdep problem conversion semaphore->mutex (dev->sem)

2007-12-08 Thread Jarek Poplawski
Peter Zijlstra wrote, On 12/08/2007 09:50 PM: > On Sat, 2007-12-08 at 21:33 +0100, Remy Bohmer wrote: > >> Which problems? I did not see any special things, it looked rather >> straight forward. What have I overlooked? > > On suspend it locks the whole device tree, this means it has 'unbounded'

Re: lockdep problem conversion semaphore->mutex (dev->sem)

2007-12-08 Thread Remy Bohmer
Peter, Thanks for this clear answer. Remy 2007/12/8, Peter Zijlstra <[EMAIL PROTECTED]>: > > On Sat, 2007-12-08 at 21:33 +0100, Remy Bohmer wrote: > > > Which problems? I did not see any special things, it looked rather > > straight forward. What have I overlooked? > > On suspend it locks the

Re: lockdep problem conversion semaphore->mutex (dev->sem)

2007-12-08 Thread Peter Zijlstra
On Sat, 2007-12-08 at 21:33 +0100, Remy Bohmer wrote: > Which problems? I did not see any special things, it looked rather > straight forward. What have I overlooked? On suspend it locks the whole device tree, this means it has 'unbounded' nesting and holds an 'unbounded' number of locks.

Re: lockdep problem conversion semaphore->mutex (dev->sem)

2007-12-08 Thread Remy Bohmer
Hello Ingo, > no, you are wrong. If you want to do complex locking, you can still do > it: take a look at the dev->sem conversion patches from Peter which > correctly do this. Lockdep has all the facilities for that. > (you just dont know about them) Ok. > the general policy message here is: do

Re: lockdep problem conversion semaphore->mutex (dev->sem)

2007-12-08 Thread Remy Bohmer
Hello Peter, > And while you might not see it in-tree anymore, lockdep does help out > tremendously while developing new code. I'm sure that without it the > locking would be in a much worse state than it is today. I am not arguing that, I am also convinced it has done a good job. > I have a

Re: lockdep problem conversion semaphore->mutex (dev->sem)

2007-12-08 Thread Ingo Molnar
* Remy Bohmer <[EMAIL PROTECTED]> wrote: > But... now we do not transfer the dev->sem to a mutex, because lockdep > will start generating false positives, and thus we mask the lockdep > error, by not converting the dev->sem to what it really is... no, you are wrong. If you want to do complex

Re: lockdep problem conversion semaphore->mutex (dev->sem)

2007-12-08 Thread Peter Zijlstra
On Sat, 2007-12-08 at 20:52 +0100, Remy Bohmer wrote: > Hello Peter and Daniel, > > > Yeah, it are different lock instances, however by virtue of sharing the > > same lock init site, they belong to the same lock class. Lockdep works > > by tracking class dependancies, not instance dependancies.

Re: lockdep problem conversion semaphore->mutex (dev->sem)

2007-12-08 Thread Remy Bohmer
Hello Peter and Daniel, > Yeah, it are different lock instances, however by virtue of sharing the > same lock init site, they belong to the same lock class. Lockdep works > by tracking class dependancies, not instance dependancies. The device and its parent both indeed have different

Re: lockdep problem conversion semaphore->mutex (dev->sem)

2007-12-08 Thread Peter Zijlstra
On Sat, 2007-12-08 at 08:53 -0800, Daniel Walker wrote: > On Sat, 2007-12-08 at 13:16 +0100, Peter Zijlstra wrote: > > On Sat, 2007-12-08 at 00:02 +0100, Remy Bohmer wrote: > > > Hello Peter, > > > > > > > > What specifically is wrong with dev->sem ? > > > > > > > > Nothing really, other than

Re: lockdep problem conversion semaphore->mutex (dev->sem)

2007-12-08 Thread Peter Zijlstra
On Sat, 2007-12-08 at 09:06 -0800, Daniel Walker wrote: > On Sat, 2007-12-08 at 18:11 +0100, Peter Zijlstra wrote: > > > > It must be the locking in __driver_attach(), taking dev->parent->sem > > > then taking dev->sem .. Assuming those are different structures, why > > > does lockdep trigger? >

Re: lockdep problem conversion semaphore->mutex (dev->sem)

2007-12-08 Thread Daniel Walker
On Sat, 2007-12-08 at 18:11 +0100, Peter Zijlstra wrote: > > It must be the locking in __driver_attach(), taking dev->parent->sem > > then taking dev->sem .. Assuming those are different structures, why > > does lockdep trigger? > > They aren't different, parent is a struct device again. It's

Re: lockdep problem conversion semaphore->mutex (dev->sem)

2007-12-08 Thread Daniel Walker
On Sat, 2007-12-08 at 13:16 +0100, Peter Zijlstra wrote: > On Sat, 2007-12-08 at 00:02 +0100, Remy Bohmer wrote: > > Hello Peter, > > > > > > What specifically is wrong with dev->sem ? > > > > > > Nothing really, other than that they use semaphores to avoid lockdep :-/ > > > > > > I think I know

Re: lockdep problem conversion semaphore->mutex (dev->sem)

2007-12-08 Thread Peter Zijlstra
On Sat, 2007-12-08 at 00:02 +0100, Remy Bohmer wrote: > Hello Peter, > > > > What specifically is wrong with dev->sem ? > > > > Nothing really, other than that they use semaphores to avoid lockdep :-/ > > > > I think I know how to annotate this, after Alan Stern explained all the > > use cases,

Re: lockdep problem conversion semaphore-mutex (dev-sem)

2007-12-08 Thread Peter Zijlstra
On Sat, 2007-12-08 at 00:02 +0100, Remy Bohmer wrote: Hello Peter, What specifically is wrong with dev-sem ? Nothing really, other than that they use semaphores to avoid lockdep :-/ I think I know how to annotate this, after Alan Stern explained all the use cases, but I haven't

Re: lockdep problem conversion semaphore-mutex (dev-sem)

2007-12-08 Thread Daniel Walker
On Sat, 2007-12-08 at 13:16 +0100, Peter Zijlstra wrote: On Sat, 2007-12-08 at 00:02 +0100, Remy Bohmer wrote: Hello Peter, What specifically is wrong with dev-sem ? Nothing really, other than that they use semaphores to avoid lockdep :-/ I think I know how to annotate this,

Re: lockdep problem conversion semaphore-mutex (dev-sem)

2007-12-08 Thread Daniel Walker
On Sat, 2007-12-08 at 18:11 +0100, Peter Zijlstra wrote: It must be the locking in __driver_attach(), taking dev-parent-sem then taking dev-sem .. Assuming those are different structures, why does lockdep trigger? They aren't different, parent is a struct device again. It's different

Re: lockdep problem conversion semaphore-mutex (dev-sem)

2007-12-08 Thread Peter Zijlstra
On Sat, 2007-12-08 at 09:06 -0800, Daniel Walker wrote: On Sat, 2007-12-08 at 18:11 +0100, Peter Zijlstra wrote: It must be the locking in __driver_attach(), taking dev-parent-sem then taking dev-sem .. Assuming those are different structures, why does lockdep trigger? They

Re: lockdep problem conversion semaphore-mutex (dev-sem)

2007-12-08 Thread Peter Zijlstra
On Sat, 2007-12-08 at 08:53 -0800, Daniel Walker wrote: On Sat, 2007-12-08 at 13:16 +0100, Peter Zijlstra wrote: On Sat, 2007-12-08 at 00:02 +0100, Remy Bohmer wrote: Hello Peter, What specifically is wrong with dev-sem ? Nothing really, other than that they use semaphores

Re: lockdep problem conversion semaphore-mutex (dev-sem)

2007-12-08 Thread Remy Bohmer
Hello Peter and Daniel, Yeah, it are different lock instances, however by virtue of sharing the same lock init site, they belong to the same lock class. Lockdep works by tracking class dependancies, not instance dependancies. The device and its parent both indeed have different

Re: lockdep problem conversion semaphore-mutex (dev-sem)

2007-12-08 Thread Peter Zijlstra
On Sat, 2007-12-08 at 20:52 +0100, Remy Bohmer wrote: Hello Peter and Daniel, Yeah, it are different lock instances, however by virtue of sharing the same lock init site, they belong to the same lock class. Lockdep works by tracking class dependancies, not instance dependancies. The

Re: lockdep problem conversion semaphore-mutex (dev-sem)

2007-12-08 Thread Ingo Molnar
* Remy Bohmer [EMAIL PROTECTED] wrote: But... now we do not transfer the dev-sem to a mutex, because lockdep will start generating false positives, and thus we mask the lockdep error, by not converting the dev-sem to what it really is... no, you are wrong. If you want to do complex

Re: lockdep problem conversion semaphore-mutex (dev-sem)

2007-12-08 Thread Remy Bohmer
Hello Peter, And while you might not see it in-tree anymore, lockdep does help out tremendously while developing new code. I'm sure that without it the locking would be in a much worse state than it is today. I am not arguing that, I am also convinced it has done a good job. I have a good

Re: lockdep problem conversion semaphore-mutex (dev-sem)

2007-12-08 Thread Remy Bohmer
Hello Ingo, no, you are wrong. If you want to do complex locking, you can still do it: take a look at the dev-sem conversion patches from Peter which correctly do this. Lockdep has all the facilities for that. (you just dont know about them) Ok. the general policy message here is: do not

Re: lockdep problem conversion semaphore-mutex (dev-sem)

2007-12-08 Thread Peter Zijlstra
On Sat, 2007-12-08 at 21:33 +0100, Remy Bohmer wrote: Which problems? I did not see any special things, it looked rather straight forward. What have I overlooked? On suspend it locks the whole device tree, this means it has 'unbounded' nesting and holds an 'unbounded' number of locks. Neither

Re: lockdep problem conversion semaphore-mutex (dev-sem)

2007-12-08 Thread Remy Bohmer
Peter, Thanks for this clear answer. Remy 2007/12/8, Peter Zijlstra [EMAIL PROTECTED]: On Sat, 2007-12-08 at 21:33 +0100, Remy Bohmer wrote: Which problems? I did not see any special things, it looked rather straight forward. What have I overlooked? On suspend it locks the whole device

Re: lockdep problem conversion semaphore-mutex (dev-sem)

2007-12-08 Thread Jarek Poplawski
Peter Zijlstra wrote, On 12/08/2007 09:50 PM: On Sat, 2007-12-08 at 21:33 +0100, Remy Bohmer wrote: Which problems? I did not see any special things, it looked rather straight forward. What have I overlooked? On suspend it locks the whole device tree, this means it has 'unbounded'

lockdep problem conversion semaphore->mutex (dev->sem)

2007-12-07 Thread Remy Bohmer
Hello Peter, > > What specifically is wrong with dev->sem ? > > Nothing really, other than that they use semaphores to avoid lockdep :-/ > > I think I know how to annotate this, after Alan Stern explained all the > use cases, but I haven't come around to implementing it. Hope to do that >

lockdep problem conversion semaphore-mutex (dev-sem)

2007-12-07 Thread Remy Bohmer
Hello Peter, What specifically is wrong with dev-sem ? Nothing really, other than that they use semaphores to avoid lockdep :-/ I think I know how to annotate this, after Alan Stern explained all the use cases, but I haven't come around to implementing it. Hope to do that soonish. I was