public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arjan van de Ven <arjan@infradead.org>
To: Andrey Borzenkov <arvidjaar@mail.ru>
Cc: Oliver Neukum <oliver@neukum.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: when spin_lock_irq (as opposed to spin_lock_irqsave) is appropriate?
Date: Sun, 12 Oct 2008 19:12:11 -0400	[thread overview]
Message-ID: <20081012191211.0327110f@infradead.org> (raw)
In-Reply-To: <200810121548.05644.arvidjaar@mail.ru>

On Sun, 12 Oct 2008 15:48:00 +0400
Andrey Borzenkov <arvidjaar@mail.ru> wrote:

> On Saturday 11 October 2008, Arjan van de Ven wrote:
> [... very useful explanation omitted ...]
> > Does this answer your question?
> > 
> 
> As Oliver pointed out, part of confusion wa my asumption that _irqsave
> verion saves actual interrupt mask. It actually does not.
> 
> This leaves me with a question - how can I know whether interrupts may
> (not) be disabled at particular point? 

the _irq versions mask the interrupts in the *cpu*!
Not in the hw.
All CPUs have a flag that says "don't give me interrupts right now
please", and the spin_lock_irq(save) functions work on that flag.
And they block all interrupts (except NMI's, which are very special)

> In particular, is it safe to 
> assume that any place marked at "code may sleep" has interrupts
> enabled?

yes.
That's a good rule of thumb ;-)
Anything else is a lot of "depends"



-- 
Arjan van de Ven 	Intel Open Source Technology Centre
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org

      parent reply	other threads:[~2008-10-12 23:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-11 15:29 when spin_lock_irq (as opposed to spin_lock_irqsave) is appropriate? Andrey Borzenkov
2008-10-11 15:41 ` Oliver Neukum
2008-10-11 15:55   ` Andrey Borzenkov
2008-10-12  8:08     ` Oliver Neukum
2008-10-11 16:18 ` Arjan van de Ven
2008-10-12 11:48   ` Andrey Borzenkov
2008-10-12 22:21     ` Arnd Bergmann
2008-10-12 23:12     ` Arjan van de Ven [this message]

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=20081012191211.0327110f@infradead.org \
    --to=arjan@infradead.org \
    --cc=arvidjaar@mail.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oliver@neukum.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