Messages in this thread | | | Date | Sat, 12 Dec 2009 09:26:11 -0800 (PST) | From | Linus Torvalds <> | Subject | Re: [GIT PATCH] TTY patches for 2.6.33-git |
| |
On Sat, 12 Dec 2009, Linus Torvalds wrote: > > > > I'm surprised that lockdep didn't notice that ab/ba I thought I saw. > > Maybe the do_tty_hangup()->tty_fasync() never happens. > > The kernel lock cannot have any ABBA deadlocks. > > If somebody blocks on another lock (after getting the kernel lock), the > kernel lock will be dropped. So no ABBA.
Oh, but it turns out that while there cannot be any ABBA deadlocks with sleeping locks, what the tty code does is invalid for _another_ reason: file_list_lock() is a spinlock. And that's a no-no.
You cannot take the kernel lock inside a spinlock. Ordering doesn't matter, there's no ABBA issues - it's simply invalid _regardless_ of any other use of that lock.
I think we could possibly add a "__might_sleep()" to _lock_kernel(). It doesn't really sleep, but it's invalid to take the kernel lock in an atomic region, so __might_sleep() might be the right thing anyway.
Linus
| |