PDA

View Full Version : Hibernation / Supsend to Disk


titan
2009-10-29, 17:33
Hi,
does or will Maemo support hibernation (suspend to disk),
which Linux supports on most PCs?

It is a very useful feature if you want keep all your applications
open and in the same state over periods of power off.

There are several scenarios in which you want or have to turn off the device but don't want to start all applications again:

* over night: saves energy and let's you sleep
* in the proximity of sensitive devices (clinic)
* battery changing

cheers

GeneralAntilles
2009-10-29, 17:41
* over night: saves energy and let's you sleep


Turning the device doesn't save power unless you're talking in terms of days.


* in the proximity of sensitive devices (clinic)
* battery changing


Shutting down and restarting is probably faster than hibernating, honestly.

titan
2009-10-29, 17:55
Turning the device doesn't save power unless you're talking in terms of days.


after recharging the battery in the evening
I see no point in keeping the device on during my sleep.
I don't mean saving battery power but energy in general.

I know some people are used to keeping all devices on (TV)
even if they leave their house but some people are more environmentally aware.


Shutting down and restarting is probably faster than hibernating, honestly.

speed is not an issue here. I just don't to restore all applications and their states (e.g. open terminals, website position) whenever I power it on again. And think we cannot realistically expect all applications to support proper session management.

debernardis
2009-10-29, 17:59
Though, I'd like hibernation very much. At least to change battery when the first one is dead.
Could be an interesting project when my N900 is available; maybe tough too.

hqh
2009-10-29, 18:02
I don't mean saving battery power but energy in general.


Saving battery means saving energy in general...

AFAIK, booting the device up consumes so much power that you're doing better by keeping the device in offline mode over night.

GeneralAntilles
2009-10-29, 18:30
I know some people are used to keeping all devices on (TV)
even if they leave their house but some people are more environmentally aware.


Ah, yes, this is a productive way to have a discussion.

Saving battery means saving energy in general...

AFAIK, booting the device up consumes so much power that you're doing better by keeping the device in offline mode over night.

Yes, this is the case.

sjgadsby
2009-10-29, 19:43
does or will Maemo support hibernation (suspend to disk)...

Well, there had been some work on suspending to RAM (https://garage.maemo.org/projects/n800-s2ram/) during the Chinook/early-Diablo era. I don't know of anyone working on anything similar for Maemo 5 though.

Suspension to RAM/disk would probably be best as a Brainstorm idea at this point.

Matan
2009-10-29, 21:03
Turning the device doesn't save power unless you're talking in terms of days.


This is wrong for the 770/N800/N810, and even more wrong for the N900 with its (supposedly) better processor and power hungry radios.
See here for a simple calculation:
http://talk.maemo.org/showthread.php?p=297639#post297639


Shutting down and restarting is probably faster than hibernating, honestly.

The advantage of hibernation is not only in the very little time it might save, but in the fact that you get your computer in the same state as you left it - same programs open with the same documents in the same locations, etc.

GeneralAntilles
2009-10-29, 21:32
This is wrong for the 770/N800/N810, and even more wrong for the N900 with its (supposedly) better processor and power hungry radios.
See here for a simple calculation:
http://talk.maemo.org/showthread.php?p=297639#post297639


Video playback does not use the same amount of power as bootup. Either way, I'm more inclined to trust the kernel engineers at Nokia who live and breath this stuff than some random estimates on a web forum. :)

Matan
2009-10-29, 22:14
Video playback does not use the same amount of power as bootup. Either way, I'm more inclined to trust the kernel engineers at Nokia who live and breath this stuff than some random estimates on a web forum. :)

Well, if they tell you that 1+1=3 and you trust them, good for you.

Please ask them what is the system current draw at idle, and during shutdown./boot. Then do the math.

javispedro
2009-10-29, 22:16
My empiral evidence (aka my anecdote) is that the four reboots is enough to bring the N810 battery to its knees.

Without rebooting, it lasts around two days of medium use, and a week of light use.

Faz
2009-10-29, 22:47
Interesting idea.

I have a feeling that switching to off-line mode would conserve more power overnight than hibernating. Although the internal storage "disk" has no moving parts, I'm guessing that writing, then reading back on restore, 256 MB is still relatively power hungry? Plus the additional overheads on both sides.

I really doubt Suspend would be worth it either, as power conservation has always been a top priority for Maemo. I guess switching to off-line mode overnight would gain that tiny bit extra and is effectively Standby mode, as there would be no need for the device to perform any actions so virtually no power consumption from internal components.

I do like the idea of Hibernation for battery swaps though. Not an issue for my current usage of N810 + E90, but could see this occuring with the N900 as my single device, with all that gorgeous computing power at my disposal 24/7 - I feel almost obliged to use it to it's max! :D

javispedro
2009-10-29, 22:51
Hildon has already a framework for battery swapping "hibernation". I've never seen it working, though (save when you don't have swap enabled and ZZZ appears on a task switcher icon).

