Author Topic: hibernation would save a lot of time  (Read 32982 times)

Matthew

  • Douchebag
  • Addicted
  • *
  • Posts: 567
    • View Profile
Re: hibernation would save a lot of time
« Reply #15 on: December 17, 2007, 07:32:57 pm »
Have you guys looked at the Fiire PCs advertised as MD? They consume <15w a piece (iirc) when powered on, I agree the load times can be long when booting, but honestly, your TV probably pulls as much power as one of them when its "OFF".

Every little bit counts, especially when they're drawing power 24/7/365. One compelling app for LMCE's home automation is actually shutting down power to all appliances, including their "always on" AC/DC adapters.

chrisbirkinshaw

  • Guru
  • ****
  • Posts: 431
    • View Profile
Re: hibernation would save a lot of time
« Reply #16 on: December 17, 2007, 11:22:05 pm »
I have tried to use ACPI S3 sleep but don't think it's going to work with a diskless system. The reason being that it seems you need to unload network driver modules to get sleep to work properly. Obviously this can't be done as if you lose network connectivity your MD is totally dead!

Chris

Matthew

  • Douchebag
  • Addicted
  • *
  • Posts: 567
    • View Profile
Re: hibernation would save a lot of time
« Reply #17 on: December 18, 2007, 12:19:52 am »
I have tried to use ACPI S3 sleep but don't think it's going to work with a diskless system. The reason being that it seems you need to unload network driver modules to get sleep to work properly. Obviously this can't be done as if you lose network connectivity your MD is totally dead!

Some ethernet chips and motherboards support "Wake on LAN" even while in ACPI S3.

chrisbirkinshaw

  • Guru
  • ****
  • Posts: 431
    • View Profile
Re: hibernation would save a lot of time
« Reply #18 on: December 19, 2007, 12:57:22 am »
If you unload the net module, then after wake-on-lan how is the machine going to reload it when the root partition is not available?

Chris

colinjones

  • Alumni
  • LinuxMCE God
  • *
  • Posts: 3003
    • View Profile
Re: hibernation would save a lot of time
« Reply #19 on: December 19, 2007, 06:03:46 am »
ACPI S3 is when almost everything is powered down (including CPU) except RAM and its refresh. Core memory is retained, and the OS is still loaded along with any other applications, processes and data. So waking from this is easy even if the network modules are unloaded. The system is still there and ready to run, so as soon as it returns from S3, it just needs to reload the network driver modules and you're away again. You don't have to have the network available to reload these modules, because the system is still running.

sambuca

  • Guru
  • ****
  • Posts: 462
    • View Profile
Re: hibernation would save a lot of time
« Reply #20 on: December 20, 2007, 11:10:53 am »
Hi all

I have been following this thread closely, as I like the idea of suspending the MD. (Personally, I will probably leave the core on all the time, and thus my focus is the MD)

My motivation is twofold:
1) the power saving as others have mentioned,
2) reducing start up time for the MDs (time from no power to lmce started)
Currently my MD network boots in about 2 minutes, perhaps not much, but if I am to convince my wife to use LMCE to play DVDs, it has to start more like a DVD player (in a matter of seconds, not minutes).

So, partly motivated by this thread, I started out, trying to suspend my MD. Currently I can suspend it to RAM (also called S3), and restart it by wake-on-lan or by pressing the power button. (it restarts in  about 3-4 seconds  :D )

Here's how:
On the MD;
Make sure uswsusp is installed (I installed both hibernate and uswsusp)
See http://en.opensuse.org/S2ram for more information how to set this up.
If you are using a nVidia card read this; http://en.opensuse.org/NVidia_Suspend_HOWTO on how to suspend with nvidia. In short, add Option "NvAGP" "1" to the device section of xorg.conf and make sure no *vendor* agp modules are loaded (but agpgart is OK).
Then I run:
    ethtool -s eth0 wol ug
    s2ram -f
and my MD suspends to RAM. The above is what my MD needed, you might not have to use the -f (force) flag on s2ram if your hardware is recognized as supported by s2ram. I needed to enable wake-on-lan with the ethtool command, as it would not wake on lan if not. (probably LMCE sets this up when shutting down).

As always, the whole suspend thing is very dependent on the hardware you have, so you may not be this lucky. Also make sure your BIOS power setting are correctly set up for suspend to ram.
(My hardware is a MSI mainboard with SIS961 chipset, a Realtek 8169 network card and a nvidia Geforce4 MX 440)

My next idea is to try to have the MD suspend to a flash disk ,to keep the MD as silent as possible and reduce the power use even more. But I have to buy a flash disk and CF to IDE adapter first.

What I would like now is to have the suspend options available from within LMCE. The power menu would be a good place to put something like this. But I also like the idea of having the power button on the remote suspend it. After pressing the power button, the user should get a confirmation question and an option to choose which suspend (ram/disk) he/she would like. Unfortunately, I have not got the slightest idea of how to add such a menu option. I hope someone else takes the challenge  ;)

