Skip to contentSkip to conversation

tty : make receive_room internal to N_TTY line discipline

RFC PATCH In review matthieu castet 2 participants 2 messages Mar 4, 2012 – Mar 5, 2012 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

cover tty : make receive_room internal to N_TTY line discipline

These patches try to solve issue exposed on
https://lkml.org/lkml/2011/6/7/700

On Tue, Jun 07, 2011 at 07:44:48PM -0700, Linus Torvalds wrote

Quoted 5 lines

I'd love to get rid of receive_room entirely - and just letting the tty line discipline handler say how much it actually received. in other words, having receive_buf() just tell us how much it used, and not looking at receive_room in the caller is absolutely the right thing.

GIT: [PATCH 1/9] tty: make receive_buf() return the amout of bytes
GIT: [PATCH 2/9] tty : make n_tty_receive_buf return bytes received in
GIT: [PATCH 3/9] tty: make hci_uart_tty_receive return bytes received
GIT: [PATCH 4/9] tty : kill receive_room usage in vt
GIT: [PATCH 5/9] tty : kill receive_room usage in speakup
GIT: [PATCH 6/9] tty : don't use receive_room in tty_set_ldisc
GIT: [PATCH 7/9] tty : kill receive_room usage in tty_buffer
GIT: [PATCH 8/9] tty : kill receive_room usage in mxser
GIT: [PATCH 9/9] tty : make receive_room internal to N_TTY line

#1 lore raw

I had a bigger dig into this and I think the path to make it workable is probably

- Finish getting rid of the tty_lock (ie the last remnants of the BKL)

- At that point we can rework the logic in tty_ldisc a bit and you can then hold tty->ldisc_mutex across the entire ldisc_receive. That will be a natural sane way to lock the ldisc.

- Once that is in place it is possible to fix TIOCSTI and selection using that mutex to single thread.

- Which then lets you fix the receive_room logic because its all running under a sensible locking model.

I don't see any shortcuts here.

Alan