serial_core: non-asynchronous start_tx() issues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I'm adapting the sc16is7xx.c driver (written for serial_core) for use
with SPI, plus some bug fixes along the way.  I'm experiencing
timed-out hangs. The following description is brief but should be easy
to understand. Let me know if I've missed out on details.

Since start_tx() must not sleep, sc16is7xx:start_tx() calls
schedule_work() on a worker process which calls its internal
start_tx(). Usually, the call chain looks like this for writing data:

sc16is7xx (0): startup()
sc16is7xx (0): set_termios()
sc:uw <-- serial_core:uart_write()
sc:_us <-- serial_core:__uart_start()
sched
sc16is7xx (): -> TX
sc:ufc <-- serial_core:uart_flush_chars()
sc:_us <-- serial_core:__uart_start()
sched
sc16is7xx (): <- TX
sc16is7xx (): -> TX
sc16is7xx (): <- TX
sc16is7xx (0): tx_empty()
sc16is7xx (0): stop_rx
sc16is7xx (0): tx_empty()
sc16is7xx (0): shutdown()

But occasionally, it looks like this:

sc16is7xx (0): startup()
sc16is7xx (0): set_termios()
sc:uw
sc:_us
sched
sc:ufc
sc:_us
sc16is7xx (0): NOT sched TX <-- since already pending
sc16is7xx (): -> TX
sc16is7xx (): TX -> 64
sc16is7xx (): <- TX

nothing happens for about a minute...

sc16is7xx (0): tx_empty()
sc16is7xx (0): stop_rx
sc16is7xx (0): tx_empty()
sc16is7xx (0): shutdown()

The reason, as far as I can tell, is that both
tty_operations::flush_chars() and tty_operations::uart_write() are
mapped to __uart_write() which calls driver:start_tx(), and both
expect the operations to be synchronous. But alas, I cannot do that,
so add SMP to the mix and  uart_flush_chars() never starts, and
something in the tty layer times out.

What would be the simplest/best solution to this problem, short of
rewrtiing the driver to use th etty layer?  I have a hack in place
(set a flag in start_tx() if work already q'd and check it in
handle_tx() to run the code again), but I'd like a better solution.

Thanks in advance,
Mikael Jansson
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux