On Wednesday 19 August 2009, Alan Stern wrote: > On Wed, 19 Aug 2009, Rafael J. Wysocki wrote: > > > There's a problem that for safety reasons I maintain the ordering of dpm_list > > and the callbacks are scheduled for async execution in the same order in > > which they would have been executed synchronously. If were to change this, > > we'd have to be _very_ careful. > > Why? The order in which jobs are scheduled for async execution doesn't > bear any particular relation to the order in which they get run. Yes, it does, if all of the async threads are busy and we add more async jobs to the queue. We must ensure that none of the jobs being executed will wait for any jobs in the queue. Also, if any devices are handled synchronously, they must not wait for any "async" devices that haven't been scheduled yet. With a master thread that would do all the waiting that wouldn't be a problem any more, but I'm not sure how to implement such a thread efficiently. The problem is that each device may depend on multiple other devices, so even if one callback finishes, there's no guarantee there will be any device with satisfied dependencies, so it looks like the master thread would have to browse dpm_list continuously searching it for devices that are ready for suspending. Also I don't think we can change the ordering of dpm_list as a result of asynchronous execution. Thanks, Rafael -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html