Anyone have any data on the power usage in full-power vs. suspend to ram vs. suspend to disk vs. power-off ?

sambuca

Matthew

  • Douchebag
  • Addicted
  • *
  • Posts: 567
    • View Profile
Re: hibernation would save a lot of time
« Reply #21 on: December 20, 2007, 04:33:17 pm »
I have been following this thread closely, as I like the idea of suspending the MD. (Personally, I will probably leave the core on all the time, and thus my focus is the MD)
(...)
So, partly motivated by this thread, I started out, trying to suspend my MD. Currently I can suspend it to RAM (also called S3), and restart it by wake-on-lan or by pressing the power button. (it restarts in  about 3-4 seconds  :D )

Here's how:

That's excellent work. Would you update the wiki with the instructions? If you could include a test for each major step in the process, that would be a great HowTo.


My next idea is to try to have the MD suspend to a flash disk ,to keep the MD as silent as possible and reduce the power use even more. But I have to buy a flash disk and CF to IDE adapter first.

Can't you suspend to a USB Flash drive? FWIW, I'd love to see a Flash drive with bootable LMCE installed , so any PC can be booted as an LMCE MD, even across the Internet. Please keep us posted.


What I would like now is to have the suspend options available from within LMCE.

Would you create a feature request in Mantis, pointing at the work you've done getting "under the hood" working? That's the best way to get the LMCE dev team working on it. They'll probably have some time after they get out v0710 (soon enough). And at that time the dev team will probably be open more to the public, so discussions and work like this can come with more access to the project content.

sambuca

  • Guru
  • ****
  • Posts: 462
    • View Profile
Re: hibernation would save a lot of time
« Reply #22 on: December 20, 2007, 07:05:38 pm »
That's excellent work. Would you update the wiki with the instructions? If you could include a test for each major step in the process, that would be a great HowTo.
I added a page http://wiki.linuxmce.org/index.php/Suspend with the how to. I adjusted it a bit to make it more elegant. Now you just have to type hibernate-ram, and wol is automatically set up.

Can't you suspend to a USB Flash drive? FWIW, I'd love to see a Flash drive with bootable LMCE installed , so any PC can be booted as an LMCE MD, even across the Internet. Please keep us posted.
I suppose you could have bootable USB flash version of the LMCE kernel, that loads a suspended image also from the flash disk, but you might run into trouble with IP addresses if you resume the image from a different network or location. I'm not sure though, so it might work.

Would you create a feature request in Mantis, pointing at the work you've done getting "under the hood" working?
I will do that.

Since my last post, I did some research on suspend to disk, using a SATA hard drive installed in the MD. I did not manage to get it to resume after suspending, but I think I know why. The SATA disk requires a driver which is loaded as a module, and at the point where the kernel tries to load the resume image, it hasn't loaded that driver yet. A solution might be to install a IDE disk just for testing, or to rebuild the kernel.

I also found out that there are a few different programs which manages the suspend/resume process, and it seems that the standard LMCE kernel uses the swsusp program. I guess this means that the suspend to disk program used needs to match the one in the kernel.

I'll keep trying..
sambuca

Matthew

  • Douchebag
  • Addicted
  • *
  • Posts: 567
    • View Profile
Re: hibernation would save a lot of time
« Reply #23 on: December 20, 2007, 08:20:11 pm »
Can't you suspend to a USB Flash drive? FWIW, I'd love to see a Flash drive with bootable LMCE installed , so any PC can be booted as an LMCE MD, even across the Internet. Please keep us posted.
I suppose you could have bootable USB flash version of the LMCE kernel, that loads a suspended image also from the flash disk, but you might run into trouble with IP addresses if you resume the image from a different network or location. I'm not sure though, so it might work.

It's probably about as easy to switch the BIOS to netboot the MD from the core, instead of booting from USB (especially if the USB isn't already higher priority for booting in the BIOS). But I'd like to carry a USB that I could use to boot a local MD for use with my LMCE even across the Internet (bandwidth allowing). Which doesn't really require booting a suspended image, but rather just any bootable image would be OK. OTOH, resuming from suspend on USB would be really fast. A bootloader could quickly update the resumed image by rerunning dhclient and ntp, I believe.

I'll keep trying..

Thanks. Best of luck, and keep us posted.

chrisbirkinshaw

  • Guru
  • ****
  • Posts: 431
    • View Profile
Re: hibernation would save a lot of time
« Reply #24 on: December 21, 2007, 01:59:10 am »
ACPI S3 is when almost everything is powered down (including CPU) except RAM and its refresh. Core memory is retained, and the OS is still loaded along with any other applications, processes and data. So waking from this is easy even if the network modules are unloaded. The system is still there and ready to run, so as soon as it returns from S3, it just needs to reload the network driver modules and you're away again. You don't have to have the network available to reload these modules, because the system is still running.

