Re: overlaping printk

From: Andrew Morton
Date: Fri May 21 2004 - 18:55:30 EST


Ricky Beam <jfbeam@xxxxxxxxxxxxxx> wrote:
>
> Can anyone explain why the kernel does this on a serial console:
>
> C<PU0 >C2P:U M 3a:ch Mianech iCnhee cCk heExckc epEtxcieopnt: i0o0n0: 0000000000
> 0000000000000040

<looks>

<after three years, penny finally drops>

We bust the spinlock for *every* printk call. No wonder.


diff -puN kernel/printk.c~printk-mangling-fix kernel/printk.c
--- 25/kernel/printk.c~printk-mangling-fix 2004-05-20 00:20:06.388725128 -0700
+++ 25-akpm/kernel/printk.c 2004-05-20 00:20:27.228556992 -0700
@@ -492,8 +492,10 @@ asmlinkage int printk(const char *fmt, .
char *p;
static char printk_buf[1024];
static int log_level_unknown = 1;
+ static int once;

- if (oops_in_progress) {
+ if (oops_in_progress && !once) {
+ once = 1;
/* If a crash is occurring, make sure we can't deadlock */
spin_lock_init(&logbuf_lock);
/* And make sure that we print immediately */

_

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/