lkml.org 
[lkml]   [2009]   [Dec]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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


\
 
 \ /
  Last update: 2009-12-13 02:19    [W:0.163 / U:0.424 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site