Re: [systemd-devel] [hybrid-sleep] hibernation delay

2014-06-20 Thread Lennart Poettering
On Fri, 13.06.14 18:54, Tom Sherpen (tomsher...@mail.com) wrote:

Hi,
 
I am wondering if hybrid-sleep could support a hibernation delay, similar
to what is found in pm-utils [1]
 
Thus, you would be able to first suspend, with the machine going
automatically into hibernation after a certain amount of time.
 
Is support for such a hibernation delay planned for the future?

This is currently not implemented. We could certainly add something like
this to the systemd-sleep binary, however, I am not entirely sure how to
do this reliably: if we do this in userspace, and first set up a timer
that will resume the machine, then go to suspend, how do we figure out
after resume whether we resumed because of this timer (and hence we
should go to hibernation, immediately) or because of some user activity?

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [hybrid-sleep] hibernation delay

2014-06-20 Thread Mantas Mikulėnas
On Fri, Jun 20, 2014 at 4:24 PM, Lennart Poettering
lenn...@poettering.net wrote:
 On Fri, 13.06.14 18:54, Tom Sherpen (tomsher...@mail.com) wrote:

Hi,

I am wondering if hybrid-sleep could support a hibernation delay, similar
to what is found in pm-utils [1]

Thus, you would be able to first suspend, with the machine going
automatically into hibernation after a certain amount of time.

Is support for such a hibernation delay planned for the future?

 This is currently not implemented. We could certainly add something like
 this to the systemd-sleep binary, however, I am not entirely sure how to
 do this reliably: if we do this in userspace, and first set up a timer
 that will resume the machine, then go to suspend, how do we figure out
 after resume whether we resumed because of this timer (and hence we
 should go to hibernation, immediately) or because of some user activity?

I think this is usually done by comparing if the clock after wakeup ==
(clock before wakeup + hibernation delay + ...maybe clock drift?).

[In other words, ugly hack from before s2both days.]

-- 
Mantas Mikulėnas graw...@gmail.com
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [hybrid-sleep] hibernation delay

2014-06-20 Thread Jan Alexander Steffens
Am 20.06.2014 15:24 schrieb Lennart Poettering lenn...@poettering.net:
 how do we figure out
 after resume whether we resumed because of this timer (and hence we
 should go to hibernation, immediately) or because of some user activity?

I think there's a way to get at Linux or ACPI's information about which
device

triggered the wakeup (LID, RTC, whatever), but I don't remember what it was.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [hybrid-sleep] hibernation delay

2014-06-20 Thread Lennart Poettering
On Fri, 20.06.14 15:50, Jan Alexander Steffens (jan.steff...@gmail.com) wrote:

 Am 20.06.2014 15:24 schrieb Lennart Poettering lenn...@poettering.net:
  how do we figure out
  after resume whether we resumed because of this timer (and hence we
  should go to hibernation, immediately) or because of some user activity?
 
 I think there's a way to get at Linux or ACPI's information about which
 device
 
 triggered the wakeup (LID, RTC, whatever), but I don't remember what it was.

Well, that's not really sufficient. There can be multiple
CLOCK_BOOTTIME_ALARM in place, and even if ACPI tells us that a timer
caused the wakeup this wouldn't tell us which timer it was, ours, or
some other timer...

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [hybrid-sleep] hibernation delay

2014-06-20 Thread Lennart Poettering
On Fri, 20.06.14 16:32, Mantas Mikulėnas (graw...@gmail.com) wrote:

  On Fri, 13.06.14 18:54, Tom Sherpen (tomsher...@mail.com) wrote:
 
 Hi,
 
 I am wondering if hybrid-sleep could support a hibernation delay, 
  similar
 to what is found in pm-utils [1]
 
 Thus, you would be able to first suspend, with the machine going
 automatically into hibernation after a certain amount of time.
 
 Is support for such a hibernation delay planned for the future?
 
  This is currently not implemented. We could certainly add something like
  this to the systemd-sleep binary, however, I am not entirely sure how to
  do this reliably: if we do this in userspace, and first set up a timer
  that will resume the machine, then go to suspend, how do we figure out
  after resume whether we resumed because of this timer (and hence we
  should go to hibernation, immediately) or because of some user activity?
 
 I think this is usually done by comparing if the clock after wakeup ==
 (clock before wakeup + hibernation delay + ...maybe clock drift?).
 
 [In other words, ugly hack from before s2both days.]

