From: viro@parcelfarce.linux.theplanet.co.uk
To: Linus Torvalds <torvalds@osdl.org>
Cc: linux-kernel@vger.kernel.org,
Marcelo Tosatti <marcelo.tosatti@cyclades.com>,
Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl>
Subject: Re: [RFC] disable_irq()/enable_irq() semantics and ide-probe.c
Date: Thu, 9 Oct 2003 03:43:34 +0100 [thread overview]
Message-ID: <20031009024334.GA7665@parcelfarce.linux.theplanet.co.uk> (raw)
In-Reply-To: <Pine.LNX.4.44.0310081904330.2721-100000@home.osdl.org>
On Wed, Oct 08, 2003 at 07:29:10PM -0700, Linus Torvalds wrote:
> > If an interrupt comes during that
> > time, we'll get IRQ_INPROGRESS set and not reset until later register_irq()
> > (see handle_irq() for details). Note that calling disable_irq() after that
> > will kill us on SMP - it will spin waiting for IRQ_INPROGRESS to go away.
>
> Now _this_ is a bug waiting to happen. I don't think it actually happens
> now (since anybody who does disable_irq() _will_ either have registered
> the irq already or will do so soon, but I agree that it's just trouble
> waiting to happen.
Ummm... probe_hwif() is a good example of the opposite - it can fail
past the point where it disables irq and that means no register_irq()
after enable_irq() call on cleanup.
> I think the fix to that is to just add a trivial test for "if the handler
> list is empty, don't bother synchronizing" in disable_irq(), since clearly
> if the list is empty there is nothing to synchronize _with_. After all,
> the synchronization is there just to make sure no handler runs
> concurrently on another CPU.
How about
action = NULL;
if (!(status & (IRQ_DISABLED | IRQ_INPROGRESS))) {
action = desc->action;
status &= ~IRQ_PENDING; /* we commit to handling */
if (likely(action))
status |= IRQ_INPROGRESS; /* we are handling it */
}
desc->status = status;
in handle_irq()?
> As far as I can tell, 2.6.x is doing all the right things. Modulo the (not
> really supported) concurrent device probing, and the (not implemented)
> atomic irq requesting.
>
> Note that the IRQ_INPROGRESS thing was literally the bit that autodetect
> used to test, it got changed it to IRQ_WAITING to clarify the code and
> avoid bad interactions with the other uses of IRQ_INPROGRESS.
>
> And note that we do _not_ clear IRQ_INPROGRESS on "action == NULL" very
> much on purpose: that "action == NULL" thing also happens if the IRQ is
> disabled, and we need to get the edge replay right. This is why
> request_irq() literally _needs_ to clear that bit in 2.6.x.
See above - we shouldn't clear it on action == NULL, but we don't
need to set it, AFAICS.
> So the fix is to make 2.4.x do what 2.6.x does, methinks.
ObOtherFun: There's another bogosity in quoted ide-probe.c code, according
to dwmw2 - he says that there are PCI IDE cards that get IRQ 0, so the
test for hwif->irq is b0rken. We probably should stop overloading
->irq == 0 for "none given", but I'm not sure that we *have* a value
that would never be used as an IRQ number on all platforms...
next prev parent reply other threads:[~2003-10-09 2:43 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-09 2:00 [RFC] disable_irq()/enable_irq() semantics and ide-probe.c viro
2003-10-09 2:29 ` Linus Torvalds
2003-10-09 2:43 ` viro [this message]
2003-10-09 2:53 ` Linus Torvalds
2003-10-09 8:03 ` Russell King
2003-10-09 22:46 ` Zwane Mwaikambo
2003-10-09 8:07 ` Benjamin Herrenschmidt
2003-10-09 15:46 ` viro
2003-10-09 16:01 ` Linus Torvalds
2003-10-09 17:46 ` viro
2003-10-09 18:03 ` Linus Torvalds
2003-10-09 18:27 ` viro
2003-10-09 19:05 ` Linus Torvalds
2003-10-15 17:14 ` Anton Blanchard
2003-10-17 9:19 ` Russell King
2003-10-17 10:32 ` Benjamin Herrenschmidt
2003-10-09 12:55 ` Roman Zippel
-- strict thread matches above, loose matches on Subject: below --
2003-10-09 16:10 Manfred Spraul
2003-10-09 16:38 ` Jeff Garzik
2003-10-09 16:57 ` Benjamin Herrenschmidt
2003-10-09 17:03 ` Jeff Garzik
2003-10-09 17:07 ` Benjamin Herrenschmidt
2003-10-09 17:16 ` Jeff Garzik
2003-10-09 17:29 ` Linus Torvalds
2003-10-09 17:52 ` Jeff Garzik
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=20031009024334.GA7665@parcelfarce.linux.theplanet.co.uk \
--to=viro@parcelfarce.linux.theplanet.co.uk \
--cc=B.Zolnierkiewicz@elka.pw.edu.pl \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.tosatti@cyclades.com \
--cc=torvalds@osdl.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 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.