Re: performance-improvement-of-serial-console-via-virtual.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear Russel:

I change my patch based on the result of discussion.

The change is as follows:

  - add a member to uart_8250_port structure in order to check if FIFO is
    enable or not.
  - use FIFO at serial8250_console_write function only when FIFO is enable.

I tested my patch on i386 and ia64 architecture.

signed-off-by: Taku Izumi <[email protected]>
diff -urNp linux-2.6.14-rc1.org/drivers/serial/8250.c linux-2.6.14-rc1/drivers/serial/8250.c
--- linux-2.6.14-rc1.org/drivers/serial/8250.c	2005-09-13 12:12:09.000000000 +0900
+++ linux-2.6.14-rc1/drivers/serial/8250.c	2005-09-15 09:38:46.000000000 +0900
@@ -128,6 +128,7 @@ struct uart_8250_port {
 	unsigned char		mcr_mask;	/* mask of user bits */
 	unsigned char		mcr_force;	/* mask of forced bits */
 	unsigned char		lsr_break_flag;
+	unsigned char		fcr;
 
 	/*
 	 * We provide a per-port pm hook.
@@ -332,6 +333,7 @@ static unsigned int serial_icr_read(stru
 static inline void serial8250_clear_fifos(struct uart_8250_port *p)
 {
 	if (p->capabilities & UART_CAP_FIFO) {
+		p->fcr = 0;
 		serial_outp(p, UART_FCR, UART_FCR_ENABLE_FIFO);
 		serial_outp(p, UART_FCR, UART_FCR_ENABLE_FIFO |
 			       UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT);
@@ -1809,8 +1811,10 @@ serial8250_set_termios(struct uart_port 
 	 * LCR DLAB must be set to enable 64-byte FIFO mode. If the FCR
 	 * is written without DLAB set, this mode will be disabled.
 	 */
-	if (up->port.type == PORT_16750)
+	if (up->port.type == PORT_16750) {
 		serial_outp(up, UART_FCR, fcr);
+		up->fcr = fcr;
+	}
 
 	serial_outp(up, UART_LCR, cval);		/* reset DLAB */
 	up->lcr = cval;					/* Save LCR */
@@ -1820,6 +1824,7 @@ serial8250_set_termios(struct uart_port 
 			serial_outp(up, UART_FCR, UART_FCR_ENABLE_FIFO);
 		}
 		serial_outp(up, UART_FCR, fcr);		/* set fcr */
+		up->fcr = fcr;
 	}
 	serial8250_set_mctrl(&up->port, up->port.mctrl);
 	spin_unlock_irqrestore(&up->port.lock, flags);
@@ -2140,6 +2145,7 @@ serial8250_console_write(struct console 
 	struct uart_8250_port *up = &serial8250_ports[co->index];
 	unsigned int ier;
 	int i;
+	int tx_loadsz;
 
 	/*
 	 *	First save the UER then disable the interrupts
@@ -2152,20 +2158,39 @@ serial8250_console_write(struct console 
 		serial_out(up, UART_IER, 0);
 
 	/*
+	 *	Check whether FIFO is enabled
+	 */ 
+	tx_loadsz = (up->fcr & UART_FCR_ENABLE_FIFO ? up->tx_loadsz : 1);
+	/*
 	 *	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 = 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 = tx_loadsz;
+					serial_out(up, UART_TX, 13);
+					fifo--;
+				}
+			}
+			i++;
+			s++;
+		} while (fifo > 0 && i < count);
 	}
 
 	/*

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux