All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Mohr <andim2@users.sourceforge.net>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: andi@lisas.de, akpm@linux-foundation.org,
	e1000-devel@lists.sourceforge.net, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Make e100 suspend handler support PCI cards lacking PM capability
Date: Sun, 14 Jun 2009 14:51:28 +0200	[thread overview]
Message-ID: <20090614125128.GA32034@rhlx01.hs-esslingen.de> (raw)
In-Reply-To: <200906140028.16025.rjw@sisk.pl>

Hi,

On Sun, Jun 14, 2009 at 12:28:15AM +0200, Rafael J. Wysocki wrote:
> On Saturday 13 June 2009, Andreas Mohr wrote:
> > Hi all,
> > 
> > after having added non-MII PHY card support to e100, I noticed that
> > the suspend handler rejects power-management non-capable PCI cards,
> 
> Well, that means we have a bug somewhere in the PCI PM core.

I don't know. I had shortly investigated the same thing,
but it very much seemed that this is by design, pci_set_power_state()
is documented to reject non-PM cards (in power/pci.txt, and in
pci.c, too). Thus I didn't work in this area.

And from a cleanliness point of view pci_set_power_state()
acting on a non-PM card with no special non-PM ACPI support _should_
return an error status I guess.
(especially since docs say that pci_set_power_state() should
be used for PM cards)

> > causing a S2R request to immediately get back up to the desktop,
> > losing network access in the process (rtnl mutex deadlock).
> 
> That's bad.

Indeed, and I have no idea what the problem was.
rtnl_is_locked() always was false within suspend/resume,
thus it had to be a userspace-triggered effect sometime
_after_ (non-)resume happened
(probably due to the network controller being down and thus inoperable
after .suspend).

BTW, after that failed .suspend, .resume was not called. I assume this to
be correct behaviour.

> >  static int __e100_power_off(struct pci_dev *pdev, bool wake)
> >  {
> > +	/* some older devices don't support PCI PM
> > +	 * (e.g. mac_82557_D100_B combo card with 80c24 PHY)
> > +	 * - skip those! (they most likely won't support WoL either)
> > +	 */
> > +	if (!pci_find_capability(pdev, PCI_CAP_ID_PM))
> > +		return 0;
> 
> Devices without PCI_CAP_ID_PM may still be power-manageable by ACPI, so
> returning 0 at this point is not a general solution.

Oh, interesting.

BTW, any idea why we have several drivers doing some seemingly useless

        /* Find power-management capability. */
        pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM);
        if (pm_cap == 0) {
                printk(KERN_ERR PFX "Cannot find PowerManagement capability, "
                       "aborting.\n");
                err = -EIO;
                goto err_out_free_res;
        }

?

- it's code bloat
- it needlessly rejects non-PM cards
- it annoys the hell out of users of a non-PM card


> > +
> >  	if (wake) {
> >  		return pci_prepare_to_sleep(pdev);
> 
> pci_prepare_to_sleep() is supposed to return 0 for your device.  I'll have a
> look at it.

No, wake is false for my card, thus that's not the branch to
investigate.

And that's probably the reason why the patch in the next mail
didn't work.
(I #if 0'ed my e100 changes, and then patched pci.c,
and it did properly contain the patched parts,
and the kernel rebuild then failed to suspend)

pci_legacy_suspend(): e100_suspend+0x0/0x20 [e100] returns -5
pm_op(): pci_pm_suspend+0x0/0xd7 returns -5
PM: Device 0000:02:07.0 failed to suspend: error -5
PM: Some devices failed to suspend

Most likely your patch didn't change pci_set_power_state() processing,
I'd think.

Now what to do next?
Note that I won't be able to test anything for about a week now,
unfortunately.

Thanks for your info!

Andreas Mohr

  parent reply	other threads:[~2009-06-14 12:51 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-28  8:01 [GIT]: Networking David Miller
2008-12-28  8:01 ` David Miller
2008-12-29 10:25 ` Andreas Mohr
2008-12-29 10:25   ` Andreas Mohr
2008-12-29 17:17   ` Andrew Morton
2008-12-29 17:17     ` Andrew Morton
2008-12-29 21:09     ` Johannes Berg
2008-12-30 11:05       ` Andreas Mohr
2008-12-29 23:15     ` Jeff Kirsher
2008-12-29 23:15       ` Jeff Kirsher
2008-12-30 12:07       ` Andreas Mohr
2008-12-30 12:07         ` Andreas Mohr
2009-02-28 20:37         ` 2.6.29 e100.c non-MII support status? (Re: [GIT]: Networking) Andreas Mohr
2009-02-28 20:37           ` Andreas Mohr
2009-03-01 10:57           ` Jeff Kirsher
2009-03-01 21:24             ` Andreas Mohr
2009-06-02 21:48               ` [PATCH] Add non-MII PHY support to e100 (Re: 2.6.29 e100.c non-MII support status? (Re: [GIT]: Networking)) Andreas Mohr
2009-06-03  6:01                 ` e100 kills S2R on my box, plus network drops dead Andreas Mohr
2009-06-03  6:30                   ` Andreas Mohr
2009-06-03  6:30                     ` Andreas Mohr
2009-06-13 19:19                     ` [PATCH] Make e100 suspend handler support PCI cards lacking PM capability Andreas Mohr
2009-06-13 19:19                       ` Andreas Mohr
2009-06-13 22:28                       ` Rafael J. Wysocki
2009-06-13 22:45                         ` Rafael J. Wysocki
2009-06-13 22:45                           ` Rafael J. Wysocki
2009-06-14 12:51                         ` Andreas Mohr [this message]
2009-06-14 14:06                           ` Rafael J. Wysocki
2009-06-14 14:06                             ` Rafael J. Wysocki
2009-06-14 16:31                             ` Rafael J. Wysocki
2009-06-14 16:46                             ` Andreas Mohr
2009-06-14 16:46                               ` Andreas Mohr
2009-06-14 17:09                               ` Rafael J. Wysocki
2009-06-14 17:09                                 ` Rafael J. Wysocki
2009-06-14 17:20                                 ` Andreas Mohr
2009-06-14 17:20                                   ` Andreas Mohr
2009-06-19  8:00                                 ` Andreas Mohr
2009-06-14 19:46                               ` [PATCH] Net / e100: Fix suspend of devices that cannot be power managed Rafael J. Wysocki
2009-06-14 19:46                                 ` Rafael J. Wysocki
2009-06-18  2:03                                 ` David Miller

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=20090614125128.GA32034@rhlx01.hs-esslingen.de \
    --to=andim2@users.sourceforge.net \
    --cc=akpm@linux-foundation.org \
    --cc=andi@lisas.de \
    --cc=e1000-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rjw@sisk.pl \
    /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.