All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] disentangle printk's whilst oopsing on SMP
Date: Tue, 17 Jun 2003 15:36:43 +0100	[thread overview]
Message-ID: <6452.1055860603@warthog.warthog> (raw)


Hi Linus,

The attached patch stops printk's issued on different processors from becoming
char-by-char interleaved whilst one of them is oopsing.

David

diff -uNr linux-2.5.72/kernel/printk.c linux-2.5.72-auto/kernel/printk.c
--- linux-2.5.72/kernel/printk.c	2003-06-17 15:01:58.000000000 +0100
+++ linux-2.5.72-auto/kernel/printk.c	2003-06-17 15:06:31.000000000 +0100
@@ -373,6 +373,9 @@
 		logged_chars++;
 }
 
+/* cpu currently holding logbuf_lock */
+static volatile int printk_cpu = -1;
+
 /*
  * This is printk.  It can be called from any context.  We want it to work.
  * 
@@ -395,8 +398,9 @@
 	static char printk_buf[1024];
 	static int log_level_unknown = 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);
@@ -404,6 +408,7 @@
 
 	/* 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);

                 reply	other threads:[~2003-06-17 14:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6452.1055860603@warthog.warthog \
    --to=dhowells@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.