Re: How important is it that tty_write_room doesn't lie?

From: Greg KH
Date: Wed Feb 23 2011 - 18:54:54 EST


On Wed, Feb 23, 2011 at 02:48:18PM -0600, Timur Tabi wrote:
> Greg KH wrote:
> > I think that people don't normally hit this as the console code isn't
> > used as a tty and a console at the same time, right?
>
> That's another thing I never understood. It's rare for a driver to support both
> the console and tty layers. The serial core driver does that, but I can't find
> any other examples. I would think that a driver would support both interfaces,
> because both are needed. Simplistically, printk --> console, and printf -->
> tty. When would ever want user-space support but not kernel support?

usb-serial devices usually never care about kernel support, and as Ted
posted, the majority of people use serial ports for modems.

> > How big is your buffer in your FIFO?
>
> The FIFO can vary, but it's probably at least 2KB it size. At least, we hope to
> able to set it to that size in the field. Currently, we set it to 4KB.

That's huge.

> > Can you always just say you have a
> > smaller ammount in order to try to work around the tty layer trying to
> > send you a few extra bytes at times?
>
> How many bytes extra? I don't even have any hard evidence that this is actually
> happening, but a customer is reporting lost characters and this the only thing
> we could come up with.

With such a large FIFO, I would be very surprised for overruns like
this, unless you are working at very slow baud rates.

> The serial drivers seem to have a software FIFO for the TTY interface, but none
> for the console interface. uart_write() puts the data into an internal circular
> buffer, and then calls uart_start(). serial8250_console_write(), however,
> writes directly to the hardware. Is this what I should be doing?

Try it out and see what happens :)

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/