From: David Howells The attached patch stops printk's issued on different processors from becoming char-by-char interleaved whilst one of them is oopsing. kernel/printk.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff -puN kernel/printk.c~printk-oops-mangle-fix kernel/printk.c --- 25/kernel/printk.c~printk-oops-mangle-fix 2003-06-29 00:06:29.000000000 -0700 +++ 25-akpm/kernel/printk.c 2003-06-29 00:06:29.000000000 -0700 @@ -399,9 +399,13 @@ asmlinkage int printk(const char *fmt, . char *p; static char printk_buf[1024]; static int log_level_unknown = 1; + static int printk_cpu = -1; - if (oops_in_progress) { - /* If a crash is occurring, make sure we can't deadlock */ + if (oops_in_progress && printk_cpu == smp_processor_id()) { + /* + * If a crash is occurring during printk() on this CPU, make + * sure we can't deadlock + */ spin_lock_init(&logbuf_lock); /* And make sure that we print immediately */ init_MUTEX(&console_sem); @@ -409,6 +413,7 @@ asmlinkage int printk(const char *fmt, . /* This stops the holder of console_sem just where we want him */ spin_lock_irqsave(&logbuf_lock, flags); + printk_cpu = smp_processor_id(); /* Emit the output into the temporary buffer */ va_start(args, fmt); _