The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: trond.myklebust@fys.uio.no, tglx@linutronix.de, mingo@redhat.com,
	hpa@zytor.com, linux-kernel@vger.kernel.org
Subject: Re: Linux 2.6.24-rc5 x86 architecture no longer Oopses...
Date: Fri, 21 Dec 2007 01:30:35 +0100	[thread overview]
Message-ID: <20071221003035.GA10123@elte.hu> (raw)
In-Reply-To: <20071220161934.0f55029a.akpm@linux-foundation.org>


* Andrew Morton <akpm@linux-foundation.org> wrote:

> On Fri, 21 Dec 2007 00:47:59 +0100
> Ingo Molnar <mingo@elte.hu> wrote:
> 
> > >  		__raw_spin_lock(&die.lock);
> > >  		raw_local_save_flags(flags);
> > > -		die.lock_owner = smp_processor_id();
> > > +		die.lock_owner = raw_smp_processor_id();
> > 
> > we just disabled irqs with raw_local_save_flags().
> 
> <chases x86 spaghetti for a while>
> 
> raw_local_save_flags() doesn't disable interrupts?

argh. Indeed! (I wanted us to fix that misleading name eons ago, to 
*_save_flags_only(), but some stupid bikeshed painting discussion 
prevented it from ever happening.)

that should have been raw_local_irq_save(flags)!

but ... why is it done like that? Why do we first take the die.lock and 
disable interrupts afterwards? It's highly weird. 64-bit does it all 
correctly in traps_64.c, so unification will help us out - but so far 
perhaps the patch below we should do in 2.6.24?

	Ingo

------------>
Subject: x86: fix die() to not be preemptible
From: Ingo Molnar <mingo@elte.hu>

Andrew "Eagle Eye" Morton noticed that we use raw_local_save_flags()
instead of raw_local_irq_save(flags) in die().

do it correctly - and first disable interrupts, then take the spinlock.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/traps_32.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Index: linux-x86.q/arch/x86/kernel/traps_32.c
===================================================================
--- linux-x86.q.orig/arch/x86/kernel/traps_32.c
+++ linux-x86.q/arch/x86/kernel/traps_32.c
@@ -373,14 +373,13 @@ void die(const char * str, struct pt_reg
 
 	if (die.lock_owner != raw_smp_processor_id()) {
 		console_verbose();
+		raw_local_irq_save(flags);
 		__raw_spin_lock(&die.lock);
-		raw_local_save_flags(flags);
 		die.lock_owner = smp_processor_id();
 		die.lock_owner_depth = 0;
 		bust_spinlocks(1);
-	}
-	else
-		raw_local_save_flags(flags);
+	} else
+		raw_local_irq_save(flags);
 
 	if (++die.lock_owner_depth < 3) {
 		unsigned long esp;

  reply	other threads:[~2007-12-21  0:31 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-20 22:40 Linux 2.6.24-rc5 x86 architecture no longer Oopses Trond Myklebust
2007-12-20 22:54 ` Andrew Morton
2007-12-20 22:56   ` Andrew Morton
2007-12-20 23:06     ` Trond Myklebust
2007-12-21  0:55     ` Rafael J. Wysocki
2007-12-21 10:19       ` Ingo Molnar
2007-12-20 23:04   ` Trond Myklebust
2007-12-20 23:47   ` Ingo Molnar
2007-12-21  0:02     ` Andrew Morton
2007-12-21  0:05       ` Ingo Molnar
2007-12-21  0:19     ` Andrew Morton
2007-12-21  0:30       ` Ingo Molnar [this message]
2007-12-21  0:40         ` Andrew Morton
2007-12-21  0:44           ` Ingo Molnar
2007-12-21 10:27           ` Ingo Molnar
2007-12-21 10:42             ` Andrew Morton
2007-12-21 11:12               ` Ingo Molnar
2007-12-21 11:34                 ` Andrew Morton
2007-12-21 12:31                   ` Ingo Molnar

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=20071221003035.GA10123@elte.hu \
    --to=mingo@elte.hu \
    --cc=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=trond.myklebust@fys.uio.no \
    /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