GeneralAntilles
2009-10-29, 22:52
Well, if they tell you that 1+1=3 and you trust them, good for you.


Yes, because your "here's some math I did in my head with numbers I've estimated and numbers I've guessed" is so convincing.


Please ask them what is the system current draw at idle, and during shutdown./boot. Then do the math.

I'd rather not waste their time to have them help me win a silly forum fight.

attila77
2009-10-29, 23:06
My personal wacko EE theory is that booting is not as strenuous as it seems at first glance, but does for some reason mess up the charge indicator/battery chemistry/power management in general, which in turn can/will influence possible runtime. I'm pretty certain it's not 'straight current draw' after losing 30% battery power on a N810 reboot (that would result in a serious meltdown if true :) ), and after gaining 7% on another (unrelated) reboot.

titan
2009-10-29, 23:11
AFAIK, booting the device up consumes so much power that you're doing better by keeping the device in offline mode over night.

does hibernating really take as much power as a normal shutdown/reboot?
is hibernation more than saving used pages to flash (may be compressed), kernel init and reloading the pages from flash?

Granted, whether you can actually save power by hibernation compared to off-line mode depends on how long you don't need to use the device, but continuous discharging of the battery could also reduce battery life, correct?

However, for me the main purpose of hibernation is not necessarily to save power, but to be able to restore all application states after a period of power off.

Suppose your battery is low after a long day of intense use and you can only recharge it when you come back to your desk.
Now you have two options:

1) turn the device off and lose the session state (running applications) or

2) hibernate, and wake up as soon as it is connected to power again (or you have swapped the battery).

Don't you think that 2) would be a useful feature?

javispedro
2009-10-29, 23:14
My personal wacko EE theory is that booting is not as strenuous as it seems at first glance, but does for some reason mess up the charge indicator/battery chemistry/power management in general, which in turn can/will influence possible runtime. I'm pretty certain it's not 'straight current draw' after losing 30% battery power on a N810 reboot (that would result in a serious meltdown if true :) ), and after gaining 7% on another (unrelated) reboot.

I believe there are two issues:
- What you're explaining is correct. Even the builtin battery meter tends to keep on saying "the battery just got better" ;) up to an hour after rebooting.
- Tracker. Or metalayer or whatever it's called on Diablo. Indexing 4 GiB takes a load of time -- plenty of time to suck power without overheating anything.

I've also found a few weird things. First reboot usually shows 100% battery even if before rebooting it was at 90%. Second reboot shows half the battery. Every other reboot shows "battery low" warning. This was with around half an hour between reboots (was trying to create a hildon-desktop patch and messed something up:) ).

Faz
2009-10-29, 23:23
Granted, whether you can actually save power by hibernation compared to off-line mode depends on how long you don't need to use the device, but continuous discharging of the battery could also reduce battery life, correct?


Makes sense.


However, for me the main purpose of hibernation is not necessarily to save power, but to be able to restore all application states after a period of power off.

Suppose your battery is low after a long day of intense use and you can only recharge it when you come back to your desk.
Now you have two options:

1) turn the device off and lose the session state (running applications) or

2) hibernate, and wake up as soon as it is connected to power again (or you have swapped the battery).

