[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:

> On Mon, 7 Mar 2005, Greg KH wrote:
>
> > > A more concrete question is: Should mutual exclusion between probe/remove
> > > and suspend/resume be handled by the bus rwsem, by a semaphore in struct
> > > device, or by individual bus drivers?  Offhand I don't see any reason why
> > > the rwsem wouldn't be enough.
> >
> > Besides me deleting the rwsem?  :)
> >
> > struct device might be the best place for this.
>
> Okay.  I'm going to take some time and think about this.
>
> Are you planning on using a spinlock to protect things like the list_head
> fields in struct device?  Or some other semaphore instead?  How will a
> driver be able to iterate through one of those lists safely (without
> things changing out from under it)?

The device doesn't own all of those fields. Most of those list_heads are
representative of the lists that the device is on (e.g. its controlling
bus's list of devices), which are owned by someone else. The only list
that it does own is the ->children list.

I think a spinlock is the right way to protect it, but iterating over it
is tricky if you want to be able to sleep during any of the iterations.
E.g. if you want to iteratte over the children to suspend or remove them,
you'll want to drop the lock for each node, which makes it a bit racy WRT
removal and insertion. Working around this is possible, but not quite
trivial.


	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