All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Walker <dwalker@mvista.com>
To: Andi Kleen <ak@suse.de>
Cc: mingo@elte.hu, Thomas Gleixner <tglx@linutronix.de>,
	linux-rt-users@vger.kernel.org
Subject: Re: [PATCH] Don't sleep in oops_begin()
Date: Mon, 17 Sep 2007 11:28:32 -0700	[thread overview]
Message-ID: <1190053712.3253.79.camel@imap.mvista.com> (raw)
In-Reply-To: <200709172012.21102.ak@suse.de>

On Mon, 2007-09-17 at 20:12 +0200, Andi Kleen wrote:
> When the kernel is oopsing no realtime guarantees are needed anymore and sleeping
> here is unsafe; e.g. in case the crash site had interrupts disabled.
> 
> - Convert die_lock to a raw spinlock
> - Really disable interrupts
> 
> Signed-off-by: Andi Kleen <ak@suse.de>
> 
> Index: linux-2.6.23-rc4-rt1/arch/x86_64/kernel/traps.c
> ===================================================================
> --- linux-2.6.23-rc4-rt1.orig/arch/x86_64/kernel/traps.c
> +++ linux-2.6.23-rc4-rt1/arch/x86_64/kernel/traps.c
> @@ -467,7 +467,7 @@ void out_of_line_bug(void)
>  EXPORT_SYMBOL(out_of_line_bug);
>  #endif
>  
> -static DEFINE_SPINLOCK(die_lock);
> +static __raw_spinlock_t die_lock = __RAW_SPIN_LOCK_UNLOCKED;

You mean DEFINE_RAW_SPINLOCK() maybe? Unless I'm not following what your
doing here..

>  static int die_owner = -1;
>  static unsigned int die_nest_count;
>  
> @@ -479,13 +479,13 @@ unsigned __kprobes long oops_begin(void)
>  	oops_enter();
>  
>  	/* racy, but better than risking deadlock. */
> -	local_irq_save(flags);
> +	raw_local_irq_save(flags);

local_irq_save() should disable interrupts .. The difference between the
two is one does interrupt off trace accounting 

>  	cpu = smp_processor_id();
> -	if (!spin_trylock(&die_lock)) { 
> +	if (!__raw_spin_trylock(&die_lock)) {

If you use DEFINE_RAW_SPINLOCK() above you shouldn't need to mod these
individually .. A call to spin_trylock() will automatically change
depending on the lock type.

Daniel

  reply	other threads:[~2007-09-17 18:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-17 18:12 [PATCH] Don't sleep in oops_begin() Andi Kleen
2007-09-17 18:28 ` Daniel Walker [this message]
2007-09-17 18:46   ` Andi Kleen
2007-09-17 18:54     ` Daniel Walker
2007-09-17 19:00       ` Andi Kleen
2007-09-17 19:07         ` Daniel Walker
2007-09-17 19:38           ` Sven-Thorsten Dietrich
2007-09-17 20:20             ` Andi Kleen
2007-09-17 20:30               ` Sven-Thorsten Dietrich
2007-09-18  0:10               ` Daniel Walker
2007-09-18  8:05                 ` Andi Kleen
2007-09-18  8:30                   ` Thomas Gleixner
2007-09-17 23:13             ` Gregory Haskins

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=1190053712.3253.79.camel@imap.mvista.com \
    --to=dwalker@mvista.com \
    --cc=ak@suse.de \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    /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.