All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Love <rml@tech9.net>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Andrew Morton <akpm@zip.com.au>, Ingo Molnar <mingo@elte.hu>,
	george anzinger <george@mvista.com>,
	Zwane Mwaikambo <zwane@linuxpower.ca>,
	Trond Myklebust <trond.myklebust@fys.uio.no>,
	Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [patch] irqlock patch -G3. [was Re: odd memory corruptionin2.5.27?]
Date: 24 Jul 2002 09:49:20 -0700	[thread overview]
Message-ID: <1027529360.3581.1213.camel@sinai> (raw)
In-Reply-To: <Pine.LNX.4.44.0207240927370.15114-100000@home.transmeta.com>

On Wed, 2002-07-24 at 09:40, Linus Torvalds wrote:

> Just as an example, in the not too distant future what _will_ happen is
> that
> 
> 	spin_lock_irqsave()
> 	..
> 	spin_unlock_irqrestore()
> 
> will not necessarily increment the preemtion count. Why should they?
> They've disabled local interrupts, so there's no preemption to protect
> against. That's just an _obvious_ optimization.

So obvious it is even in my queue :)

I do not think we are ready yet - there is just way too much code that
does not pair up as you mention... but I have played with the patch and
some debugging to see just how feasible it is.  Fairly soon.

Note that other preemptible kernels (IRIX and BeOS, for example) do not
even have a preemption count -- all spinlocks also disable interrupts. 
Not that I am suggesting that, I am very fond of our preempt_count
mechanism, but its a point to consider even if it were feasible (e.g. we
did not have spinlocks held for hundreds of milliseconds).

> We can easily add a debugging check to spin_unlock() that says:
> 
> 	/* Somebody messed up, doesn't hold any other preemption thing
> 	 * than this lock that is now getting released, and has interrupts
> 	 * disabled
> 	 */
> 	BUG_ON(preempt_count() == 1 && interrupts_enabled())
> 
> No?

Pretty similar to the debugging I played with... as long as it goes away
eventually (who wants this in their unlock path?) we certainly should
add it at some point.

	Robert Love



  reply	other threads:[~2002-07-24 16:46 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             ` [patch] irqlock patch -G3. [was Re: odd memory corruption in 2.5.27?] Robert Love
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 [this message]
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=1027529360.3581.1213.camel@sinai \
    --to=rml@tech9.net \
    --cc=akpm@zip.com.au \
    --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 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.