Maybe I don't have a complete understanding of what is happening, but it appears that the software buffer is actually artificially limited to 65536 bytes in the tty_buffer_alloc function in tty_buffer.c. I wrote a quick application to test this. The test opens two 8250 ports on my computer and sends 69632 (68Kib) of data from one port to the other. After the write, the test performs a read from the other port, which only receives 69376 bytes. I believe the extra space over 64KiB is coming from the line discipline (n_tty.c), but the test still shows data being lost. Neither the overrun or buf_overrun field in the port's icount structure were incremented during the test. Here is the section of code I'm referencing from tty_buffer.c. This code was pulled from linux-next. static struct tty_buffer *tty_buffer_alloc(struct tty_struct *tty, size_t size) { struct tty_buffer *p; if (tty->buf.memory_used + size > 65536) return NULL; p = kmalloc(sizeof(struct tty_buffer) + 2 * size, GFP_ATOMIC); if (p == NULL) return NULL; p->used = 0; p->size = size; p->next = NULL; p->commit = 0; p->read = 0; p->char_buf_ptr = (char *)(p->data); p->flag_buf_ptr = (unsigned char *)p->char_buf_ptr + size; tty->buf.memory_used += size; return p; } Corbin On Tue, May 15, 2012 at 11:27 AM, Alan Cox <alan@xxxxxxxxxxxxxxxxxxx> wrote: > On Tue, 15 May 2012 11:20:19 -0500 > Corbin <corbinat@xxxxxxxxx> wrote: > >> I agree that losing bytes in the software layer wouldn't happen under >> normal circumstances, but it is still important to know when it >> happens. My understanding was that the overrun field in the port's >> icount was for logging hardware overruns, while the buf_overrun field >> should be used for software overruns. If this is not the case then is >> there another method for determining when the software layer is losing >> bytes? > > It'll occur when the machine cannot even allocate a free page of memory. > So you'll get GFP spews in the kernel log to go with it. > > Alan -- 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