From: Paul Mackerras <paulus@samba.org>
To: Robert Love <rml@tech9.net>
Cc: george anzinger <george@mvista.com>, linux-kernel@vger.kernel.org
Subject: Re: in_interrupt race
Date: Tue, 23 Apr 2002 09:06:31 +1000 (EST) [thread overview]
Message-ID: <15556.38775.439624.762586@argo.ozlabs.ibm.com> (raw)
In-Reply-To: <1019512494.1465.5.camel@phantasy>
Robert Love writes:
> We have two cases:
>
> (a) we are in an interrupt or softirq,
> (b) we are not in an interrupt or softirq.
>
> If (a), we are not preemptible and thus do _not_ need explicit
> preemption disabling.
True.
> If (b) we are preemptible, and then it does not matter what happens
> during this check, since we are not preemptible and the check won't
> return a false true.
Huh? First you say we are preemptible, then you say we are not, in
the same sentence?
> Now, if we are actually using in_interrupt() as "is this exact CPU
> processing an interrupt?" we may not get what we want (because we could
> end up on CPU#2 from #1, and now #1 is indeed in an interrupt). But
> that is rarely (if ever?) the point of the call.
>
> The majority, if not all, uses of in_interrupt is to see if you entered
> the current code from an interrupt. Like in schedule, "did we enter
> this function off an interrupt?" Thus, with or without preemption:
>
> if (in_interrupt())
> /* yep! */
>
> will _always_ return false if your current CPU is not in an interrupt.
No. The point is that in_interrupt() asks two separate questions:
(1) which cpu are we on? (2) is that cpu in interrupt context?
If we switch cpus between (1) and (2) then we can get a false positive
from in_interrupt().
> This says nothing of the CPU you may of been on, but then who cares
> about it?
We don't care about any cpu, what we want to know is whether the
current thread of execution is in process context or not. Which is
why it is bogus for in_interrupt to need to ask which cpu we are on,
and why the local_bh_count and local_irq_count should go in the
thread_info struct IMHO. I am working on that now. :)
Paul.
next prev parent reply other threads:[~2002-04-22 23:08 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-04-20 10:27 Paul Mackerras
2002-04-22 19:02 ` Robert Love
2002-04-22 21:39 ` george anzinger
2002-04-22 21:54 ` Robert Love
2002-04-22 23:06 ` Paul Mackerras [this message]
2002-04-22 23:15 ` Robert Love
2002-04-23 3:25 ` Rusty Russell
2002-04-23 8:31 ` Russell King
2002-04-24 4:43 ` Rusty Russell
2002-04-22 23:22 ` Paul Mackerras
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=15556.38775.439624.762586@argo.ozlabs.ibm.com \
--to=paulus@samba.org \
--cc=george@mvista.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rml@tech9.net \
/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
all inboxes | Powered by JetHome®