Don't you think that 2) would be a useful feature?

Agreed.

www.rzr.online.fr
2009-10-29, 23:59
Hibernate would be neat sure, but i know that resurecting is causing lot of issue specially with some hardware ...

But if it saves the batteries it would reduce flash life...

Talking about that, is powertop available for ARM ?

nashith
2009-10-30, 07:45
This would be a very interesting feature, not seldom used a lot, but there are several circumstances I wish I could just remove the battery/change SIM without going through a full reboot. Could be a nice feature to be implemented by the community. Any coders around for it?

ossipena
2009-10-30, 07:52
This would be a very interesting feature, not seldom used a lot, but there are several circumstances I wish I could just remove the battery/change SIM without going through a full reboot. Could be a nice feature to be implemented by the community. Any coders around for it?

http://talk.maemo.org/showthread.php?t=32167

e: and here's straight answer:

Hibernation and most suggestions on lesswats.org aren't or are barely interesting on ARM and other mobile/embedded devices. You'd need to write all the data in RAM to swap, and read all that again when powering it up. That uses a lot time, and also resources/juice, while the ARM in idle mode barely uses juice. You might as well leave no application open instead, put all receivers and transmitters off, or only leave voice open for phone/SMS, or suspend an application which uses a lot of resources. When battery almost empty Symbian has option to disable cellular data. Alternatively, something like powertop or iotop or htop could help debug (in SDK or on real device). All these 3 run on Linux/ARM.

http://talk.maemo.org/showpost.php?p=337938&postcount=25

pycage
2009-10-30, 07:58
Talking about that, is powertop available for ARM ?

Yes, the N900 comes with it.

Matan
2009-10-30, 14:56
Trying to make the discussion of power consumed during reboot experimental, rather than theortical or mythological, I ran my N810 through reboot loops. Here are the results:

No route to host is when the N810 did not boot after it powered off for some reason.

The results of the experiment are that the battery managed 44 reboot cycles. If we take the official 240 hours standby time, it means that a reboot cycle is equivalent to about 5.5 hours of standby.