I'd let you have that.. if you could explain how the network module is going to be loaded without the root partition mounted. The network module is not in memory - you have removed it - so it needs to be loaded from the root partition, which is on the core. In a diskless boot no files are held locally unless they are loaded in memory. Once you remove the network connection from an MD it is totally useless - try it!



chrisbirkinshaw

  • Guru
  • ****
  • Posts: 431
    • View Profile
Re: hibernation would save a lot of time
« Reply #25 on: December 21, 2007, 02:16:42 am »
After following the wiki instructions I can now suspend my MD without removing the network driver!

Amazing! Thanks!



colinjones

  • Alumni
  • LinuxMCE God
  • *
  • Posts: 3003
    • View Profile
Re: hibernation would save a lot of time
« Reply #26 on: December 21, 2007, 06:05:07 am »
chrisbirkinshaw - actually, I meant to reload it from memory, not from the file system. Wasn't claiming to know how to actually do that! Just pointing out that RAM would still be intact, so if you left the module in memory somehow, you wouldn't need the network/filesystem. Seems you have got it to work now anyway - sounds like it didn't need actually to be unloaded in the first place, so obviously that's an even better solution :)

chrisbirkinshaw

  • Guru
  • ****
  • Posts: 431
    • View Profile
Re: hibernation would save a lot of time
« Reply #27 on: December 21, 2007, 12:02:46 pm »
Yeah, having a suspend to USB as suggested would solve this problem and reduce power use further. btw anyone know what the saving would be compared to suspend to ram?

sambuca

  • Guru
  • ****
  • Posts: 462
    • View Profile
Re: hibernation would save a lot of time
« Reply #28 on: December 21, 2007, 12:39:43 pm »
Yeah, having a suspend to USB as suggested would solve this problem and reduce power use further. btw anyone know what the saving would be compared to suspend to ram?


Happy to see you got suspend working.

When suspending to disk/USB, the system would go into the S4 power state as defined in the ACPI standard, which resembles the normal power-off mode, where only a small amount of power is used to allow various devices to power on the computer (keyboard, network, soft-power button etc..) So the difference between suspend to ram (S3) and to disk would be the power drawn by the memory refresh of S3.

This page has some information about power usage http://michaelbluejay.com/electricity/computers.html of Dell PCs. Sleep (S3) uses 1-6W and poweroff (or S4) uses from 0.7 to 2.5W.

The ACPI standard and power modes are described here: http://en.wikipedia.org/wiki/ACPI

sambuca

Matthew

  • Douchebag
  • Addicted
  • *
  • Posts: 567
    • View Profile
Re: hibernation would save a lot of time
« Reply #29 on: December 21, 2007, 04:29:10 pm »
Yeah, having a suspend to USB as suggested would solve this problem and reduce power use further. btw anyone know what the saving would be compared to suspend to ram?


Happy to see you got suspend working.

When suspending to disk/USB, the system would go into the S4 power state as defined in the ACPI standard, which resembles the normal power-off mode, where only a small amount of power is used to allow various devices to power on the computer (keyboard, network, soft-power button etc..) So the difference between suspend to ram (S3) and to disk would be the power drawn by the memory refresh of S3.

This page has some information about power usage http://michaelbluejay.com/electricity/computers.html of Dell PCs. Sleep (S3) uses 1-6W and poweroff (or S4) uses from 0.7 to 2.5W.

The ACPI standard and power modes are described here: http://en.wikipedia.org/wiki/ACPI

sambuca

If MDs can suspend to S4, and consume only &lte;1W, they can comply with the IEA's One Watt Initiative. That global energy conservation programme targets the ~10% of all energy household consumed that's in standby, maybe ~1% of all CO2 generated by humans (about 1/3 of what all air travel generates). In Germany alone, standby is 20TWh:y (4% of total), 14Mt:y CO2. I don't exepct that LMCE MDs will become popular enough to eliminate as much CO2 pollution as removing 18M cars from the OECD countries would, but a man can dream :). Realistically, all that power costs money, every little bit helps, and competing with non-LMCE MDs will make LMCE look great. Especially if it can qualify for the branding of this global "One Watt" performance.

Going even further, what about suspending to USB/Flash, then using home automation to cut power completely? LMCE scenarios should be able to sync the operations, then turn power back on right before sending a Wake on LAN packet, then resuming from Flash. Even appliances like projector TVs that need to "warm up" can be prepowered to accommodate, but not left on all the time. With followme presence detection, that kind of combo (including for appliances not even needing suspend/resume) could make tremendous cuts in energy consumption, with no effort by the users, and usually not even noticing it's going on "behind the scenes".

Since LMCE will make all these appliances more fun, LMCE will be a reason to use them a lot more. So if LMCE can include systems that actually make that increased usage also reduce power consumption from before they were "smart", it would make my conscience (and my environment) a lot clearer.