mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
xen/console: introduce conring_flush()
Introduce conring_flush() to ensure all messages kept in the internal console ring are sent to all physical consoles (serial, VGA (x86)) after their initialization is completed. Rename dump_console_ring_key to conring_dump_keyhandler to match the notation for conring management symbols. Resolves: https://gitlab.com/xen-project/xen/-/issues/184 Signed-off-by: Denis Mukhin <dmukhin@ford.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
This commit is contained in:
1 parent
77f70275fd
commit
f6d1bfa160
1 file changed
+21
-10
+21
-10
@@ -452,23 +452,19 @@ void console_serial_puts(const char *s, size_t nr)
|
||||
serial_puts(sercon_handle, s, nr);
|
||||
}
|
||||
|
||||
static void cf_check dump_console_ring_key(unsigned char key)
|
||||
/*
|
||||
* Flush contents of the conring to the physical console devices.
|
||||
*/
|
||||
static int conring_flush(void)
|
||||
{
|
||||
uint32_t idx, len, sofar, c;
|
||||
unsigned int order;
|
||||
char *buf;
|
||||
|
||||
printk("'%c' pressed -> dumping console ring buffer (dmesg)\n", key);
|
||||
|
||||
/* create a buffer in which we'll copy the ring in the correct
|
||||
order and NUL terminate */
|
||||
order = get_order_from_bytes(conring_size + 1);
|
||||
buf = alloc_xenheap_pages(order, 0);
|
||||
if ( buf == NULL )
|
||||
{
|
||||
printk("unable to allocate memory!\n");
|
||||
return;
|
||||
}
|
||||
return -ENOMEM;
|
||||
|
||||
c = conringc;
|
||||
sofar = 0;
|
||||
@@ -486,6 +482,18 @@ static void cf_check dump_console_ring_key(unsigned char key)
|
||||
console_send(buf, sofar, CONSOLE_SERIAL | CONSOLE_VIDEO | CONSOLE_PV);
|
||||
|
||||
free_xenheap_pages(buf, order);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void cf_check conring_dump_keyhandler(unsigned char key)
|
||||
{
|
||||
int rc;
|
||||
|
||||
printk("'%c' pressed -> dumping console ring buffer (dmesg)\n", key);
|
||||
rc = conring_flush();
|
||||
if ( rc )
|
||||
printk("failed to dump console ring buffer: %d\n", rc);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1060,6 +1068,9 @@ void __init console_init_preirq(void)
|
||||
serial_set_rx_handler(sercon_handle, serial_rx);
|
||||
pv_console_set_rx_handler(serial_rx);
|
||||
|
||||
/* NB: send conring contents to all enabled physical consoles, if any */
|
||||
conring_flush();
|
||||
|
||||
/* HELLO WORLD --- start-of-day banner text. */
|
||||
nrspin_lock(&console_lock);
|
||||
__putstr(xen_banner());
|
||||
@@ -1150,7 +1161,7 @@ void __init console_endboot(void)
|
||||
if ( opt_conswitch[1] == 'x' )
|
||||
console_rx = max_console_rx;
|
||||
|
||||
register_keyhandler('w', dump_console_ring_key,
|
||||
register_keyhandler('w', conring_dump_keyhandler,
|
||||
"synchronously dump console ring buffer (dmesg)", 0);
|
||||
register_irq_keyhandler('+', &do_inc_thresh,
|
||||
"increase log level threshold", 0);
|
||||
|
||||