14:11:10:~$ for i in `seq 1 100` ; do echo $i ; ssh n810 battery-status ; ssh n810 battery-status ; ssh n810 reboot ; sleep 150 ; done
1
[Oct 30 14:13] 99.6%
[Oct 30 14:13] 99.6%
2
[Oct 30 14:15] 99.6%
[Oct 30 14:15] 99.6%
3
[Oct 30 14:24] 99.6%
[Oct 30 14:24] 99.6%
4
[Oct 30 14:27] 99.6%
[Oct 30 14:27] 99.6%
5
[Oct 30 14:32] 99.2%
[Oct 30 14:32] 99.2%
6
[Oct 30 14:35] 99.6%
[Oct 30 14:35] 99.6%
7
[Oct 30 14:37] 99.6%
[Oct 30 14:37] 99.6%
8
[Oct 30 14:40] 99.6%
[Oct 30 14:40] 99.6%
9
[Oct 30 14:43] 99.6%
[Oct 30 14:43] 99.6%
10
ssh: connect to host 192.168.15.229 port 22: No route to host
ssh: connect to host 192.168.15.229 port 22: No route to host
ssh: connect to host 192.168.15.229 port 22: No route to host
11
ssh: connect to host 192.168.15.229 port 22: No route to host
ssh: connect to host 192.168.15.229 port 22: No route to host
ssh: connect to host 192.168.15.229 port 22: No route to host
12
[Oct 30 14:51] 99.2%
[Oct 30 14:51] 99.2%
13
[Oct 30 14:53] 99.6%
[Oct 30 14:53] 99.6%
14
[Oct 30 14:56] 99.6%
[Oct 30 14:56] 99.6%
15
[Oct 30 14:59] 99.6%
[Oct 30 14:59] 99.6%
16
[Oct 30 15:01] 99.6%
[Oct 30 15:01] 99.6%
17
[Oct 30 15:04] 99.6%
[Oct 30 15:04] 99.6%
18
[Oct 30 15:07] 99.6%
[Oct 30 15:07] 99.6%
19
[Oct 30 15:09] 99.6%
[Oct 30 15:09] 99.6%
20
[Oct 30 15:12] 55.2%
[Oct 30 15:12] 55.2%
21
[Oct 30 15:15] 50.0%
[Oct 30 15:15] 50.0%
22
[Oct 30 15:17] 52.4%
[Oct 30 15:17] 52.4%
23
ssh: connect to host 192.168.15.229 port 22: No route to host
ssh: connect to host 192.168.15.229 port 22: No route to host
ssh: connect to host 192.168.15.229 port 22: No route to host
24
ssh: connect to host 192.168.15.229 port 22: No route to host
ssh: connect to host 192.168.15.229 port 22: No route to host
ssh: connect to host 192.168.15.229 port 22: No route to host
25
[Oct 30 15:25] 99.6%
[Oct 30 15:26] 99.6%
26
[Oct 30 15:28] 47.6%
[Oct 30 15:28] 47.6%
27
[Oct 30 15:31] 45.6%
[Oct 30 15:31] 45.6%
28
[Oct 30 15:34] 39.6%
[Oct 30 15:34] 39.6%
29
[Oct 30 15:36] 35.2%
[Oct 30 15:36] 35.2%
30
[Oct 30 15:39] 32.4%
[Oct 30 15:39] 32.4%
31
[Oct 30 15:42] 38.4%
[Oct 30 15:42] 38.4%
32
[Oct 30 15:44] 28.4%
[Oct 30 15:44] 28.4%
33
[Oct 30 15:47] 27.2%
[Oct 30 15:47] 27.2%
34
[Oct 30 15:50] 23.6%
[Oct 30 15:50] 23.6%
35
[Oct 30 15:52] 28.4%
[Oct 30 15:52] 28.4%
36
ssh: connect to host 192.168.15.229 port 22: No route to host
ssh: connect to host 192.168.15.229 port 22: No route to host
ssh: connect to host 192.168.15.229 port 22: No route to host
37
ssh: connect to host 192.168.15.229 port 22: No route to host
ssh: connect to host 192.168.15.229 port 22: No route to host
ssh: connect to host 192.168.15.229 port 22: No route to host
38
[Oct 30 16:00] 32.0%
[Oct 30 16:00] 32.0%
39
[Oct 30 16:03] 26.4%
[Oct 30 16:03] 26.4%
Terminated
40
ssh: connect to host 192.168.15.229 port 22: No route to host
ssh: connect to host 192.168.15.229 port 22: No route to host
ssh: connect to host 192.168.15.229 port 22: No route to host
41
[Oct 30 16:09] 25.6%
[Oct 30 16:09] 25.6%
42
[Oct 30 16:11] 16.0%
[Oct 30 16:11] 16.0%
43
[Oct 30 16:14] 18.4%
[Oct 30 16:14] 18.4%
44
[Oct 30 16:17] 11.6%
[Oct 30 16:17] 11.6%
45
[Oct 30 16:19] 10.0%
[Oct 30 16:19] 10.0%
46
[Oct 30 16:22] 8.4%
[Oct 30 16:22] 8.4%
47
[Oct 30 16:25] 6.4%
[Oct 30 16:25] 6.4%
48
[Oct 30 16:27] 5.2%
[Oct 30 16:27] 5.2%
49
[Oct 30 16:30] 3.6%
[Oct 30 16:30] 3.6%
50
[Oct 30 16:33] 4.0%
[Oct 30 16:33] 4.0%
51
[Oct 30 16:35] 0.0%
[Oct 30 16:35] 0.0%

TA-t3
2009-10-30, 15:03
Heh, someone actually coming up with data to back up the discussion! :D
Thanks for that, very interesting. And it seems to back up the assertion that a reboot sucks about as much as the night's sleep anyway. 44 reboots, that's probably a reasonably fresh battery. The battery I finally replaced (from Jan. 2007) could only manage a couple of reboots when fully loaded, and barely a single reboot after a day.

Matan
2009-10-30, 15:30
Actually, it is an almost two years old and heavily used battery. I actually estimate that it now holds about 50% as much power as a new battery.

