From: Adam Belay <abelay@novell.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
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: Mon, 06 Jun 2005 23:58:01 -0400 [thread overview]
Message-ID: <1118116682.3245.45.camel@localhost.localdomain> (raw)
In-Reply-To: <1118115278.6850.48.camel@gaston>
On Tue, 2005-06-07 at 13:34 +1000, Benjamin Herrenschmidt wrote:
> > This patch is an improvement, but there may still be some issues.
> > Specifically, it looks to me like the the interrupt handler remains
> > registered. This could cause some problems when another device is sharing
> > the interrupt because the tulip driver must read from a hardware register
> > to determine if it triggered the interrupt. When the hardware has been
> > physically powered off, things might not go well.
> >
> > I can't comment on the netdev class aspect of this routine, but following
> > a similar strategy to its original author, a fix might look like this:
>
> Don't like it, see below.
>
> > @@ -1768,12 +1773,19 @@
> > static int tulip_resume(struct pci_dev *pdev)
> > {
> > struct net_device *dev = pci_get_drvdata(pdev);
> > + int retval;
> >
> > if (dev && netif_running (dev) && !netif_device_present (dev)) {
> > -#if 1
> > - pci_enable_device (pdev);
> > -#endif
> > - /* pci_power_on(pdev); */
> > + pci_set_power_state(pdev, PCI_D0);
>
> Oh well... you are turning power back on ... but you don't know if you
> _can_ ... what if your parent bridge has been disabled in some way ? Or
> the clock generation on the bus stopped already ?
We don't support PCI bus power management, so we don't have any idea
what the parent is doing. Also, we don't have a pci bridge driver (one
that uses "struct pci_driver" to handle bridge resumes properly. I'm
working on these issues. I also have some changes in mind for the PM
model to make it more friendly to the power dependency problem. So in
short, I think this is fine for now, as every other driver is doing it
incorrectly, and in general it is working ok for suspend and resume.
They're all broken in this respect, and we need to gradually fix them.
But first we need the infrastructure to make this possible.
I haven't decided yet, but we could probably hide much of this inside
pci_set_power_state().
>
> I think the kernel should warn & disable the IRQ if that happens
> (basically you should return NOT_HANDLED)
>
> > + pci_restore_state(pdev);
> > +
> > + pci_enable_device(pdev);
> > +
> > + if ((retval = request_irq(dev->irq, &tulip_interrupt, SA_SHIRQ, dev->name, dev))) {
> > + printk (KERN_ERR "tulip: request_irq failed in resume\n");
> > + return retval;
> > + }
> > +
> > tulip_up (dev);
> > netif_device_attach (dev);
> > }
>
> Also, isn't that racy vs. the code in suspend() anyway ? You need to
> make sure you program your chip not to issue any interrupt and
> synchronize proerly, then just "ignore" (don't handle) interrupts coming
> in as they should not be for you.
Yeah, that's exactly what I had in mind. As I understand, tulip_down
does tells the chip not to issue interrupts. Then we unregister the
interrupt handler before powering down the device to avoid any issues
with shared interrupts. The best way of ignoring interrupts is to
unregister the handler. Do you still see a race condition?
Thanks,
Adam
next prev parent reply other threads:[~2005-06-07 4:01 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 [this message]
2005-06-07 4:26 ` Benjamin Herrenschmidt
2005-06-07 5:34 ` Adam Belay
2005-06-07 5:50 ` Benjamin Herrenschmidt
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=1118116682.3245.45.camel@localhost.localdomain \
--to=abelay@novell.com \
--cc=akpm@osdl.org \
--cc=benh@kernel.crashing.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox