From: Robert Love <rml@tech9.net>
To: george anzinger <george@mvista.com>
Cc: paulus@samba.org, linux-kernel@vger.kernel.org
Subject: Re: in_interrupt race
Date: 22 Apr 2002 17:54:53 -0400 [thread overview]
Message-ID: <1019512494.1465.5.camel@phantasy> (raw)
In-Reply-To: <3CC48321.5855B08A@mvista.com>
On Mon, 2002-04-22 at 17:39, george anzinger wrote:
> Robert Love wrote:
> > Or perhaps leave the code as-is but make the rule preemption needs to be
> > disabled before calling (either implicitly or explicitly). I.e., via a
> > call to preempt_disable or because interrupts are disabled, a lock is
> > held, etc ...
>
> Right, getting a consistant flag is not much use if it isn't used within
> the same context.
Oh, wait ... someone clue me in to what I am missing, but the context
does not matter - in fact, we do not need even my fix.
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.
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.
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.
This says nothing of the CPU you may of been on, but then who cares
about it?
Robert Love
next prev parent reply other threads:[~2002-04-22 21:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-04-20 10:27 in_interrupt race Paul Mackerras
2002-04-22 19:02 ` Robert Love
2002-04-22 21:39 ` george anzinger
2002-04-22 21:54 ` Robert Love [this message]
2002-04-22 23:06 ` Paul Mackerras
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=1019512494.1465.5.camel@phantasy \
--to=rml@tech9.net \
--cc=george@mvista.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paulus@samba.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