So you mean that we should check if after wakeup the time is within a
5min window or so around the time we set our timer to, and if that's the
case, then we assume we woke up because of this timer-hybrid-sleep
thing? That sounds awfully black-magicy to me. If people happen to
manually resume the machine precisely in that 5min window then the
machine will immediately go to hibernation. That sounds really wrong to
me.

I am really not a fan of mechanisms that usually work, but sometimes
don't. That's nothing I want to support. Sorry. 

If you can provide me with a kernel API or so that precisely tell us
that one specific timerfd or so caused a resume, then I am all ears, but
otherwise this is not going to happen. Sorry.

If there's value in implementing something like this, then fix the
kernel first, and we will make use of it. But we will not work-around
lack of support from the kernel for this kind of thing.

Sorry,

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [hybrid-sleep] hibernation delay

2014-06-16 Thread Tom Sherpen
Hi Zbyszek,

Thanks for your positive response. Very appreciated!
 
Unfortunately I cannot contribute with any coding but would definitely be able 
for testing such an implementation.

Looking forward to someone taking up on this feature.

~ Tom 

Sent: Monday, June 16, 2014 at 1:47 AM
From: Zbigniew Jędrzejewski-Szmek zbys...@in.waw.pl
To: Tom Sherpen tomsher...@mail.com
Cc: systemd-devel@lists.freedesktop.org
Subject: Re: [systemd-devel] [hybrid-sleep] hibernation delay
On Sat, Jun 14, 2014 at 02:35:31PM +0200, Tom Sherpen wrote:
 Hi,
  
 I am wondering if hybrid-sleep could support a hibernation delay, similar to 
 what is found in pm-utils [1]
  
 Thus, you would be able to first suspend, with the machine going 
 automatically into hibernation after a certain amount of time.
  
 Is support for such a hibernation delay planned for the future?
This (i.e. hybrid mode in which suspend is entered first, and after a
while, full hibernation) would be a useful feature. I don't think
anyone is working on anything like this though.

Zbyszek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [hybrid-sleep] hibernation delay

2014-06-15 Thread Zbigniew Jędrzejewski-Szmek
On Sat, Jun 14, 2014 at 02:35:31PM +0200, Tom Sherpen wrote:
 Hi,
  
 I am wondering if hybrid-sleep could support a hibernation delay, similar to 
 what is found in pm-utils [1]
  
 Thus, you would be able to first suspend, with the machine going 
 automatically into hibernation after a certain amount of time.
  
 Is support for such a hibernation delay planned for the future?
This (i.e. hybrid mode in which suspend is entered first, and after a
while, full hibernation) would be a useful feature. I don't think
anyone is working on anything like this though.

Zbyszek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [hybrid-sleep] hibernation delay

2014-06-14 Thread Tom Sherpen
Hi,
 
I am wondering if hybrid-sleep could support a hibernation delay, similar to 
what is found in pm-utils [1]
 
Thus, you would be able to first suspend, with the machine going automatically 
into hibernation after a certain amount of time.
 
Is support for such a hibernation delay planned for the future?
 
Thanks!
 
Tom
 
[1] http://www.webupd8.org/2012/11/how-to-use-hybrid-suspend-in-ubuntu.html
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [hybrid-sleep] hibernation delay

2014-06-13 Thread Tom Sherpen
Hi,



I am wondering if hybrid-sleep could support a hibernation delay, similar to what is found in pm-utils [1]



Thus, you would be able to first suspend, with the machine going automatically into hibernation after a certain amount of time.



Is support for such a hibernation delay planned for the future?



Thanks!



Tom



[1] http://www.webupd8.org/2012/11/how-to-use-hybrid-suspend-in-ubuntu.html
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel