diff options
author | Stefan Agner <stefan.agner@toradex.com> | 2014-03-19 18:14:39 +0100 |
---|---|---|
committer | Stefan Agner <stefan@agner.ch> | 2014-05-15 13:14:15 +0200 |
commit | 20960df29ae1d5f0e853e6433babd89caf938ad8 (patch) | |
tree | 74d5b39842509a447bbca22ff60875481b6d6d3d | |
parent | 9d9594580ea77eb2fe7537e2b7e3f3abfc684db2 (diff) |
serial: mvf: don't use work queue to receive data
In low latency mode, tty_flip_buffer_push should be called from
interrupt context. However, because flush_to_ldisc is not safe
to call from interrupt, the user get a kernel message "BUG:
scheduling while atomic". This is actually a kernel bug, which
essentially breaks low latency.
Using a work queue works around this, however, it also makes
the low latency mode useless. In non-low latency mode, the
tty code uses a work queue too.
So, don't use our own work queue to work around a kernel bug.
Instead rely on work queue implementation in the tty code,
disable the UPF_LOW_LATENCY feature and hope the low latency
bug itself gets fixed eventually.
This is also the way the proposed upstream driver works.
-rw-r--r-- | drivers/tty/serial/mvf.c | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/drivers/tty/serial/mvf.c b/drivers/tty/serial/mvf.c index 1bf9a474aa46..e539e46b59cb 100644 --- a/drivers/tty/serial/mvf.c +++ b/drivers/tty/serial/mvf.c @@ -97,7 +97,7 @@ struct imx_port { void *rx_buf; unsigned char *tx_buf; unsigned int rx_bytes, tx_bytes; - struct work_struct tsk_rx, tsk_dma_tx; + struct work_struct tsk_dma_tx; unsigned int dma_tx_nents; bool dma_is_rxing, dma_is_txing; wait_queue_head_t dma_wait; @@ -368,18 +368,6 @@ out: return IRQ_HANDLED; } -static void rx_work(struct work_struct *w) -{ - struct imx_port *sport = container_of(w, struct imx_port, tsk_rx); - struct tty_struct *tty = sport->port.state->port.tty; - - /* check if tty is valid, since the process might be gone... */ - if (sport->rx_bytes && tty) { - tty_flip_buffer_push(tty); - sport->rx_bytes = 0; - } -} - static irqreturn_t imx_rxint(int irq, void *dev_id) { struct imx_port *sport = dev_id; @@ -447,8 +435,7 @@ static irqreturn_t imx_rxint(int irq, void *dev_id) out: spin_unlock_irqrestore(&sport->port.lock, flags); - //TODO: Check tsk_rx, seems to be edma related. - schedule_work(&sport->tsk_rx); + tty_flip_buffer_push(tty); return IRQ_HANDLED; } @@ -618,9 +605,7 @@ static int imx_startup(struct uart_port *port) temp |= MXC_UARTCR5_TDMAS; writeb(temp, sport->port.membase + MXC_UARTCR5); - sport->port.flags |= UPF_LOW_LATENCY; INIT_WORK(&sport->tsk_dma_tx, dma_tx_work); - INIT_WORK(&sport->tsk_rx, rx_work); init_waitqueue_head(&sport->dma_wait); } |