[linux-pm] Some thoughts on suspend/resume development

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Tue, 8 Mar 2005, Alan Stern wrote:

> How would you tell the core or a bus driver not to add/delete devices or
> bind/unbind drivers?  The logical answer is by locking a semaphore or the
> equivalent.  This would be tantamount to reintroducing the bus rwsem!

No, the rwsem is a bad idea. That locks the entire bus and prevents
anything from happening to any device. That's not good. It's best to have
a per-device lock for that type of exclusion. And, you really do want to
exclude a device power transition from happening while a driver is
binding/releasing from a device.

Ultimately, that would be a driver-based operation, and the lock would
exist in a driver-allocated, per-device structure. But, we could easily
add a semaphore to struct device that we take around ->probe(),
->release() and power state transition calls.

[ Actually, I recently added a spinlock to struct device for a similar
purpose, so it'll be trivial to change it to a semaphore, which we need
for this purpose, since ->probe() or ->suspend() could easily sleep on
memory allocations. ]

> Can anyone point out a place where the kernel has to iterate over the
> entire driver-model tree, other than the suspend/resume routines?

Device shutdown, which is a related situation. They're the only things
that need to operate on the entire device space.


	Pat


[Index of Archives]     [Linux ACPI]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [CPU Freq]     [Kernel Newbies]     [Fedora Kernel]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux