[Patch] Peformance improvement of serial console via virtualserial port

From: Taku Izumi
Date: Mon Sep 05 2005 - 21:10:05 EST


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 <izumi2005@xxxxxxxxxxxxxxxx>

----------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 ) ;
}

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


-
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/