OSDN Git Service

serial/aspeed-vuart: Implement quick throttle mechanism
authorJeremy Kerr <jk@ozlabs.org>
Tue, 27 Mar 2018 03:48:27 +0000 (11:48 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 23 Apr 2018 08:16:50 +0000 (10:16 +0200)
commit5909c0bf9c7a17c52cf357bf5e752a76b8d72568
tree3ccbc3fa01f81d6d08d55eee2a6cb578fefcd24c
parent989983ea849d9421e8b9cd11f18e072fe00ea0d7
serial/aspeed-vuart: Implement quick throttle mechanism

Although we populate the ->throttle and ->unthrottle UART operations,
these may not be called until the ldisc has had a chance to schedule and
check buffer space. This means that we may overflow the flip buffers
without ever hitting the ldisc's throttle threshold.

This change implements an interrupt-based throttle, where we check for
space in the flip buffers before reading characters from the UART's
FIFO. If there's no space available, we disable the RX interrupt and
schedule a timer to check for space later.

For this, we need an unlocked version of the set_throttle function to be
able to change throttle state from the irq_handler, which already holds
port->lock.

This prevents a case where we drop characters under heavy RX load.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Tested-by: Eddie James <eajames@linux.vnet.ibm.com>
Tested-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250_aspeed_vuart.c