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] New option conring_size= to allow larger

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] New option conring_size= to allow larger console ring.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 15 Apr 2009 05:55:19 -0700
Delivery-date: Wed, 15 Apr 2009 05:56:37 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/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 1239717147 -3600
# Node ID 81d6b5762c4036965f4e92b226a93e6c0925bd92
# Parent  cbaae05c2902739b789b8aa21ddedd0bdbb1ebb0
New option conring_size= to allow larger console ring.
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/arch/ia64/xen/xensetup.c |    5 +--
 xen/arch/x86/setup.c         |    6 +---
 xen/drivers/char/console.c   |   61 +++++++++++++++++++++++++++++++++++--------
 xen/include/xen/console.h    |    3 +-
 4 files changed, 56 insertions(+), 19 deletions(-)

diff -r cbaae05c2902 -r 81d6b5762c40 xen/arch/ia64/xen/xensetup.c
--- a/xen/arch/ia64/xen/xensetup.c      Tue Apr 14 11:21:45 2009 +0100
+++ b/xen/arch/ia64/xen/xensetup.c      Tue Apr 14 14:52:27 2009 +0100
@@ -374,7 +374,6 @@ void __init start_kernel(void)
         ns16550_init(0, &ns16550_com1);
         ns16550_init(1, &ns16550_com2);
     }
-    serial_init_preirq();
 
 #ifdef CONFIG_VGA
     /* Plug in a default VGA mode */
@@ -390,7 +389,7 @@ void __init start_kernel(void)
                                         ia64_boot_param->console_info.num_cols;
 #endif
 
-    init_console();
+    console_init_preirq();
 
     if (running_on_sim || ia64_boot_param->domain_start == 0 ||
                           ia64_boot_param->domain_size == 0) {
@@ -648,7 +647,7 @@ printk("num_online_cpus=%d, max_cpus=%d\
                 ns16550_init(0, &ns16550_com1);
             }
         }
-        serial_init_postirq();
+        console_init_postirq();
     }
 
     expose_p2m_init();
