Subject: Re: TTY locking
To: <>
From: David Laight <david@l8s.co.uk>
List: tech-smp
Date: 02/17/2003 10:23:41
On Mon, Feb 17, 2003 at 08:57:53AM +0100, Paul Kranenburg wrote:
> The TTY subsystem locking strategy has some issues left. One of them
> is that tputchar() can be called with or without the tty spin lock
> held: i.e.
> 
> 	[tu]printf()->kprintf()->tputchar()
> vs.
> 
> 	ttyinfo()->ttyprintf()->kprintf()->tputchar()
> 
> I put a simple_lock_try() in tputchar() to circumvent to problem, but
> that's not correct, and LOCKDEBUG catches it.

That code is just plain broken...

> Looking at the places from where ttyinfo() is called it seems Ok to just
> release the tty spin lock while the load and session stuff is printed,
> and then re-acquire it again before returning.
> 
> Comments?

You need to convince yourself (and others) that ttyinfo() doesn't
neet the TTY_LOCK held.  At the moment that isn't true [1].
(there is also the separate fact that is need the p_pglist list
locked - or better some stuff with reference counts...)

ATM the big_lock probably saves you.

	David

[1] can you spot it?

-- 
David Laight: david@l8s.co.uk