On Sat, May 04, 2013 at 07:39:57AM -0400, Peter Hurley wrote: > On 05/04/2013 07:15 AM, Johan Hovold wrote: > > On Sat, May 04, 2013 at 01:50:42AM +0400, Stas Sergeev wrote: > >> 04.05.2013 00:34, Greg KH пишет: > >>> On Fri, May 03, 2013 at 10:27:18PM +0400, Stas Sergeev wrote: > >>>> 03.05.2013 21:16, Greg KH пишет: [...] > > But you do have a point, and I have been meaning to look into whether > > the added overhead of checking the hardware buffers could be mitigated > > by adding wait_until_sent support to usb-serial. This way the we would > > only query the hardware buffers on tty_wait_until_sent (e.g. at close) > > and select and TIOCMOUTQ would not suffer. This is also the way things > > are handled in serial_core. > > Agreed. This is the correct solution. > > > I'll prepare a series which adds wait_until_sent to usb-serial, but I > > doubt it would be stable material (even if it could get into 3.10). > > > > What do you think Greg, is this overhead to chars_in_buffer reason > > enough to disable it in the stable trees or should we simply fix it in > > 3.11 (or 3.10)? (The overhead is about 3-400 us per call when the port > > fifo is empty, which makes chars_in_buffer about 100 times slower on my > > test system.) > > A better solution for stable would be to set port->drain_delay. It > won't help tcdrain() but at least the port won't shutdown on live > outbound data. Removing the hardware-buffer checks from chars_in_buffer would mean breaking tty_wait_until_sent and thus also, for example, tcdrain, tcsendbreak, and close. Using drain_delay would partially work-around the problem with close, but at the cost of adding delays for all users while still not being able to guarantee that the buffers have been drained. Either way, this seems to amount to a regression. On the other hand, the added overhead to chars_in_buffer seems to break at least one application as well. I've implemented wait_until_sent-support for usb-serial, which fixes the problem without any such trade-offs and which I believe needs to go in to v3.10. For the stable trees I think keeping the current, less efficient (but more complete) chars_in_buffer implementations is preferred over introducing further regressions. Back-porting wait_until_sent-support could perhaps also be considered. I'm responding to this mail with a wait_until_sent-support series. Thanks, Johan -- 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