* Put unused PCI devices in D3 @ 2008-09-29 20:11 Jeffrey W. Baker 2008-09-30 0:09 ` Matthew Garrett 2008-10-03 19:37 ` Pavel Machek 0 siblings, 2 replies; 6+ messages in thread From: Jeffrey W. Baker @ 2008-09-29 20:11 UTC (permalink / raw) To: linux-kernel My laptop computer has half a dozen unused PCI devices that could be put in the D3 power state, but they loiter in D0. The audio codec, the ethernet adapter, the unused PCI Express port, all the USB controllers, the IEEE1394 controller, the SD/MMC card controller, and the cardbus bridge all support D3(hot) power state. Currently it looks to me from browsing the code that D3 is only used in Linux when the whole machine is headed for S3, and the drivers are asked to suspend. I think the drivers should be able to enter D3 in other circumstances: * During pci_unregister_driver ... i.e. on module unload * When a network interface is downed * If the device is a bridge or hub with no downstream device * Whenever userspace requests D3 via sysfs So, what fundamental problem prevents me from, for example, calling pci_set_power_state() from ohci1394's __exit? -jwb ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Put unused PCI devices in D3 2008-09-29 20:11 Put unused PCI devices in D3 Jeffrey W. Baker @ 2008-09-30 0:09 ` Matthew Garrett 2008-09-30 0:55 ` Jeffrey W. Baker 2008-10-03 19:37 ` Pavel Machek 1 sibling, 1 reply; 6+ messages in thread From: Matthew Garrett @ 2008-09-30 0:09 UTC (permalink / raw) To: Jeffrey W. Baker; +Cc: linux-kernel On Mon, Sep 29, 2008 at 01:11:03PM -0700, Jeffrey W. Baker wrote: > Currently it looks to me from browsing the code that D3 is only used in > Linux when the whole machine is headed for S3, and the drivers are asked > to suspend. I think the drivers should be able to enter D3 in other > circumstances: > > * During pci_unregister_driver ... i.e. on module unload The fact that Linux isn't using a device doesn't inherently mean that the system isn't using it. For example, the smbus controller will probably still be used by ACPI even if there's no Linux driver loaded. > * When a network interface is downed Yes. Drivers are moving towards this model. > * If the device is a bridge or hub with no downstream device Potential problems with hotplugging? But sure, this kind of thing is being implemented in USB and SCSI. > * Whenever userspace requests D3 via sysfs This functionality was explicitly removed a few years back. > So, what fundamental problem prevents me from, for example, calling > pci_set_power_state() from ohci1394's __exit? Nothing I'm aware of. It sounds pretty safe in that case. But that would require you to load and unload the driver - better to have the driver loaded the entire time and make sure it does as much runtime power management as possible. I don't know enough about the firewire OHCI hardware, but can you power down most of the chip and still get hotplug events? -- Matthew Garrett | mjg59@srcf.ucam.org ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Put unused PCI devices in D3 2008-09-30 0:09 ` Matthew Garrett @ 2008-09-30 0:55 ` Jeffrey W. Baker 2008-09-30 1:06 ` Matthew Garrett 2008-10-03 19:40 ` Pavel Machek 0 siblings, 2 replies; 6+ messages in thread From: Jeffrey W. Baker @ 2008-09-30 0:55 UTC (permalink / raw) To: Matthew Garrett; +Cc: linux-kernel On Tue, 2008-09-30 at 01:09 +0100, Matthew Garrett wrote: > On Mon, Sep 29, 2008 at 01:11:03PM -0700, Jeffrey W. Baker wrote: > > > Currently it looks to me from browsing the code that D3 is only used in > > Linux when the whole machine is headed for S3, and the drivers are asked > > to suspend. I think the drivers should be able to enter D3 in other > > circumstances: > > > > * During pci_unregister_driver ... i.e. on module unload > > The fact that Linux isn't using a device doesn't inherently mean that > the system isn't using it. For example, the smbus controller will > probably still be used by ACPI even if there's no Linux driver loaded. True. On my hardware, the smbus controller doesn't advertise power management capabilities, so this would not be a problem. > > * When a network interface is downed > > Yes. Drivers are moving towards this model. Very cool. netbsd-current apparently has this already (and a kernel-wide topological representation of PCI power management generally). > > * If the device is a bridge or hub with no downstream device > > Potential problems with hotplugging? But sure, this kind of thing is > being implemented in USB and SCSI. > > > * Whenever userspace requests D3 via sysfs > > This functionality was explicitly removed a few years back. I sure would like to have it back, if only just for experimentation. Right now, I don't even know what kind of power savings could be achieved from D3, I'm just speculating. As you rightfully point out, it's possible that the driver could put the device into an ultra-low power saving state while still operating in D0, and that D3 savings would be negligible. > > So, what fundamental problem prevents me from, for example, calling > > pci_set_power_state() from ohci1394's __exit? > > Nothing I'm aware of. It sounds pretty safe in that case. But that would > require you to load and unload the driver - better to have the driver > loaded the entire time and make sure it does as much runtime power > management as possible. I don't know enough about the firewire OHCI > hardware, but can you power down most of the chip and still get hotplug > events? No, you couldn't, but that isn't really the point. If I have my laptop on a transoceanic flight it may be useful for me to be able to set a power policy turning off all the extraneous junk on my machine, because I know /a priori/ that no hotplug events will happen. There's no way the kernel could know that, but userspace can tell the kernel to turn off an unneeded device. Think of it this way. Putting the machine into S3 prevents it from checking my email, but the capability exists. All I want to do is extend that concept to the PCI device level. Anyway, ohci1394 is pretty easy to understand, and it's not likely to hose up the system too badly, so I'm going to perform surgery there. -jwb ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Put unused PCI devices in D3 2008-09-30 0:55 ` Jeffrey W. Baker @ 2008-09-30 1:06 ` Matthew Garrett 2008-10-03 19:40 ` Pavel Machek 1 sibling, 0 replies; 6+ messages in thread From: Matthew Garrett @ 2008-09-30 1:06 UTC (permalink / raw) To: Jeffrey W. Baker; +Cc: linux-kernel On Mon, Sep 29, 2008 at 05:55:47PM -0700, Jeffrey W. Baker wrote: > No, you couldn't, but that isn't really the point. If I have my laptop > on a transoceanic flight it may be useful for me to be able to set a > power policy turning off all the extraneous junk on my machine, because > I know /a priori/ that no hotplug events will happen. There's no way > the kernel could know that, but userspace can tell the kernel to turn > off an unneeded device. The majority (though it's not universal) of modern hardware can be put into a state where you get most of the power savings of the entire part being in D3 but with little functional regression. While I'm not averse to adding features that aid the power user who's happy to poke around with individual drivers, this shouldn't be at the expense of implementing good runtime power management for the more common case. Not that I'm suggesting you're doing that, I just want to emphasise that you're working on a slightly more niche concern :) -- Matthew Garrett | mjg59@srcf.ucam.org ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Put unused PCI devices in D3 2008-09-30 0:55 ` Jeffrey W. Baker 2008-09-30 1:06 ` Matthew Garrett @ 2008-10-03 19:40 ` Pavel Machek 1 sibling, 0 replies; 6+ messages in thread From: Pavel Machek @ 2008-10-03 19:40 UTC (permalink / raw) To: Jeffrey W. Baker; +Cc: Matthew Garrett, linux-kernel Hi! > > > * If the device is a bridge or hub with no downstream device > > > > Potential problems with hotplugging? But sure, this kind of thing is > > being implemented in USB and SCSI. > > > > > * Whenever userspace requests D3 via sysfs > > > > This functionality was explicitly removed a few years back. > > I sure would like to have it back, if only just for experimentation. Feel free to find it and reapply for your experiments. The file was in sysfs was called power/state, just grep git logs for that. -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Put unused PCI devices in D3 2008-09-29 20:11 Put unused PCI devices in D3 Jeffrey W. Baker 2008-09-30 0:09 ` Matthew Garrett @ 2008-10-03 19:37 ` Pavel Machek 1 sibling, 0 replies; 6+ messages in thread From: Pavel Machek @ 2008-10-03 19:37 UTC (permalink / raw) To: Jeffrey W. Baker; +Cc: linux-kernel Hi! > My laptop computer has half a dozen unused PCI devices that could be put > in the D3 power state, but they loiter in D0. The audio codec, the > ethernet adapter, the unused PCI Express port, all the USB controllers, > the IEEE1394 controller, the SD/MMC card controller, and the cardbus > bridge all support D3(hot) power state. > > Currently it looks to me from browsing the code that D3 is only used in > Linux when the whole machine is headed for S3, and the drivers are asked > to suspend. I think the drivers should be able to enter D3 in other > circumstances: > > * During pci_unregister_driver ... i.e. on module unload > * When a network interface is downed > * If the device is a bridge or hub with no downstream device > * Whenever userspace requests D3 via sysfs Well, patch that would put all unused devices into D3 would be certainly 'interesting'. Then we could measure power savings and perhaps do it... (or not if it breaks machines as Mathew suggests). > So, what fundamental problem prevents me from, for example, calling > pci_set_power_state() from ohci1394's __exit? Patch would be welcome. -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-10-03 19:43 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-09-29 20:11 Put unused PCI devices in D3 Jeffrey W. Baker 2008-09-30 0:09 ` Matthew Garrett 2008-09-30 0:55 ` Jeffrey W. Baker 2008-09-30 1:06 ` Matthew Garrett 2008-10-03 19:40 ` Pavel Machek 2008-10-03 19:37 ` Pavel Machek
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox