2005-09-06 02:09:44

by izumi

[permalink] [raw]
Subject: [Patch] Peformance improvement of serial console via virtual serial port

Greetings.

This patch improves peformance of serial console by using FIFO.
I think original serial driver is not effective, but transfer rate of
real serial port is low, so this problem has not been exposed.

However, because transfer rate of virtual serial port (ex. Serial Over
Ethernet)
is higher than that of real serial port, this problem is exposed.
The output performance via virtual serial port is still low by using original
serial driver. I think original serial driver becomes bottoleneck.


Taku Izumi <[email protected]>

----------patch-------->8----------------------------------------

diff -Npur linux-2.6.9.org/drivers/serial/8250.c
linux-2.6.9/drivers/serial/8250.c
--- linux-2.6.9.org/drivers/serial/8250.c 2005-08-08
11:17:38.556373366 +0900
+++ linux-2.6.9/drivers/serial/8250.c 2005-08-08 11:41:03.759131389 +0900
@@ -1943,18 +1943,33 @@ serial8250_console_write(struct console
/*
* Now, do each character
*/
- for (i = 0; i < count; i++, s++) {
- wait_for_xmitr(up);
+ for (i = 0; i < count; ) {
+ int fifo ;

+ wait_for_xmitr(up);
+ fifo = up->tx_loadsz ;
/*
- * Send the character out.
+ * Send the character out using FIFO.
* If a LF, also do CR...
*/
- serial_out(up, UART_TX, *s);
- if (*s == 10) {
- wait_for_xmitr(up);
- serial_out(up, UART_TX, 13);
- }
+ do {
+ serial_out(up, UART_TX, *s);
+ fifo-- ;
+ if (*s == 10) {
+ if (fifo > 0) {
+ serial_out(up, UART_TX, 13);
+ fifo--;
+ } else {
+ /* No room to add CR */
+ wait_for_xmitr(up);
+ fifo = up->tx_loadsz ;
+ serial_out(up, UART_TX, 13);
+ fifo--;
+ }
+ }
+ i++ ;
+ s++ ;
+ } while (fifo > 0 && i < count ) ;
}

/*
----------------------------------------------------------------------