2.6.33.2-rt13: RFC: fix serial console
Hi
We've found that serial console stops showing printk messages after system boot completes. Kernel 2.6.33.2-rt13, 32-bit x86.
After some analysis, I found that output is blocked by console_atomic_safe() macro
#ifdef CONFIG_PREEMPT_RT
# define console_atomic_safe(con) \ (((con)->flags & CON_ATOMIC) || \ (!in_atomic() && !irqs_disabled()) || \ (system_state != SYSTEM_RUNNING) || \ oops_in_progress) #else # define console_atomic_safe(con) (1) #endif
After adding CON_ATOMIC flag to 8250 console, I got serial console working again.
drivers/serial/8250.c +1 -1
@@ -2814,7 +2814,7 @@ static struct console serial8250_console = { .device = uart_console_device, .setup = serial8250_console_setup, .early_setup = serial8250_console_early_setup, - .flags = CON_PRINTBUFFER, + .flags = CON_PRINTBUFFER | CON_ATOMIC, .index = -1, .data = &serial8250_reg, };
Although I believe this patch is correct (serial8250_console_write() looks safe against calls in atomic context), it is unclear for me why this helped.console_atomic_safe() should return 1 if printk was called from non-atomic context. However, no printk showed anything in serial - including printk() from module init routine, which is definitly not in atomic context. So there is likely a bug elsewhere.
Any comments?