mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	pm list <linux-pm@lists.linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Linux PCI <linux-pci@vger.kernel.org>,
	Eric Sesterhenn <snakebyte@gmx.de>
Subject: Re: [PATCH 1/7] PCI PM: Fix handling of devices without drivers
Date: Wed, 4 Feb 2009 13:10:15 +0100	[thread overview]
Message-ID: <200902041310.15761.rjw@sisk.pl> (raw)
In-Reply-To: <alpine.LFD.2.00.0902031815550.3247@localhost.localdomain>

On Wednesday 04 February 2009, Linus Torvalds wrote:
> 
> On Wed, 4 Feb 2009, Rafael J. Wysocki wrote:
> > 
> > Suspend to RAM is reported to break on some machines as a result of
> > attempting to put one of driverless PCI devices into a low power
> > state.  Avoid that by not attepmting to power manage driverless
> > devices during suspend.
> > 
> > Fix up pci_pm_poweroff() after a previous incomplete fix for the same
> > thing during hibernation.
> 
> Ok, I really don't like this patch, because:
> 
> > -static void pci_pm_default_suspend(struct pci_dev *pci_dev)
> > +static void pci_pm_default_suspend(struct pci_dev *pci_dev, bool prepare)
> >  {
> >  	pci_pm_default_suspend_generic(pci_dev);
> >  
> > -	if (!pci_is_bridge(pci_dev))
> > +	if (prepare && !pci_is_bridge(pci_dev))
> >  		pci_prepare_to_sleep(pci_dev);
> >  
> >  	pci_fixup_device(pci_fixup_suspend, pci_dev);
> 
> This "helper" function really isn't helping anything at all any more. It's 
> really just confusing things.
> 
> Now that was true even before this all; mostly because your naming in this 
> area _really_ sucks. I mean, what the heck is the difference between 
> "pci_pm_default_suspend_generic()" and "pci_pm_default_suspend()", and 
> what do they do?
> 
> But you just made it worse. This trivial function that doesn't do anything 
> interesting, and isn't well-named enough to actually explain what it is 
> doing now became EVEN WORSE.  Now it's a trivial function that does two 
> things, except it does one of those things only if the magic flag (that is 
> also not helpfully named) is set.
> 
> Argh.
> 
> To make it worse, it's not at all obvious what the logic is:
> 
> > +	struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
> > +		pci_pm_default_suspend(pci_dev, !!pm);
> 
> Whaa? This is basically totally obfuscated code both in the caller _and_ 
> in the callee.
> 
> Now, it looks like this all then goes away in PATCH 7/7, so I guess I 
> shouldn't complain too much, but I just don't see much point in carrying 
> this broken patch around in the series, since it's then going away and 
> rewritten almost immediately again.

This is what has been tested by the bug reporter.

OK, I should have created a more sophisticated version, but that would go
away with patch 7/7 too, so ...

> Apart from that complaints, Acked-by: for the series. 

Thanks!

Rafael

  parent reply	other threads:[~2009-02-04 12:11 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-04  0:54 [PATCH 0/7] PCI PM: Fixes and refinements Rafael J. Wysocki
2009-02-04  0:56 ` [PATCH 1/7] PCI PM: Fix handling of devices without drivers Rafael J. Wysocki
2009-02-04  1:53   ` Benjamin Herrenschmidt
2009-02-04  2:23   ` Linus Torvalds
2009-02-04  2:49     ` Benjamin Herrenschmidt
2009-02-04 12:12       ` Rafael J. Wysocki
2009-02-04 12:10     ` Rafael J. Wysocki [this message]
2009-02-04  0:57 ` [PATCH 2/7] PCI PM: Check if the state has been saved before trying to restore it Rafael J. Wysocki
2009-02-04  1:54   ` Benjamin Herrenschmidt
2009-02-04  0:59 ` [PATCH 3/7] PCI PM: Fix saving of device state in pci_legacy_suspend Rafael J. Wysocki
2009-02-04  1:56   ` Benjamin Herrenschmidt
2009-02-04 10:14     ` Frans Pop
2009-02-04 21:38       ` Benjamin Herrenschmidt
2009-02-04 21:53         ` Frans Pop
2009-02-04 21:56         ` Linus Torvalds
2009-02-05  0:40           ` Benjamin Herrenschmidt
2009-02-05  0:57             ` Michael Ellerman
2009-02-05  1:29               ` Benjamin Herrenschmidt
2009-02-05  2:58                 ` Michael Ellerman
2009-02-05  4:06                   ` Benjamin Herrenschmidt
2009-02-04  1:00 ` [PATCH 4/7] PCI PCIe portdrv: Simplify suspend and resume Rafael J. Wysocki
2009-02-04  1:01 ` [PATCH 5/7] PCI PM: Do not disable and enable bridges during suspend-resume Rafael J. Wysocki
2009-02-04  1:02 ` [PATCH 6/7] PCI PM: Read power state from device after trying to change it on resume Rafael J. Wysocki
2009-02-04  1:09 ` [PATCH 7/7] PCI PM: Let the core be more careful with respect to drivers using new framework Rafael J. Wysocki
2009-02-04  2:05   ` Benjamin Herrenschmidt
2009-02-05  0:47     ` Rafael J. Wysocki
2009-02-05  1:18       ` Benjamin Herrenschmidt
2009-02-05  1:23 ` [PATCH 0/7] PCI PM: Fixes and refinements Jesse Barnes
2009-02-05  1:48   ` Rafael J. Wysocki

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=200902041310.15761.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=benh@kernel.crashing.org \
    --cc=jbarnes@virtuousgeek.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=snakebyte@gmx.de \
    --cc=torvalds@linux-foundation.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

all inboxes | Powered by JetHome®