public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFD] Asynchronous suspend/resume of PCI devices
@ 2009-12-19 23:31 Rafael J. Wysocki
  2009-12-22 16:30 ` Jesse Barnes
  0 siblings, 1 reply; 3+ messages in thread
From: Rafael J. Wysocki @ 2009-12-19 23:31 UTC (permalink / raw)
  To: Linux PCI
  Cc: Greg KH, Linus Torvalds, Jesse Barnes, Alan Stern,
	ACPI Devel Maling List, pm list, LKML, Matthew Garrett

Hi,

I'd like to know your opinions about the viability of suspending and resuming
PCI devices asynchronously during system-wide PM transitions (suspend to RAM
and hibernation).

Linus says it's generally dangerous, because some PCI devices may indirectly
depend on the others, but if that's the case, I wonder if we really can power
manage PCI devices at run time.

It follows from my experiments that suspending and resuming PCI devices
asynchronously doesn't lead to problems as long as we make sure that every
PCI device is suspended before and resumed after its ACPI "shadow" partner.
However, I'm not sure if this is generally correct.

What are possible problems we can run into while doing asynchronous suspend
and resume of PCI devices?  What do we need to do in general to avoid that
problems?

Please tell me what you think.

Thanks,
Rafael

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFD] Asynchronous suspend/resume of PCI devices
  2009-12-19 23:31 [RFD] Asynchronous suspend/resume of PCI devices Rafael J. Wysocki
@ 2009-12-22 16:30 ` Jesse Barnes
  2009-12-22 19:10   ` Rafael J. Wysocki
  0 siblings, 1 reply; 3+ messages in thread
From: Jesse Barnes @ 2009-12-22 16:30 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Linux PCI, Greg KH, Linus Torvalds, Alan Stern,
	ACPI Devel Maling List, pm list, LKML, Matthew Garrett

On Sun, 20 Dec 2009 00:31:38 +0100
"Rafael J. Wysocki" <rjw@sisk.pl> wrote:

> Hi,
> 
> I'd like to know your opinions about the viability of suspending and
> resuming PCI devices asynchronously during system-wide PM transitions
> (suspend to RAM and hibernation).
> 
> Linus says it's generally dangerous, because some PCI devices may
> indirectly depend on the others, but if that's the case, I wonder if
> we really can power manage PCI devices at run time.
> 
> It follows from my experiments that suspending and resuming PCI
> devices asynchronously doesn't lead to problems as long as we make
> sure that every PCI device is suspended before and resumed after its
> ACPI "shadow" partner. However, I'm not sure if this is generally
> correct.
> 
> What are possible problems we can run into while doing asynchronous
> suspend and resume of PCI devices?  What do we need to do in general
> to avoid that problems?
> 
> Please tell me what you think.

AFAIK it should be *mostly* safe.  Individual drivers are generally
independent of one another.  However, there are quite a few
multifunction devices (some exposed as such, some exposed as multiple
busses and devices on the same device) where interdependencies are
possible.  In some cases, we just won't see power savings until the
whole chip is powered down (which may require extra code in the form of
a "bus" driver of some sort), in other cases a driver may inadvertently
power down a piece of a device needed by another driver.

That said, the best practice for those sorts of devices is to create a
bus driver anyway, that binds to the master device and has a few
child drivers, so maybe even that case won't be much trouble...

Jesse

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFD] Asynchronous suspend/resume of PCI devices
  2009-12-22 16:30 ` Jesse Barnes
@ 2009-12-22 19:10   ` Rafael J. Wysocki
  0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2009-12-22 19:10 UTC (permalink / raw)
  To: Jesse Barnes
  Cc: Linux PCI, Greg KH, Linus Torvalds, Alan Stern,
	ACPI Devel Maling List, pm list, LKML, Matthew Garrett

On Tuesday 22 December 2009, Jesse Barnes wrote:
> On Sun, 20 Dec 2009 00:31:38 +0100
> "Rafael J. Wysocki" <rjw@sisk.pl> wrote:
> 
> > Hi,
> > 
> > I'd like to know your opinions about the viability of suspending and
> > resuming PCI devices asynchronously during system-wide PM transitions
> > (suspend to RAM and hibernation).
> > 
> > Linus says it's generally dangerous, because some PCI devices may
> > indirectly depend on the others, but if that's the case, I wonder if
> > we really can power manage PCI devices at run time.
> > 
> > It follows from my experiments that suspending and resuming PCI
> > devices asynchronously doesn't lead to problems as long as we make
> > sure that every PCI device is suspended before and resumed after its
> > ACPI "shadow" partner. However, I'm not sure if this is generally
> > correct.
> > 
> > What are possible problems we can run into while doing asynchronous
> > suspend and resume of PCI devices?  What do we need to do in general
> > to avoid that problems?
> > 
> > Please tell me what you think.
> 
> AFAIK it should be *mostly* safe.  Individual drivers are generally
> independent of one another.  However, there are quite a few
> multifunction devices (some exposed as such, some exposed as multiple
> busses and devices on the same device) where interdependencies are
> possible.  In some cases, we just won't see power savings until the
> whole chip is powered down (which may require extra code in the form of
> a "bus" driver of some sort), in other cases a driver may inadvertently
> power down a piece of a device needed by another driver.
> 
> That said, the best practice for those sorts of devices is to create a
> bus driver anyway, that binds to the master device and has a few
> child drivers, so maybe even that case won't be much trouble...

My current idea is to mark all PCI devices as async and introduce mutexes
for the devices that shouldn't be suspended/resumed at the same time.
Perhaps we can start with just one mutex to be acquired in ->suspend() and
->resume() by the drivers that have to be serialized with respect to one
another.

What do you think?

Rafael

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-12-22 19:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-19 23:31 [RFD] Asynchronous suspend/resume of PCI devices Rafael J. Wysocki
2009-12-22 16:30 ` Jesse Barnes
2009-12-22 19:10   ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox