public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: David Howells <dhowells@redhat.com>
Cc: torvalds@osdl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Provide better printk() support for SMP machines
Date: Tue, 5 Jul 2005 14:29:58 -0700	[thread overview]
Message-ID: <20050705142958.4075c5a7.akpm@osdl.org> (raw)
In-Reply-To: <1491.1120594224@warthog.cambridge.redhat.com>

David Howells <dhowells@redhat.com> wrote:
>
>  The attached patch prevents oopses interleaving with characters from other
>  printks on other machines by only zapping the locks if the oops is happening
>  on the machine holding the lock.

(s/machine/CPU/)

hm, I guess it adds a theoretical deadlock if some other CPU is in the
middle of printk and is trying to take some_lock and this CPU takes an oops
while holding some_lock.  Probably that's an acceptable tradeoff though.

>  --- linux-2.6.12-mm1/kernel/printk.c	2005-06-22 13:54:08.000000000 +0100
>  +++ linux-2.6.12-mm1-cachefs-wander/kernel/printk.c	2005-06-22 13:57:02.000000000 +0100
>  @@ -514,6 +514,9 @@ asmlinkage int printk(const char *fmt, .
>   	return r;
>   }
>   
>  +/* cpu currently holding logbuf_lock */
>  +static volatile int printk_cpu = -1;
>  +

Does this guy really need to be volatile?  Coud we use atomic_t and lose
that wmb()?

>   asmlinkage int vprintk(const char *fmt, va_list args)
>   {
>   	unsigned long flags;
>  @@ -522,11 +525,15 @@ asmlinkage int vprintk(const char *fmt, 
>   	static char printk_buf[1024];
>   	static int log_level_unknown = 1;
>   
>  -	if (unlikely(oops_in_progress))
>  +	if (unlikely(oops_in_progress) && printk_cpu == smp_processor_id())
>  +		/* If a crash is occurring during printk() on this CPU,
>  +		 * make sure we can't deadlock */

Methinks this should be raw_smp_processor_id().

  reply	other threads:[~2005-07-05 21:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-05 20:10 [PATCH] Provide better printk() support for SMP machines David Howells
2005-07-05 21:29 ` Andrew Morton [this message]
2005-07-08 12:29   ` David Howells
2005-07-08 12:36 ` [PATCH] Provide better printk() support for SMP machines [try #2] David Howells
2005-07-08 13:12   ` Lars Marowsky-Bree

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=20050705142958.4075c5a7.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=dhowells@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox