]> git.baikalelectronics.ru Git - kernel.git/commit
n_tty: Make N_TTY ldisc receive path lockless
authorPeter Hurley <peter@hurleysoftware.com>
Sat, 15 Jun 2013 13:14:26 +0000 (09:14 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 23 Jul 2013 23:43:01 +0000 (16:43 -0700)
commit4e6391fdf215a767102cbbe665cdef7651e2d73f
tree4509766b324cb056a75899db674add20c5efc9ff
parent58c15e4a55947d1784f05e6a2cc5e4aa9d26000b
n_tty: Make N_TTY ldisc receive path lockless

n_tty has a single-producer/single-consumer input model;
use lockless publish instead.

Use termios_rwsem to exclude both consumer and producer while
changing or resetting buffer indices, eg., when flushing. Also,
claim exclusive termios_rwsem to safely retrieve the buffer
indices from a thread other than consumer or producer
(eg., TIOCINQ ioctl).

Note the read_tail is published _after_ clearing the newline
indicator in read_flags to avoid racing the producer.

Drop read_lock spinlock.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/n_tty.c