Skip to contentSkip to conversation

Runtime PM for PCI-based USB host controllers

DISCUSSION Alan Stern 2 participants 3 messages May 26, 2010 – Jun 1, 2010 2 messages not in the archive

lore
Share & tools
lore

Alan Stern

author
#1 lore raw
In reply to a message not in the archive
Quoted 8 lines · Matthew Garrett
Quoted 4 lines · Alan Stern

I don't know how that works. However an easy approach would be to make opening the device file (or however the userspace driver gets a reference to the device) cause the core to do a pm_runtime_get_sync(), with a corresponding pm_runtime_put_sync() when the file is closed.

No, X is far worse than you think. It's handled by mmap()ping /dev/mem.

Ugh.

Well, we still need some sort of map for how this will work, otherwise things will quickly get messed up.

Is it necessary to stick to a policy that _all_ unbound PCI devices must be active? Even those which were bound to a driver and then unbound?

Is there some way for the core to tell which devices will be handled by X, so that all others can be runtime suspended?

When a PCI driver's probe routine is called, it shouldn't need to call pm_runtime_set_active() or pm_runtime_enable(). The core should take care of this before the device is registered. One reasonably design would be to make PM-aware drivers responsible for doing an initial pm_runtime_put_sync() in order to allow their devices to suspend (plus a corresponding pm_runtime_get_sync() in the release method).

Alan Stern

author
#2 lore raw
In reply to a message not in the archive
Quoted 8 lines · Matthew Garrett
Quoted 4 lines · Alan Stern

I don't know how that works. However an easy approach would be to make opening the device file (or however the userspace driver gets a reference to the device) cause the core to do a pm_runtime_get_sync(), with a corresponding pm_runtime_put_sync() when the file is closed.

No, X is far worse than you think. It's handled by mmap()ping /dev/mem.

Can we rely on the forbid/allow mechanism? If userspace never allows runtime suspend for devices like the video controller then there's no problem. Conversely, if a PCI device really doesn't have a driver and isn't used for anything, then by default it should go into a lower power state if userspace allows this.

I admit this is a slightly brittle solution, in that it depends on userspace not doing the wrong thing. But the default (runtime PM forbidden) is always safe.

Alan Stern

#4 lore raw
In reply to a message not in the archive
Quoted 5 lines · Alan Stern

Can we rely on the forbid/allow mechanism? If userspace never allows runtime suspend for devices like the video controller then there's no problem. Conversely, if a PCI device really doesn't have a driver and isn't used for anything, then by default it should go into a lower power state if userspace allows this.

I think that's safe, yes. Other fringe concerns include things like smbus controllers - we typically won't allow a driver to bind to them because they're used by ACPI, so putting the in D3 is also an error. So I think Rafael's right in that we should default to forbid unless a driver knows that it's safe, and let userspace override us.

Signature · 1 line
Matthew Garrett | [email protected]