I was referring to your sentence: "That way we don't need to grab the suspend blocker from the wake up irq handler all the way up to user mode..." The problem arises when kernel handlers don't do _something_ (Actually the kernel can cancel the suspend even after interrupts are turned off, if it has a reason to do so.) In theory the race between interrupts and suspend don't need to be a problem. In practice it still is -- the PM core needs a few changes to allow wakeup interrupts to cancel a suspend in progress. Regardless, This is not the scenario I was describing. Here's what I had in mind: 1) The system is asleep 2) Wakeup event occurs, one-shot policy over 3) Go all the way to user mode 4) A second wakeup interrupt occurs (say the modem rings) 5) The modem driver does not enable any suspend blockers 6) The modem driver queues an input event for userspace 7) The userspace handler invoked during 3) finishes and re-enables the one-shot policy 8) No suspend blockers are enabled, so the system goes to sleep No. The real problem is how ISRs should prevent the system from I agree, it is ugly and probably hard to get right. But something like That is not a problem for level-sensitive IRQs. If interrupts have been turned off then the modem will not receive any commands telling it to stop requesting an interrupt. So the IRQ line will remain active until the system goes to sleep, at which point it will immediately wake up the system. For edge-sensitive interrupts the situation isn't as simple. The That's not what we are killing ourselves for. The point of suspend blockers is not to prevent races with the hardware. It is to prevent userspace from being frozen while there's still work to be done. Alan Stern --
In my sequence above I had the modem driver "magically" knowing to fail Thanks, I think I'm starting to get it. From this it seems that the system integrator needs to identify those wake up sources that need to be able to block a suspend, and figure out a way of acknowledging from user mode, that its now ok to allow a suspend to happen. The rev-6 proposed way is for the integrator to implement overlapping blocker sections from ISR up to user mode for selected wake up devices (i.e. the modem) There *has* to be a better way. Can't we have some notification based thing that supports user mode acks through a misc device or sysfs thing? Anything to avoid the True, you need an ack back from user mode for when its ok to allow suspend to happen. This ack is device specific and needs to be custom ok. I'm going to think on this some more. There must be a cleaner way to do this. --mgross --
If the modem driver knows to "magically" fail a suspend attempt until it knows that userspace has consumed the event, you have something that But nobody has reasonably proposed one and demonstrated that it works. We've had over a year to do so and failed, and I think it's pretty unreasonable to ask Google to attempt to rearchitect based on a hypothetical. -- Matthew Garrett | mjg59@srcf.ucam.org --
These are not new issues being raised. They've had over a year to address them, and all thats really happened was some sed script changes from wake_lock to suspend_blocker. Nothing is really different here. Rearchitecting out of tree code is as silly thing for you to expect from a community member. sigh, lets stop wasting time and just merge it then. I'm finished with this thread until I do some rearchecting and post something that looks better to me. I'll look for this stuff in 2.6.34 or 35. --mgross ps It think the name suspend blocker is worse than wake-lock. I'd change it back. --
Our issues haven't been addressed because we've given no indication as to how they can be addressed. For better or worse, our runtime powermanagement story isn't sufficient to satisfy Google's usecases. That would be fine, if we could tell them what changes needed to be made to satisfy their usecases. The Android people have said that they don't see a cleaner way of doing this. Are we seriously saying that they should prove themselves wrong, and if they can't they don't get their code in the kernel? This seems... problematic. -- Matthew Garrett | mjg59@srcf.ucam.org --
