Skip to contentSkip to conversation

serial: avoid fully initializing unused consoles

RFC PATCH In review Jan Beulich 1 participant 1 message Sep 11, 2012

lore
Share & tools
lore
#0 lore raw

RFC PATCH 4/8 serial: avoid fully initializing unused consoles

Defer calling the drivers' post-IRQ initialization functions (generally doing allocation of transmit buffers) until it is known that the respective console is actually going to be used.

xen/drivers/char/ehci-dbgp.c +2 -1
@@ -1391,7 +1391,8 @@ static int ehci_dbgp_check_release(struc
     printk(XENLOG_INFO "Releasing EHCI debug port at %02x:%02x.%u\n",
            dbgp->bus, dbgp->slot, dbgp->func);
 
-    kill_timer(&dbgp->timer);
+    if ( dbgp->timer.function )
+        kill_timer(&dbgp->timer);
     dbgp->ehci_debug = NULL;
 
     ctrl = readl(&ehci_debug->control);
xen/drivers/char/serial.c +29 -16

88 lines not on this page · raw message

xen/include/xen/serial.h +7 -0
@@ -25,10 +25,17 @@ extern unsigned int serial_txbufsz;
 
 struct uart_driver;
 
+enum serial_port_state {
+    serial_unused,
+    serial_parsed,
+    serial_initialized
+};
+
 struct serial_port {
     /* Uart-driver parameters. */
     struct uart_driver *driver;
     void               *uart;
+    enum serial_port_state state;
     /* Number of characters the port can hold for transmit. */
     int                 tx_fifo_size;
     /* Transmit data buffer (interrupt-driven uart). */

serial: avoid fully initializing unused consoles

Defer calling the drivers' post-IRQ initialization functions (generally doing allocation of transmit buffers) until it is known that the respective console is actually going to be used.

xen/drivers/char/ehci-dbgp.c +2 -1
@@ -1391,7 +1391,8 @@ static int ehci_dbgp_check_release(struc
     printk(XENLOG_INFO "Releasing EHCI debug port at %02x:%02x.%u\n",
            dbgp->bus, dbgp->slot, dbgp->func);
 
-    kill_timer(&dbgp->timer);
+    if ( dbgp->timer.function )
+        kill_timer(&dbgp->timer);
     dbgp->ehci_debug = NULL;
 
     ctrl = readl(&ehci_debug->control);
xen/drivers/char/serial.c +29 -16

88 lines not on this page · raw message

xen/include/xen/serial.h +7 -0
@@ -25,10 +25,17 @@ extern unsigned int serial_txbufsz;
 
 struct uart_driver;
 
+enum serial_port_state {
+    serial_unused,
+    serial_parsed,
+    serial_initialized
+};
+
 struct serial_port {
     /* Uart-driver parameters. */
     struct uart_driver *driver;
     void               *uart;
+    enum serial_port_state state;
     /* Number of characters the port can hold for transmit. */
     int                 tx_fifo_size;
     /* Transmit data buffer (interrupt-driven uart). */

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel