# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1213353582 -3600
# Node ID 7eab5d8788a6becb07d56a8ffa12b3675a21f4bb
# Parent 833ec967857cbd2cc055be1625b288edcae095ca
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@xxxxxxxxxx>
---
xen/common/keyhandler.c | 13 ++++---------
xen/drivers/char/console.c | 14 ++------------
xen/drivers/char/serial.c | 21 +++++++++++++++++----
xen/include/xen/console.h | 3 ---
xen/include/xen/serial.h | 3 ++-
5 files changed, 25 insertions(+), 29 deletions(-)
diff -r 833ec967857c -r 7eab5d8788a6 xen/common/keyhandler.c
--- a/xen/common/keyhandler.c Fri Jun 13 11:21:58 2008 +0100
+++ b/xen/common/keyhandler.c Fri Jun 13 11:39:42 2008 +0100
@@ -36,10 +36,10 @@ static void keypress_action(unsigned lon
{
keyhandler_t *h;
unsigned char key = keypress_key;
- console_start_log_everything();
+ console_start_sync();
if ( (h = key_table[key].u.handler) != NULL )
(*h)(key);
- console_end_log_everything();
+ console_end_sync();
}
static DECLARE_TASKLET(keypress_tasklet, keypress_action, 0);
@@ -50,10 +50,10 @@ void handle_keypress(unsigned char key,
if ( !in_irq() || (key_table[key].flags & KEYHANDLER_IRQ_CALLBACK) )
{
- console_start_log_everything();
+ console_start_sync();
if ( (h = key_table[key].u.irq_handler) != NULL )
(*h)(key, regs);
- console_end_log_everything();
+ console_end_sync();
}
else
{
@@ -105,9 +105,6 @@ static void dump_registers(unsigned char
{
unsigned int cpu;
- /* We want to get everything out that we possibly can. */
- console_start_sync();
-
printk("'%c' pressed -> dumping registers\n", key);
/* Get local execution state out immediately, in case we get stuck. */
@@ -123,8 +120,6 @@ static void dump_registers(unsigned char
}
printk("\n");
-
- console_end_sync();
}
static void dump_dom0_registers(unsigned char key)
diff -r 833ec967857c -r 7eab5d8788a6 xen/drivers/char/console.c
--- a/xen/drivers/char/console.c Fri Jun 13 11:21:58 2008 +0100
+++ b/xen/drivers/char/console.c Fri Jun 13 11:39:42 2008 +0100
@@ -635,16 +635,6 @@ int console_has(const char *device)
return 0;
}
-void console_start_log_everything(void)
-{
- atomic_inc(&print_everything);
-}
-
-void console_end_log_everything(void)
-{
- atomic_dec(&print_everything);
-}
-
void console_force_unlock(void)
{
spin_lock_init(&console_lock);
@@ -659,14 +649,14 @@ void console_force_lock(void)
void console_start_sync(void)
{
- console_start_log_everything();
+ atomic_inc(&print_everything);
serial_start_sync(sercon_handle);
}
void console_end_sync(void)
{
serial_end_sync(sercon_handle);
- console_end_log_everything();
+ atomic_dec(&print_everything);
}
void console_putc(char c)
diff -r 833ec967857c -r 7eab5d8788a6 xen/drivers/char/serial.c
--- a/xen/drivers/char/serial.c Fri Jun 13 11:21:58 2008 +0100
+++ b/xen/drivers/char/serial.c Fri Jun 13 11:39:42 2008 +0100
@@ -3,7 +3,7 @@
*
* Framework for serial device drivers.
*
- * Copyright (c) 2003-2005, K A Fraser
+ * Copyright (c) 2003-2008, K A Fraser
*/
#include <xen/config.h>
@@ -97,9 +97,18 @@ static void __serial_putc(struct serial_
if ( (port->txbuf != NULL) && !port->sync )
{
/* Interrupt-driven (asynchronous) transmitter. */
+
+ if ( port->tx_quench )
+ {
+ /* Buffer filled and we are dropping characters. */
+ if ( (port->txbufp - port->txbufc) > (serial_txbufsz / 2) )
+ return;
+ port->tx_quench = 0;
+ }
+
+ if ( (port->txbufp - port->txbufc) == serial_txbufsz )
+ {
#ifdef SERIAL_NEVER_DROP_CHARS
- if ( (port->txbufp - port->txbufc) == serial_txbufsz )
- {
/* Buffer is full: we spin waiting for space to appear. */
int i;
while ( !port->driver->tx_empty(port) )
@@ -108,9 +117,13 @@ static void __serial_putc(struct serial_
port->driver->putc(
port, port->txbuf[mask_serial_txbuf_idx(port->txbufc++)]);
port->txbuf[mask_serial_txbuf_idx(port->txbufp++)] = c;
+#else
+ /* Buffer is full: drop characters until buffer is half empty. */
+ port->tx_quench = 1;
+#endif
return;
}
-#endif
+
if ( ((port->txbufp - port->txbufc) == 0) &&
port->driver->tx_empty(port) )
{
diff -r 833ec967857c -r 7eab5d8788a6 xen/include/xen/console.h
--- a/xen/include/xen/console.h Fri Jun 13 11:21:58 2008 +0100
+++ b/xen/include/xen/console.h Fri Jun 13 11:39:42 2008 +0100
@@ -26,9 +26,6 @@ void console_start_sync(void);
void console_start_sync(void);
void console_end_sync(void);
-void console_start_log_everything(void);
-void console_end_log_everything(void);
-
/*
* Steal output from the console. Returns +ve identifier, else -ve error.
* Takes the handle of the serial line to steal, and steal callback function.
diff -r 833ec967857c -r 7eab5d8788a6 xen/include/xen/serial.h
--- a/xen/include/xen/serial.h Fri Jun 13 11:21:58 2008 +0100
+++ b/xen/include/xen/serial.h Fri Jun 13 11:39:42 2008 +0100
@@ -3,7 +3,7 @@
*
* Framework for serial device drivers.
*
- * Copyright (c) 2003-2005, K A Fraser
+ * Copyright (c) 2003-2008, K A Fraser
*/
#ifndef __XEN_SERIAL_H__
@@ -32,6 +32,7 @@ struct serial_port {
/* Transmit data buffer (interrupt-driven uart). */
char *txbuf;
unsigned int txbufp, txbufc;
+ bool_t tx_quench;
/* Force synchronous transmit. */
int sync;
/* Receiver callback functions (asynchronous receivers). */
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|