Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
DISCONTINUED:openSUSE:11.1:Update
xen
19543-conring-size-param.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 19543-conring-size-param.patch of Package xen
# HG changeset patch # User Keir Fraser <keir.fraser@citrix.com> # Date 1239717147 -3600 # Node ID 81d6b5762c4036965f4e92b226a93e6c0925bd92 # Parent cbaae05c2902739b789b8aa21ddedd0bdbb1ebb0 New option conring_size= to allow larger console ring. Signed-off-by: Keir Fraser <keir.fraser@citrix.com> # HG changeset patch # User Keir Fraser <keir.fraser@citrix.com> # Date 1251708665 -3600 # Node ID bff9f3e5ad940845a02702558129e5db815f1fd5 # Parent eae7b5ee789738528dac5c309aabd6e316005e0f Adjust non-default sized console ring allocation Using xmalloc() for objects that are guaranteed to be at least as large as a page is wasteful, as it will always result in more (here: double the amount) being allocated. The other adjustments are more cosmetic: - Updating conring and conring_size can be done so NMI/MCE generated messages don't use the new (larger) size with the old (smaller) buffer. - The size printed can be in KiB (for the value to be easier to grasp) since it is always a multiple of the default of 16KiB. Signed-off-by: Jan Beulich <jbeulich@novell.com> --- a/xen/arch/ia64/xen/xensetup.c +++ b/xen/arch/ia64/xen/xensetup.c @@ -388,7 +388,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 */ @@ -404,7 +403,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) { @@ -668,7 +667,7 @@ printk("num_online_cpus=%d, max_cpus=%d\ ns16550_init(0, &ns16550_com1); } } - serial_init_postirq(); + console_init_postirq(); } expose_p2m_init(); --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -464,9 +464,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); @@ -960,7 +958,7 @@ void __init __start_xen(unsigned long mb initialize_keytable(); - serial_init_postirq(); + console_init_postirq(); BUG_ON(!local_irq_is_enabled()); --- a/xen/drivers/char/console.c +++ b/xen/drivers/char/console.c @@ -58,10 +58,16 @@ boolean_param("console_to_ring", opt_con 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,10 +550,12 @@ 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, ',') ) { @@ -587,6 +595,38 @@ void __init init_console(void) } } +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 = alloc_xenheap_pages(get_order_from_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 = ring; + wmb(); /* Allow users of console_force_unlock() to see larger buffer. */ + conring_size = opt_conring_size; + spin_unlock_irq(&console_lock); + + printk("Allocated console ring of %u KiB.\n", opt_conring_size >> 10); +} + void __init console_endboot(void) { int i, j; --- a/xen/include/xen/console.h +++ b/xen/include/xen/console.h @@ -14,7 +14,8 @@ 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);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor