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

[Xen-changelog] Add a xencons_bufsz= option to allow a larger than usual console



ChangeSet 1.1828, 2005/04/15 00:30:47+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx

        Add a xencons_bufsz= option to allow a larger than usual console
        buffer to be allocated. Reduces chance of console output being
        truncated.
        Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>



 console.c |   37 +++++++++++++++++++++++++------------
 1 files changed, 25 insertions(+), 12 deletions(-)


diff -Nru a/linux-2.6.11-xen-sparse/drivers/xen/console/console.c 
b/linux-2.6.11-xen-sparse/drivers/xen/console/console.c
--- a/linux-2.6.11-xen-sparse/drivers/xen/console/console.c     2005-04-14 
20:03:55 -04:00
+++ b/linux-2.6.11-xen-sparse/drivers/xen/console/console.c     2005-04-14 
20:03:55 -04:00
@@ -44,6 +44,7 @@
 #include <linux/slab.h>
 #include <linux/init.h>
 #include <linux/console.h>
+#include <linux/bootmem.h>
 #include <asm/io.h>
 #include <asm/irq.h>
 #include <asm/uaccess.h>
@@ -77,11 +78,21 @@
 __setup("xencons=", xencons_setup);
 
 /* The kernel and user-land drivers share a common transmit buffer. */
-#define WBUF_SIZE     4096
-#define WBUF_MASK(_i) ((_i)&(WBUF_SIZE-1))
-static char wbuf[WBUF_SIZE];
+static unsigned int wbuf_size = 4096;
+#define WBUF_MASK(_i) ((_i)&(wbuf_size-1))
+static char *wbuf;
 static unsigned int wc, wp; /* write_cons, write_prod */
 
+static int __init xencons_bufsz_setup(char *str)
+{
+    unsigned int goal;
+    goal = simple_strtoul(str, NULL, 0);
+    while ( wbuf_size < goal )
+        wbuf_size <<= 1;
+    return 1;
+}
+__setup("xencons_bufsz=", xencons_bufsz_setup);
+
 /* This lock protects accesses to the common transmit buffer. */
 static spinlock_t xencons_lock = SPIN_LOCK_UNLOCKED;
 
@@ -114,7 +125,7 @@
     
     for ( i = 0; i < count; i++ )
     {
-        if ( (wp - wc) >= (WBUF_SIZE - 1) )
+        if ( (wp - wc) >= (wbuf_size - 1) )
             break;
         if ( (wbuf[WBUF_MASK(wp++)] = s[i]) == '\n' )
             wbuf[WBUF_MASK(wp++)] = '\r';
@@ -195,6 +206,8 @@
     else
         strcpy(kcons_info.name, "tty");
 
+    wbuf = alloc_bootmem(wbuf_size);
+
     register_console(&kcons_info);
     return __RETCODE;
 }
@@ -246,8 +259,8 @@
             continue;
         if ( sz > sizeof(msg.msg) )
             sz = sizeof(msg.msg);
-        if ( sz > (WBUF_SIZE - WBUF_MASK(wc)) )
-            sz = WBUF_SIZE - WBUF_MASK(wc);
+        if ( sz > (wbuf_size - WBUF_MASK(wc)) )
+            sz = wbuf_size - WBUF_MASK(wc);
 
         msg.type    = CMSG_CONSOLE;
         msg.subtype = CMSG_CONSOLE_DATA;
@@ -315,8 +328,8 @@
         while ( wc != wp )
         {
             sz = wp - wc;
-            if ( sz > (WBUF_SIZE - WBUF_MASK(wc)) )
-                sz = WBUF_SIZE - WBUF_MASK(wc);
+            if ( sz > (wbuf_size - WBUF_MASK(wc)) )
+                sz = wbuf_size - WBUF_MASK(wc);
             kcons_write_dom0(NULL, &wbuf[WBUF_MASK(wc)], sz);
             wc += sz;
             work_done = 1;
@@ -344,8 +357,8 @@
             sz = wp - wc;
             if ( sz > sizeof(msg.msg) )
                 sz = sizeof(msg.msg);
-            if ( sz > (WBUF_SIZE - WBUF_MASK(wc)) )
-                sz = WBUF_SIZE - WBUF_MASK(wc);
+            if ( sz > (wbuf_size - WBUF_MASK(wc)) )
+                sz = wbuf_size - WBUF_MASK(wc);
 
             msg.type    = CMSG_CONSOLE;
             msg.subtype = CMSG_CONSOLE_DATA;
@@ -409,7 +422,7 @@
 
 static int xencons_write_room(struct tty_struct *tty)
 {
-    return WBUF_SIZE - (wp - wc);
+    return wbuf_size - (wp - wc);
 }
 
 static int xencons_chars_in_buffer(struct tty_struct *tty)
@@ -468,7 +481,7 @@
 static inline int __xencons_put_char(int ch)
 {
     char _ch = (char)ch;
-    if ( (wp - wc) == WBUF_SIZE )
+    if ( (wp - wc) == wbuf_size )
         return 0;
     wbuf[WBUF_MASK(wp++)] = _ch;
     return 1;

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.