If you look at the battery reading, you will note that it reads the battery as full for about 15 reboots, then goes from full to 55% in one reboot, and goes approximately linearly to 0% from there.

titan
2009-10-30, 15:37
Actually, it is an almost two years old and heavily used battery. I actually estimate that it now holds about 50% as much power as a new battery.


What do you mean by "If we take the official 240 hours standby time,"? is that for a new battery or for idle mode with your old battery?

pelago
2009-10-30, 15:38
Thanks for the experimentation. Regarding:
The results of the experiment are that the battery managed 44 reboot cycles. If we take the official 240 hours standby time, it means that a reboot cycle is equivalent to about 5.5 hours of standby.

It would be useful if you could calculate how much standby time you get on that particular battery. (I realise that means you can't use the tablet for a few days!) That way you can do a more accurate calculation on how many "standby hours" a reboot is equivalent of.

TA-t3
2009-10-30, 15:45
My N800 battery didn't start to show its age until it was about 26-27 months old. Up until this I had no indication of detoriation. After this point though it became noticably worse at a rate which was visible in some 2-months steps, until it fiinally became almost unusable around now (34 months old).

titan
2009-10-31, 08:39
http://talk.maemo.org/showpost.php?p=337938&postcount=25
Originally Posted by allnameswereout:
Hibernation and most suggestions on lesswats.org aren't or are barely interesting on ARM and other mobile/embedded devices. You'd need to write all the data in RAM to swap, and read all that again when powering it up. That uses a lot time, and also resources/juice, while the ARM in idle mode barely uses juice. You might as well leave no application open instead,


hibernation is very interesting if your goal is to preserve the state of all applications during intentional (long period) or forced (battery low) power off.

I also doubt that a hibernate cycle consumes as much power as a full shutdown/boot cycle. Experiments with a Linux notebook could shed some light on that issue...

titan
2009-11-03, 18:16
There are some patches for suspend to disk for ARM/OMAP,
however, for older kernel versions:
http://elinux.org/Suspend_To_Disk_For_ARM

they claim that the snapshot boot would dramatically reduces booting time

www.rzr.online.fr
2009-11-04, 10:44
@Matan: +1 interessing experience, if someone can do it on a brand new battery / device

maybe the boot can be optimised too , i am thinking about keeping the light low as soon as possible ...

fanoush
2009-11-11, 11:32
The results of the experiment are that the battery managed 44 reboot cycles. If we take the official 240 hours standby time, it means that a reboot cycle is equivalent to about 5.5 hours of standby.

I had one spare N810 sitting idle for couple of months and I did like 4 tests and with clean firmware after fully charged it lasted about 30 days. It was not in offline mode, just not connected to wi-fi, keyboard locked. I tested it once per few days to see if it is still alive (unlock to see display for few seconds and locked again). Depending on how often I checked it it was like 28,29,30,31 days.

wotevah
2010-08-04, 04:12
I was wondering if there's been any progress on implementing suspend mode. I'd like it for flights, where you have to waste battery turning it off and on, when the next recharge may not be for a long time.

wotevah
2010-08-12, 04:18
Found an easy way to suspend to memory. It's sudo sh -c "echo mem > /sys/power/state", to add in a queenbee script widget. The phone suspends to memory immediately and can wake up instantly on power or lock or camera shutter or keyboard slide (not my choice but hey). Yeah, that means you have to use sleep in terminal mode so you have time to close the keyboard, otherwise it wakes up when you do.

There are still a few problems. One, unless it's already in offline mode, there is a good chance the phone will wake up quickly due to external (radio, wifi) events because only the CPU is asleep not the peripherals. So it's a good idea to go offline first to shut those off. Two, the phone wakes up with messed up clock (clock stops when it goes to sleep) and even automatic update doesn't fix it.

pulketo
2012-01-11, 06:23
Video playback does not use the same amount of power as bootup. Either way, I'm more inclined to trust the kernel engineers at Nokia who live and breath this stuff than some random estimates on a web forum. :)

trolling mode on?