Messages in this thread | | | Date | Wed, 28 Mar 2012 12:06:38 +0100 | From | Alan Cox <> | Subject | Re: TTY: tty_port questions |
| |
> * TTY layer allocates tty on demand (open() time) and feeds them > to ->install(), which is where we associate the suckers with tty_port, > grabbing a reference to the latter and shoving it into ->driver_data (OK, > it or that to struct it's embedded into - all the same)
Yep - actually we want to get a tty->port pointer so we can clean up some of the indirection and allow the core code to get at the port directly
> * ->open()/->close()/->hungup() simply call tty_port_...() > [BTW, is there any reason why you do not set ->driver_data to port and > use container_of() in the places that want other parts of containing
See aboe comment.. that's also the way I've been thinking.
> * removal does tty_unregister_device() + prevents ->install() from > finding it + (under port->mutex) does tty_hangup() on associated tty (if any). > BTW, I really don't like the look of that place - tty_hangup() is async > (otherwise it'd deadlock instantly), so what the devil is protecting tty > from being freed before __tty_hangup() is done with it? And when should
Nothing. However the locking is unfixable in this area until we've removed the big tty mutex. It's a known problem. I've killed the big tty mutex in the console layer this -next so we are inching in the right direction. Once the BTM has gone we can actually fix the unplug race.
> * ->activate() plays strange games with TTY_IO_ERROR; why do we > bother, seeing that it's under port->mutex and anybody trying to open the > same tty will wait anyway?
The historic code used to do this and some of our drivers are not fully converted over so still expect that pattern of behaviour in a few spots.
Alan
| |