Re: [RFD] Automatic suspend

Arve Hjønnevåg
2009-02-18T22:35:26Z

On Wed, Feb 18, 2009 at 1:17 PM, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> On Wednesday 18 February 2009, Arve Hjønnevåg wrote:
>> On Tue, Feb 17, 2009 at 3:21 PM, Rafael J. Wysocki <rjw@sisk.pl> wrote:
>> > On Tuesday 17 February 2009, Alan Stern wrote:

>> >> Kernel wakelocks are a separate matter. They are more like a form of
>> >> optimization, preventing the kernel from starting an auto-suspend when
>> >> some driver knows beforehand that it will return -EBUSY.
>> >
>> > I think kernel-side autosuspend (or rather autosleep) should only happen
>> > after certain subset of devices have been suspended using a per-device
>> > run-time autosuspend mechanism.
>>
>> When the last wakelock is released the task that we woke up to perform
>> has finished. Why wait to re-enter suspend.
>
> I don't really understand this comment. Could you please explain a bit?

If some devices are autosuspended after a local inactivity timeout, I
don't want to wait for those devices to autosuspend if I know the code
that needed to run is done. This could cause delays in the normal
case, and it could prevent suspend if a background process (not using
wakelocks) is accessing a disk more frequently than its idle timeout.

>
>> >> > Phase 3: Probably explicit control left to open/close.
>> >>
>> >> While that's generally a good idea, it's important to recognize that
>> >> some devices should be runtime-suspended even while they are open.
>> >
>> > From the kernel side, yes (and that should be transparent to the user space
>> > having them open). By the user space, no.
>>
>> Allowing user space to suspend input devices while they are still open
>> is useful. The user-space code that reads from the input devices does
>> not need to know if the device is suspended or not, and the kernel
>> cannot auto suspend input devices based on inactivity.
>
> Hmm. Why can't it?

Because they stop working. It is OK for us to turn off the touchscreen
when the screen is off, but when the screen is on the user will touch
items on the screen and expect them to respond. (We could also turn
off the touchscreen when the keyguard is on, but we don't currently do
this.)

--
Arve Hjønnevåg