[lkml]   [2007]   [Jul]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Towards eliminating the freezer
On Monday, 23 July 2007 22:05, Alan Stern wrote:
> [Note changed $SUBJECT]
> =============================
> Now here's an idea which might work. Can we require every caller of
> device_add() to hold some existing device's semaphore? Normally it
> would be the semaphore of the new device's parent, but it could be a
> higher ancestor. There even could be a single "root" semaphore for
> drivers registering a top-level device with no parent.
> (Some testing shows that during startup things like ACPI and IDE don't
> fulfill this requirement, so maybe we should require it only after
> userspace has begun running. After all, the system can't suspend
> until then.)
> It seems like a reasonable sort of thing to do. Hotplugged devices
> tend to be registered as they are discovered by their parent's driver,
> so it shouldn't be too much to ask that the parent's semaphore be held
> when the new device is registered. Static devices generally aren't
> quite so nice; the serial and floppy drivers in particular would need a
> little work (and probably some other drivers too).
> If we do this, then once the PM core has acquired the semaphore for
> every device it will be guaranteed that no new devices can be added.
> It would be a simple solution to a rather nasty problem.

Hmm, in device_pm_add() and device_pm_remove() we acquire dpm_list_mtx which
also is acquired by device_suspend() and device_resume(). Thus, every attempt
to register a new device or unregister an existing one will be blocked while
either device_suspend() or device_resume() is running.

If we arrange things so that dpm_list_mtx is acquired, but not released, by
device_suspend() and released, but not acquired, by device_resume(), then it
won't be possible to register/unregister a device during a suspend-resume


"Premature optimization is the root of all evil." - Donald Knuth
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2007-07-24 11:29    [W:0.334 / U:2.892 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site