debuggers.hg
changeset 17889:7eab5d8788a6
Improve serial output when dropping characters to drop them in big
batches. Printing one character in one thousand is not useful!
Also make debug handlers all print synchronously.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
batches. Printing one character in one thousand is not useful!
Also make debug handlers all print synchronously.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author | Keir Fraser <keir.fraser@citrix.com> |
---|---|
date | Fri Jun 13 11:39:42 2008 +0100 (2008-06-13) |
parents | 833ec967857c |
children | 12ae02c09d1e |
files | xen/common/keyhandler.c xen/drivers/char/console.c xen/drivers/char/serial.c xen/include/xen/console.h xen/include/xen/serial.h |
line diff
1.1 --- a/xen/common/keyhandler.c Fri Jun 13 11:21:58 2008 +0100 1.2 +++ b/xen/common/keyhandler.c Fri Jun 13 11:39:42 2008 +0100 1.3 @@ -36,10 +36,10 @@ static void keypress_action(unsigned lon 1.4 { 1.5 keyhandler_t *h; 1.6 unsigned char key = keypress_key; 1.7 - console_start_log_everything(); 1.8 + console_start_sync(); 1.9 if ( (h = key_table[key].u.handler) != NULL ) 1.10 (*h)(key); 1.11 - console_end_log_everything(); 1.12 + console_end_sync(); 1.13 } 1.14 1.15 static DECLARE_TASKLET(keypress_tasklet, keypress_action, 0); 1.16 @@ -50,10 +50,10 @@ void handle_keypress(unsigned char key, 1.17 1.18 if ( !in_irq() || (key_table[key].flags & KEYHANDLER_IRQ_CALLBACK) ) 1.19 { 1.20 - console_start_log_everything(); 1.21 + console_start_sync(); 1.22 if ( (h = key_table[key].u.irq_handler) != NULL ) 1.23 (*h)(key, regs); 1.24 - console_end_log_everything(); 1.25 + console_end_sync(); 1.26 } 1.27 else 1.28 { 1.29 @@ -105,9 +105,6 @@ static void dump_registers(unsigned char 1.30 { 1.31 unsigned int cpu; 1.32 1.33 - /* We want to get everything out that we possibly can. */ 1.34 - console_start_sync(); 1.35 - 1.36 printk("'%c' pressed -> dumping registers\n", key); 1.37 1.38 /* Get local execution state out immediately, in case we get stuck. */ 1.39 @@ -123,8 +120,6 @@ static void dump_registers(unsigned char 1.40 } 1.41 1.42 printk("\n"); 1.43 - 1.44 - console_end_sync(); 1.45 } 1.46 1.47 static void dump_dom0_registers(unsigned char key)
2.1 --- a/xen/drivers/char/console.c Fri Jun 13 11:21:58 2008 +0100 2.2 +++ b/xen/drivers/char/console.c Fri Jun 13 11:39:42 2008 +0100 2.3 @@ -635,16 +635,6 @@ int console_has(const char *device) 2.4 return 0; 2.5 } 2.6 2.7 -void console_start_log_everything(void) 2.8 -{ 2.9 - atomic_inc(&print_everything); 2.10 -} 2.11 - 2.12 -void console_end_log_everything(void) 2.13 -{ 2.14 - atomic_dec(&print_everything); 2.15 -} 2.16 - 2.17 void console_force_unlock(void) 2.18 { 2.19 spin_lock_init(&console_lock); 2.20 @@ -659,14 +649,14 @@ void console_force_lock(void) 2.21 2.22 void console_start_sync(void) 2.23 { 2.24 - console_start_log_everything(); 2.25 + atomic_inc(&print_everything); 2.26 serial_start_sync(sercon_handle); 2.27 } 2.28 2.29 void console_end_sync(void) 2.30 { 2.31 serial_end_sync(sercon_handle); 2.32 - console_end_log_everything(); 2.33 + atomic_dec(&print_everything); 2.34 } 2.35 2.36 void console_putc(char c)
3.1 --- a/xen/drivers/char/serial.c Fri Jun 13 11:21:58 2008 +0100 3.2 +++ b/xen/drivers/char/serial.c Fri Jun 13 11:39:42 2008 +0100 3.3 @@ -3,7 +3,7 @@ 3.4 * 3.5 * Framework for serial device drivers. 3.6 * 3.7 - * Copyright (c) 2003-2005, K A Fraser 3.8 + * Copyright (c) 2003-2008, K A Fraser 3.9 */ 3.10 3.11 #include <xen/config.h> 3.12 @@ -97,9 +97,18 @@ static void __serial_putc(struct serial_ 3.13 if ( (port->txbuf != NULL) && !port->sync ) 3.14 { 3.15 /* Interrupt-driven (asynchronous) transmitter. */ 3.16 -#ifdef SERIAL_NEVER_DROP_CHARS 3.17 + 3.18 + if ( port->tx_quench ) 3.19 + { 3.20 + /* Buffer filled and we are dropping characters. */ 3.21 + if ( (port->txbufp - port->txbufc) > (serial_txbufsz / 2) ) 3.22 + return; 3.23 + port->tx_quench = 0; 3.24 + } 3.25 + 3.26 if ( (port->txbufp - port->txbufc) == serial_txbufsz ) 3.27 { 3.28 +#ifdef SERIAL_NEVER_DROP_CHARS 3.29 /* Buffer is full: we spin waiting for space to appear. */ 3.30 int i; 3.31 while ( !port->driver->tx_empty(port) ) 3.32 @@ -108,9 +117,13 @@ static void __serial_putc(struct serial_ 3.33 port->driver->putc( 3.34 port, port->txbuf[mask_serial_txbuf_idx(port->txbufc++)]); 3.35 port->txbuf[mask_serial_txbuf_idx(port->txbufp++)] = c; 3.36 +#else 3.37 + /* Buffer is full: drop characters until buffer is half empty. */ 3.38 + port->tx_quench = 1; 3.39 +#endif 3.40 return; 3.41 } 3.42 -#endif 3.43 + 3.44 if ( ((port->txbufp - port->txbufc) == 0) && 3.45 port->driver->tx_empty(port) ) 3.46 {
4.1 --- a/xen/include/xen/console.h Fri Jun 13 11:21:58 2008 +0100 4.2 +++ b/xen/include/xen/console.h Fri Jun 13 11:39:42 2008 +0100 4.3 @@ -26,9 +26,6 @@ void console_force_lock(void); 4.4 void console_start_sync(void); 4.5 void console_end_sync(void); 4.6 4.7 -void console_start_log_everything(void); 4.8 -void console_end_log_everything(void); 4.9 - 4.10 /* 4.11 * Steal output from the console. Returns +ve identifier, else -ve error. 4.12 * Takes the handle of the serial line to steal, and steal callback function.
5.1 --- a/xen/include/xen/serial.h Fri Jun 13 11:21:58 2008 +0100 5.2 +++ b/xen/include/xen/serial.h Fri Jun 13 11:39:42 2008 +0100 5.3 @@ -3,7 +3,7 @@ 5.4 * 5.5 * Framework for serial device drivers. 5.6 * 5.7 - * Copyright (c) 2003-2005, K A Fraser 5.8 + * Copyright (c) 2003-2008, K A Fraser 5.9 */ 5.10 5.11 #ifndef __XEN_SERIAL_H__ 5.12 @@ -32,6 +32,7 @@ struct serial_port { 5.13 /* Transmit data buffer (interrupt-driven uart). */ 5.14 char *txbuf; 5.15 unsigned int txbufp, txbufc; 5.16 + bool_t tx_quench; 5.17 /* Force synchronous transmit. */ 5.18 int sync; 5.19 /* Receiver callback functions (asynchronous receivers). */