WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] Bring back console_start_log_everything()

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Bring back console_start_log_everything() as a milder alternative to
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 13 Jun 2008 14:10:44 -0700
Delivery-date: Fri, 13 Jun 2008 14:12:04 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1213362900 -3600
# Node ID d4dcd4d399524db60c52963cda5acc73305f8b42
# Parent  a41d14c3bf190a5a3523b15fdc417a043b00a844
Bring back console_start_log_everything() as a milder alternative to
console_start_sync(). Revert keyhandler logic to use it. The
difference now is that serial logic is updated to not drop characters
if inb a log_everything region. Still this is milder than a sync
region since the async buffer must be filled before we start to
busy-wait on each character.

Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/common/keyhandler.c    |   13 ++++++---
 xen/drivers/char/console.c |   12 ++++++++
 xen/drivers/char/serial.c  |   61 +++++++++++++++++++++++++++++++++++----------
 xen/include/xen/console.h  |    3 ++
 xen/include/xen/serial.h   |    5 +++
 5 files changed, 77 insertions(+), 17 deletions(-)

diff -r a41d14c3bf19 -r d4dcd4d39952 xen/common/keyhandler.c
--- a/xen/common/keyhandler.c   Fri Jun 13 13:55:50 2008 +0100
+++ b/xen/common/keyhandler.c   Fri Jun 13 14:15:00 2008 +0100
@@ -36,10 +36,10 @@ static void keypress_action(unsigned lon
 {
     keyhandler_t *h;
     unsigned char key = keypress_key;
-    console_start_sync();
+    console_start_log_everything();
     if ( (h = key_table[key].u.handler) != NULL )
         (*h)(key);
-    console_end_sync();
+    console_end_log_everything();
 }
 
 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_sync();
+        console_start_log_everything();
         if ( (h = key_table[key].u.irq_handler) != NULL )
             (*h)(key, regs);
-        console_end_sync();
+        console_end_log_everything();
     }
     else
     {
@@ -105,6 +105,9 @@ 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. */
@@ -120,6 +123,8 @@ static void dump_registers(unsigned char
     }
 
     printk("\n");
+
+    console_end_sync();
 }
 
 static void dump_dom0_registers(unsigned char key)
diff -r a41d14c3bf19 -r d4dcd4d39952 xen/drivers/char/console.c
--- a/xen/drivers/char/console.c        Fri Jun 13 13:55:50 2008 +0100
+++ b/xen/drivers/char/console.c        Fri Jun 13 14:15:00 2008 +0100
@@ -635,6 +635,18 @@ int console_has(const char *device)
     return 0;
 }
 
+void console_start_log_everything(void)
+{
+    serial_start_log_everything(sercon_handle);
+    atomic_inc(&print_everything);
+}
+
+void console_end_log_everything(void)
+{
+    serial_end_log_everything(sercon_handle);
+    atomic_dec(&print_everything);
+}
+
 void console_force_unlock(void)
 {
     spin_lock_init(&console_lock);
diff -r a41d14c3bf19 -r d4dcd4d39952 xen/drivers/char/serial.c
--- a/xen/drivers/char/serial.c Fri Jun 13 13:55:50 2008 +0100
+++ b/xen/drivers/char/serial.c Fri Jun 13 14:15:00 2008 +0100
@@ -108,19 +108,23 @@ static void __serial_putc(struct serial_
 
         if ( (port->txbufp - port->txbufc) == serial_txbufsz )
         {
-#ifdef SERIAL_NEVER_DROP_CHARS
-            /* Buffer is full: we spin waiting for space to appear. */
-            int i;
-            while ( !port->driver->tx_empty(port) )
-                cpu_relax();
-            for ( i = 0; i < port->tx_fifo_size; i++ )
-                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
+            if ( port->tx_log_everything )
+            {
+                /* Buffer is full: we spin waiting for space to appear. */
+                int i;
+                while ( !port->driver->tx_empty(port) )
+                    cpu_relax();
+                for ( i = 0; i < port->tx_fifo_size; i++ )
+                    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 chars until buffer is half empty. */
+                port->tx_quench = 1;
+            }
             return;
         }
 
@@ -388,6 +392,37 @@ void serial_end_sync(int handle)
     spin_unlock_irqrestore(&port->tx_lock, flags);
 }
 
+void serial_start_log_everything(int handle)
+{
+    struct serial_port *port;
+    unsigned long flags;
+
+    if ( handle == -1 )
+        return;
+    
+    port = &com[handle & SERHND_IDX];
+
+    spin_lock_irqsave(&port->tx_lock, flags);
+    port->tx_log_everything++;
+    port->tx_quench = 0;
+    spin_unlock_irqrestore(&port->tx_lock, flags);
+}
+
+void serial_end_log_everything(int handle)
+{
+    struct serial_port *port;
+    unsigned long flags;
+
+    if ( handle == -1 )
+        return;
+    
+    port = &com[handle & SERHND_IDX];
+
+    spin_lock_irqsave(&port->tx_lock, flags);
+    port->tx_log_everything--;
+    spin_unlock_irqrestore(&port->tx_lock, flags);
+}
+
 int serial_tx_space(int handle)
 {
     struct serial_port *port;
diff -r a41d14c3bf19 -r d4dcd4d39952 xen/include/xen/console.h
--- a/xen/include/xen/console.h Fri Jun 13 13:55:50 2008 +0100
+++ b/xen/include/xen/console.h Fri Jun 13 14:15:00 2008 +0100
@@ -26,6 +26,9 @@ 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 a41d14c3bf19 -r d4dcd4d39952 xen/include/xen/serial.h
--- a/xen/include/xen/serial.h  Fri Jun 13 13:55:50 2008 +0100
+++ b/xen/include/xen/serial.h  Fri Jun 13 14:15:00 2008 +0100
@@ -33,6 +33,7 @@ struct serial_port {
     char               *txbuf;
     unsigned int        txbufp, txbufc;
     bool_t              tx_quench;
+    int                 tx_log_everything;
     /* Force synchronous transmit. */
     int                 sync;
     /* Receiver callback functions (asynchronous receivers). */
@@ -97,6 +98,10 @@ void serial_start_sync(int handle);
 void serial_start_sync(int handle);
 void serial_end_sync(int handle);
 
+/* Start/end a region where we will wait rather than drop characters. */
+void serial_start_log_everything(int handle);
+void serial_end_log_everything(int handle);
+
 /* Return number of bytes headroom in transmit buffer. */
 int serial_tx_space(int handle);
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Bring back console_start_log_everything() as a milder alternative to, Xen patchbot-unstable <=