public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Robert Love <rml@tech9.net>
To: Ingo Molnar <mingo@elte.hu>
Cc: george anzinger <george@mvista.com>,
	Zwane Mwaikambo <zwane@linuxpower.ca>,
	Trond Myklebust <trond.myklebust@fys.uio.no>,
	Linus Torvalds <torvalds@transmeta.com>,
	Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [patch] irqlock patch -G3. [was Re: odd memory corruption in 2.5.27?]
Date: 23 Jul 2002 18:08:17 -0700	[thread overview]
Message-ID: <1027472897.927.247.camel@sinai> (raw)
In-Reply-To: <Pine.LNX.4.44.0207240100150.2732-100000@localhost.localdomain>

On Tue, 2002-07-23 at 16:28, Ingo Molnar wrote:

> this is most definitely not the correct fix ...
> 
> i'm quite convinced that the fix is to avoid illegal preemption, not to
> work it around.

I am not sure I am fully convinced one way or the other, but treating
every bit of code as we find it scares me.  The fact is, if a
spin_unlock() can magically reenable interrupts that is a bug.

I don't like relying on chance and the possibility your debug tool found
the problem... but at the same time, Ingo's solution is a lot cleaner.

Linus, Ingo, comments?

Attached is the patch George mentioned, against 2.5.27.

	Robert Love

diff -urN linux-2.5.27/include/asm-i386/system.h linux/include/asm-i386/system.h
--- linux-2.5.27/include/asm-i386/system.h	Sat Jul 20 12:11:05 2002
+++ linux/include/asm-i386/system.h	Tue Jul 23 18:03:47 2002
@@ -270,6 +270,13 @@
 /* Compiling for a 386 proper.	Is it worth implementing via cli/sti?  */
 #endif
 
+#define MASK_IF			0x200
+#define interrupts_enabled()	({ \
+		int flg; \
+		__save_flags(flg); \
+		flg & MASK_IF; \
+})
+
 /*
  * Force strict CPU ordering.
  * And yes, this is required on UP too when we're talking
diff -urN linux-2.5.27/kernel/sched.c linux/kernel/sched.c
--- linux-2.5.27/kernel/sched.c	Sat Jul 20 12:11:11 2002
+++ linux/kernel/sched.c	Tue Jul 23 18:02:13 2002
@@ -899,7 +899,7 @@
 {
 	struct thread_info *ti = current_thread_info();
 
-	if (unlikely(ti->preempt_count))
+	if (unlikely(ti->preempt_count || !interrupts_enabled()))
 		return;
 
 need_resched:


  parent reply	other threads:[~2002-07-24  1:05 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-23  6:23 odd memory corruption in 2.5.27? Zwane Mwaikambo
2002-07-23  6:24 ` Zwane Mwaikambo
2002-07-23  6:26   ` Zwane Mwaikambo
2002-07-23  7:57     ` Trond Myklebust
2002-07-23  8:54       ` Zwane Mwaikambo
2002-07-23 20:32         ` george anzinger
2002-07-23 20:47           ` William Lee Irwin III
2002-07-23 23:28           ` [patch] irqlock patch -G3. [was Re: odd memory corruption in 2.5.27?] Ingo Molnar
2002-07-23 23:53             ` george anzinger
2002-07-23 23:56             ` Linus Torvalds
2002-07-24  0:07               ` Ingo Molnar
2002-07-24  2:15                 ` Linus Torvalds
2002-07-24  8:59                   ` [patch] irqlock patch 2.5.27-H3 Ingo Molnar
2002-07-24  1:08             ` Robert Love [this message]
2002-07-24  3:13               ` [patch] irqlock patch -G3. [was Re: odd memory corruption in2.5.27?] Andrew Morton
2002-07-24  3:18                 ` Linus Torvalds
2002-07-24  7:13                   ` Ingo Molnar
2002-07-24  7:34                 ` Ingo Molnar
2002-07-24  8:00                   ` [patch] irqlock patch -G3. [was Re: odd memory corruptionin2.5.27?] Andrew Morton
2002-07-24  7:54                     ` Ingo Molnar
2002-07-24  8:03                     ` William Lee Irwin III
2002-07-24  8:06                       ` Ingo Molnar
2002-07-24  8:15                         ` William Lee Irwin III
2002-07-24  8:17                           ` Ingo Molnar
2002-07-24 16:40                     ` Linus Torvalds
2002-07-24 16:49                       ` Robert Love
2002-07-24 20:56                         ` [patch] irqlock patch -G3. [was Re: odd memorycorruptionin2.5.27?] george anzinger
2002-07-24  7:37                 ` [patch] irqlock patch -G3. [was Re: odd memory corruption in2.5.27?] Ingo Molnar
2002-07-24  6:52           ` odd memory corruption in 2.5.27? Zwane Mwaikambo

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=1027472897.927.247.camel@sinai \
    --to=rml@tech9.net \
    --cc=george@mvista.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=torvalds@transmeta.com \
    --cc=trond.myklebust@fys.uio.no \
    --cc=zwane@linuxpower.ca \
    /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