On Sat, 2010-05-29 at 10:10 +0200, Peter Zijlstra wrote:Look, this is getting into the realms of a pointless semantic quibble. The problem is that untrusted tasks need to be forcibly suspended when they have no legitimate work to do and the user hasn't authorised them to continue even if the scheduler sees them as runnable. Whether that's achieved by suspending the entire system or forcibly idling the tasks (using blocking states or freezers or something) so the scheduler can suspend from idle is something to be discussed, but the net result is that we have to stop a certain set of tasks in such a way that they can still receive certain external events ... semantically, this is equivalent to not running runnable tasks in my book. (Perhaps this whole thing is because the word runnable means different things ... I'm thinking a task that would consume power ... are you thinking in the scheduler R state?) Realistically, the main thing we need to do is stop timers posted against the task (which is likely polling in a main loop, that being the usual form of easy to write but power crazy app behaviour) from waking the task and bringing the system out of suspend (whether from idle or forced). That's rubbish and you know it. We do software workarounds for hardware problems all the time ... try doing a git grep -i errata in arch x86, or imagine a USB subsystem that only supported sane standards conforming devices: that would have an almost zero intersect with the current USB device market. The job of the kernel is to accommodate hardware as best it can ... sometimes it might not be able to, but most of the time it does a pretty good job. The facts are that C states and S states are different and are entered differently. For some omap hardware, the power consumption in the lowest C state (with all the ancillary power control) is the same as S3, that's fine, suspend from idle works as well as suspend to ram modulo bad apps. For quite a lot of MSM hardware, the lowest C state power consumption is quite a bit above S3. It's not acceptable to tell those people "tough, your battery runs out in 30 minutes because you bought the wrong hardware". We have to figure out how to get to S3 ... whether this is from idle or some other mechanism is again a discussion point, but not doing it is not an option. Strange, that's not what I heard as the possible solution. I thought he was advocating expressing the kernel side of suspend blockers as QoS constraints. Once we have QoS constraints correctly done in the kernel, userspace still has to express its requirements. If the requirements are static, then they can be done from policy files or in some other static way but if they're dynamic, they'll still have to be in the applications ... in about the same places the android wakelocks are. I don't think anyone disagrees with this. As long as we find a long term solution that satisfies the android case, everyone will be happy. James --
