From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Adam Belay <abelay@novell.com>
Cc: Linus Torvalds <torvalds@osdl.org>, Karsten Keil <kkeil@suse.de>,
Andrew Morton <akpm@osdl.org>, Jeff Garzik <jgarzik@pobox.com>,
Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] fix tulip suspend/resume
Date: Tue, 07 Jun 2005 15:50:57 +1000 [thread overview]
Message-ID: <1118123457.6850.64.camel@gaston> (raw)
In-Reply-To: <1118122469.3245.62.camel@localhost.localdomain>
>
> I think unregistering the handler is the equivalent and easier to get
> right. Otherwise, the driver developer needs to check a flag in the
> interrupt handler to see if the device is sleeping, and if it is then
> return IRQ_NONE. Both options would work fine, but I don't see a race
> condition with free_irq().
You still need to disable IRQs on chip tho before you free_irq or you'll
put other devices sharing your interrupt in real pain in case your hw
accidentally emits one :)
> > To not be racy, the best is to synchronize though. Something like this
> > pseudo code:
> >
> > suspend():
> >
> > 1) chip_disable_irq(); /* disable emission of IRQs on the chip,
> > * maybe do that & below in a spinlock_irq
> > * to make sure no other driver code path
> > * re-enables them
> > */
> >
> > 2) me->sleeping = 1; /* tells the rest of the driver I'm not there
> > * anymore, can be some netif_* thingy.
> > */
> >
> > 3) synchronize_irq(me->irq); /* make sure above is visible to IRQs and
> > * any pending one competes on another
> > * CPU
> > */
>
> free_irq doesn't return until all pending irqs have completed, so we
> don't need to do this if we're using the method I proposed. In fact,
> I think it calls synchronize_irq.
Yes. free_irq above would be equivalent to synchronize_irq() and a good
replacement for it. With it, you don't even need the me->sleeping & test
in the IRQ handler since you simply cant call the IRQ handler after it's
free'd :)
> >
> > 4) pci_set_power_state(), maybe free_irq(), etc...
> >
> >
> > my_irq_handler():
> >
> > if (me->sleeping)
> > return IRQ_NONE;
> >
> > That's it.
> >
> > Ben.
>
> Thanks,
> Adam
>
next prev parent reply other threads:[~2005-06-07 5:56 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-06 22:46 [PATCH] fix tulip suspend/resume Karsten Keil
2005-06-07 0:04 ` Linus Torvalds
2005-06-07 2:50 ` Adam Belay
2005-06-07 3:34 ` Benjamin Herrenschmidt
2005-06-07 3:58 ` Adam Belay
2005-06-07 4:26 ` Benjamin Herrenschmidt
2005-06-07 5:34 ` Adam Belay
2005-06-07 5:50 ` Benjamin Herrenschmidt [this message]
2005-06-07 10:55 ` Karsten Keil
2005-06-07 20:58 ` Adam Belay
2005-06-08 0:26 ` Benjamin Herrenschmidt
2005-06-08 2:16 ` Adam Belay
2005-06-08 12:23 ` Pavel Machek
2005-06-08 23:00 ` Benjamin Herrenschmidt
2005-06-09 0:04 ` Pavel Machek
2005-06-09 0:38 ` Adam Belay
2005-06-09 10:51 ` Pavel Machek
2005-06-09 2:49 ` Nigel Cunningham
2005-06-09 8:27 ` Karsten Keil
2005-06-08 12:19 ` Pavel Machek
2005-06-08 6:39 ` Karsten Keil
2005-06-08 18:11 ` Davide Rossetti
2005-06-09 1:48 ` Adam Belay
2005-06-07 11:52 ` Stefan Seyfried
2005-06-07 2:15 ` Benjamin Herrenschmidt
2005-06-07 2:57 ` Adam Belay
2005-06-07 3:32 ` Benjamin Herrenschmidt
2005-06-07 3:42 ` Adam Belay
2005-06-07 4:29 ` Benjamin Herrenschmidt
2005-06-07 5:03 ` Adam Belay
2005-06-07 5:51 ` Nigel Cunningham
2005-06-07 5:55 ` Benjamin Herrenschmidt
2005-06-07 15:10 ` Pavel Machek
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=1118123457.6850.64.camel@gaston \
--to=benh@kernel.crashing.org \
--cc=abelay@novell.com \
--cc=akpm@osdl.org \
--cc=jgarzik@pobox.com \
--cc=kkeil@suse.de \
--cc=linux-kernel@vger.kernel.org \
--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.