diff -r cbaae05c2902 -r 81d6b5762c40 xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c      Tue Apr 14 11:21:45 2009 +0100
+++ b/xen/arch/x86/setup.c      Tue Apr 14 14:52:27 2009 +0100
@@ -463,9 +463,7 @@ void __init __start_xen(unsigned long mb
     ns16550.io_base = 0x2f8;
     ns16550.irq     = 3;
     ns16550_init(1, &ns16550);
-    serial_init_preirq();
-
-    init_console();
+    console_init_preirq();
 
     printk("Command line: %s\n", cmdline);
 
@@ -958,7 +956,7 @@ void __init __start_xen(unsigned long mb
 
     initialize_keytable();
 
-    serial_init_postirq();
+    console_init_postirq();
 
     for_each_present_cpu ( i )
     {
diff -r cbaae05c2902 -r 81d6b5762c40 xen/drivers/char/console.c
--- a/xen/drivers/char/console.c        Tue Apr 14 11:21:45 2009 +0100
+++ b/xen/drivers/char/console.c        Tue Apr 14 14:52:27 2009 +0100
@@ -58,10 +58,16 @@ static int opt_console_timestamps;
 static int opt_console_timestamps;
 boolean_param("console_timestamps", opt_console_timestamps);
 
-#define CONRING_SIZE 16384
-#define CONRING_IDX_MASK(i) ((i)&(CONRING_SIZE-1))
-static char conring[CONRING_SIZE];
-static uint32_t conringc, conringp;
+/* conring_size: allows a large console ring than default (16kB). */
+static uint32_t opt_conring_size;
+static void parse_conring_size(char *s)
+{ opt_conring_size = parse_size_and_unit(s, NULL); }
+custom_param("conring_size", parse_conring_size);
+
+#define _CONRING_SIZE 16384
+#define CONRING_IDX_MASK(i) ((i)&(conring_size-1))
+static char _conring[_CONRING_SIZE], *conring = _conring;
+static uint32_t conring_size = _CONRING_SIZE, conringc, conringp;
 
 static int sercon_handle = -1;
 
@@ -178,8 +184,8 @@ static void putchar_console_ring(int c)
 {
     ASSERT(spin_is_locked(&console_lock));
     conring[CONRING_IDX_MASK(conringp++)] = c;
-    if ( (uint32_t)(conringp - conringc) > CONRING_SIZE )
-        conringc = conringp - CONRING_SIZE;
+    if ( (uint32_t)(conringp - conringc) > conring_size )
+        conringc = conringp - conring_size;
 }
 
 long read_console_ring(struct xen_sysctl_readconsole *op)
@@ -199,8 +205,8 @@ long read_console_ring(struct xen_sysctl
     {
         idx = CONRING_IDX_MASK(c);
         len = conringp - c;
-        if ( (idx + len) > CONRING_SIZE )
-            len = CONRING_SIZE - idx;
+        if ( (idx + len) > conring_size )
+            len = conring_size - idx;
         if ( (sofar + len) > max )
             len = max - sofar;
         if ( copy_to_guest_offset(str, sofar, &conring[idx], len) )
@@ -212,8 +218,8 @@ long read_console_ring(struct xen_sysctl
     if ( op->clear )
     {
         spin_lock_irq(&console_lock);
-        if ( (uint32_t)(conringp - c) > CONRING_SIZE )
-            conringc = conringp - CONRING_SIZE;
+        if ( (uint32_t)(conringp - c) > conring_size )
+            conringc = conringp - conring_size;
         else
             conringc = c;
         spin_unlock_irq(&console_lock);
@@ -544,9 +550,11 @@ void printk(const char *fmt, ...)
     local_irq_restore(flags);
 }
 
-void __init init_console(void)
+void __init console_init_preirq(void)
 {
     char *p;
+
+    serial_init_preirq();
 
     /* Where should console output go? */
     for ( p = opt_console; p != NULL; p = strchr(p, ',') )
@@ -585,6 +593,37 @@ void __init init_console(void)
         add_taint(TAINT_SYNC_CONSOLE);
         printk("Console output is synchronous.\n");
     }
+}
+
+void __init console_init_postirq(void)
+{
+    char *ring;
+    unsigned int i;
+
+    serial_init_postirq();
+
+    /* Round size down to a power of two. */
+    while ( opt_conring_size & (opt_conring_size - 1) )
+        opt_conring_size &= opt_conring_size - 1;
+    if ( opt_conring_size < conring_size )
+        return;
+    
+    ring = xmalloc_bytes(opt_conring_size);
+    if ( ring == NULL )
+    {
+        printk("Unable to allocate console ring of %u bytes.\n",
+               opt_conring_size);
+        return;
+    }
+
+    spin_lock_irq(&console_lock);
+    for ( i = conringc ; i != conringp; i++ )
+        ring[i & (opt_conring_size - 1)] = conring[i & (conring_size - 1)];
+    conring_size = opt_conring_size;
+    conring = ring;
+    spin_unlock_irq(&console_lock);
+
+    printk("Allocated console ring of %u bytes.\n", opt_conring_size);
 }
 
 void __init console_endboot(void)
diff -r cbaae05c2902 -r 81d6b5762c40 xen/include/xen/console.h
--- a/xen/include/xen/console.h Tue Apr 14 11:21:45 2009 +0100
+++ b/xen/include/xen/console.h Tue Apr 14 14:52:27 2009 +0100
@@ -14,7 +14,8 @@ struct xen_sysctl_readconsole;
 struct xen_sysctl_readconsole;
 long read_console_ring(struct xen_sysctl_readconsole *op);
 
-void init_console(void);
+void console_init_preirq(void);
+void console_init_postirq(void);
 void console_endboot(void);
 int console_has(const char *device);
 

_______________________________________________
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] New option conring_size= to allow larger console ring., Xen patchbot-unstable <=