All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: Manfred Spraul <manfred@colorfullife.com>,
	Linus Torvalds <torvalds@osdl.org>,
	viro@parcelfarce.linux.theplanet.co.uk,
	Linux Kernel list <linux-kernel@vger.kernel.org>
Subject: Re: [RFC] disable_irq()/enable_irq() semantics and ide-probe.c
Date: Thu, 09 Oct 2003 18:57:10 +0200	[thread overview]
Message-ID: <1065718629.663.3.camel@gaston> (raw)
In-Reply-To: <3F858EF8.5080105@pobox.com>

On Thu, 2003-10-09 at 18:38, Jeff Garzik wrote:
> Manfred Spraul wrote:
> > I'd like to use that for nic shutdown for natsemi:
> > 
> >    disable_irq();
> >    shutdown_nic();
> >    free_irq();
> >    enable_irq();
> 
> 
> Why not just shutdown the NIC inside spin_lock_irqsave or disable_irq, 
> and then free_irq separately?
> 
> If you can't stop the NIC hardware from generating interrupts, that's a 
> driver bug.  And if the driver cannot handle its interrupt handler 
> between the spin_unlock_irqrestore() and free_irq() (shared irq case), 
> it's also buggy.

Actually you may still get a stale irq ;) The problem is that IRQs are
typically an asynchronous event, and an irq can be sort of "queued" up
(especially if it's a level one) in the PIC... though at least this
won't be a stale level irq so you won't deadlock in an irq handler that
can do nothing...

Anyway, I quite like the idea. I've been trying to avoid taking a lock
in some similar shutdown routine for sungem, because some bits in there
need a few ms delay to workaround a chip bug (or machine sleep will
break) and I want to schedule. Breaking the lock makes things ugly,
beeing able to just disable_irq before/after is nice.

The problem of course is when that irq is shared... you are suddently
shutting off for a potentially long time a neighbour irq, bad bad...
(at least I know that on pmac, sungem irq is never shared).

Ben.
  


  reply	other threads:[~2003-10-09 16:57 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-09 16:10 [RFC] disable_irq()/enable_irq() semantics and ide-probe.c Manfred Spraul
2003-10-09 16:38 ` Jeff Garzik
2003-10-09 16:57   ` Benjamin Herrenschmidt [this message]
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
  -- strict thread matches above, loose matches on Subject: below --
2003-10-09  2:00 viro
2003-10-09  2:29 ` Linus Torvalds
2003-10-09  2:43   ` viro
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

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=1065718629.663.3.camel@gaston \
    --to=benh@kernel.crashing.org \
    --cc=jgarzik@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manfred@colorfullife.com \
    --cc=torvalds@osdl.org \
    --cc=viro@parcelfarce.linux.theplanet.co.uk \
    /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.