On Thu, 22 Jun 2006, David Brownell wrote: > > The PM core _should_ be > > able to handle a device being added or removed while some parts of > > the system are suspended or frozen, just so long as the actual parent is > > still awake. Uevents can safely be queued until userspace is unfrozen or > > otherwise able to process them. > > Fixing that involves updating pm core locking, ISTR. I've thought that > the root cause of the issue is that the list of devices to be suspended > is created at the wrong time ... very early and globally scoped, not > on-demand and privately scoped. I believe this has been fixed for quite a while. The list of devices to be suspended is persistent and is maintained over the lifetime of the system (devices are added during device_add and removed during device_del). That way the ordering is automatically correct; suspend works from the end of the list to the start and resume goes from the start to the end. Thus devices are suspended in the opposite order of discovery and resumed in the order of discovery. The difficulty you remember was the mutual exclusion between the list-walking in suspend/resume vs. actually modifying the list. That now works okay, so long as nobody tries to add a child to a suspended parent. > > I'm concerned about remote wakeup events arriving at inconvenient times > > during STR or STD. Sometimes you might want them to abort the suspend, > > sometimes you might want to just drop them, and sometimes you might want > > them to wake the system up right after it goes to sleep. It would be nice > > to get this straightened out. > > Well, wakeup events in general, not just USB ones. They can be the same > as regular IRQs ... which seems to suggest that driver-specific coding may > be needed. Maybe. Also to be considered is the fact that much of wakeup handling has to take place in a process context, so once everything is frozen it can't happen. (Depending on which kernel threads remain unfrozen, of course. I don't know whether keventd in particular should be frozen, or even whether it gets frozen currently.) Alan Stern