Bug in termios
jennifer at oarcorp.com
jennifer at oarcorp.com
Thu Oct 19 11:48:13 UTC 2006
I have a system with 12 serial port. The driver is configured to be
interrupt driven with one character arrival per interrupt. Furthermore,
I am using 1 task which is set up to poll the serial ports in raw mode at
a 10 ms rate and distribute any data that has arrived. To do this I have
set VMIN and VTIME to 0. The problem occurs on high bandwidth devices
(after they have ran a while), when the device is turned off. Turning off
the device results in the system locking up for several seconds then
recovering. Analysis has shown that the read command is locking the
system during this time. It appears to me that the problem is happening
is that inside of termios.c in the fillBufferQueue routine. While the
device is running there are always characters available so rawInBuff.Head
and rawInBuffTail are never equal. Then ccount is always >= c_cc[VMIN]
which results in wait being set to 0 and the semaphore never being
decremented even thought it being incremented approximately 20 times
during the 10 ms application task poll rate. When the serial device is
turned off and the characters are emptied out of the termios buffer, this
results in a spinlock of obtaining the rawInBufSemaphore several hundred
thousand times.
I have tried several things to balance the semaphore count, but cant
seem to get something that doesnt break some other aspect of termios.
Any suggestions would be appreciated
Thanks
Jennifer
More information about the users
mailing list