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

dragon_788

  • Regular Poster
  • **
  • Posts: 15
    • View Profile
Re: hibernation would save a lot of time
« Reply #30 on: December 21, 2007, 07:01:17 pm »
OK, now you guys have me sold, going from 100W+ to 15-20W would be great, but I can't argue that going down to 1W or zero power use would totally rock, especially if LinuxMCE could coordinate the entire house to dynamically power completely off and back on using Follow me. I think the downside would be that would introduce a significant delay when walking into a room with a slightly older projector or TV that needs to warm up, but the power savings would probably be worth it. The other big issue then would be making sure the MD could boot completely in the time it takes the TV to warm up, because the present slow boot is horrendous.

joesd72

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: hibernation would save a lot of time
« Reply #31 on: December 22, 2007, 07:59:43 am »
I'm not big on the whole earth worship thing, but I guess lower electric bills would be nice. I skimmed most of the post and was wondering if someone looked into suspend to disk and use a SSD (solid state disk) drives or for a little less $$ you could use a Compaq flash with a CP flash -to- SATA adapter for the HD. It would achieve a huge disk performance and less power consumption without having to have a fast enough USB drive hanging out of your MD. I don't think the HD on a MD need to be that large at all. and it can be used as a primary drive on the core, put the media on a traditional drive or on a NAS that will allow the drives to spin down when not active.

I know other places people are already slipping theses solutions into Laptops to make the batt last longer and the system perform faster. Switching to one of these alone might be a step in the direction you want before even adding the suspend/hibernate option. 
« Last Edit: December 22, 2007, 08:07:39 am by joesd72 »

chrisbirkinshaw

  • Guru
  • ****
  • Posts: 431
    • View Profile
Re: hibernation would save a lot of time
« Reply #32 on: December 22, 2007, 01:53:15 pm »
I'm not big on the whole earth worship thing, but I guess lower electric bills would be nice.

If you hadn't got that in there people might have (oh no!!) assumed you thought that saving the Earth's resources and stopping the destruction of millions of species of animals was a worthwhile cause. Imagine that! Phew!


joesd72

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: hibernation would save a lot of time
« Reply #33 on: December 22, 2007, 03:43:22 pm »
I'm not big on the whole earth worship thing, but I guess lower electric bills would be nice.

If you hadn't got that in there people might have (oh no!!) assumed you thought that saving the Earth's resources and stopping the destruction of millions of species of animals was a worthwhile cause. Imagine that! Phew!

My bad. I’ll try again.

SSD or a CF flash with a SATA adaptor will be a big step in LMCE and any area of PC development to make them more power conscious and perform better.

That’s the suggestion; let’s discuss that regardless of personal beliefs, faiths, movements were sympathetic to, sexual preferences, political affiliations, or any other divisive factors.

If you can’t handle a tongue and cheek comment from someone who doesn’t accept that mankind are a virus out to destroy the planet; maybe there needs to be a disclaimer that states only conformist allowed.

sambuca

  • Guru
  • ****
  • Posts: 462
    • View Profile
Re: hibernation would save a lot of time
« Reply #34 on: December 22, 2007, 04:11:53 pm »
After playing with suspend to RAM a while, I found two things that needs some tweaking. Anyone else seen any problems ?

First, sometimes when I suspend the MD, it wakes up after only a few seconds. It seemed the network card was waking it up. So I changed the type of communication that would wake it up from "ug" to just "g": ethtool -s eth0 wol g
Now it just wakes up when receiving a magic packet.

The other thing is that the lirc_serial needs reloading after resuming. I added a section about this in the wiki. Not sure if all lirc modules need reloading, but at least the lirc_serial module needs it.

I dont know if the lirc stop and start stuff are the correct LMCE way of doing things wrt. configuration etc. Please let me know if I should do simething different.

I also did some more research on suspend to disk. It might be possible to re-try resuming from a suspended image at a later time in the boot process, when the requried disk drivers has been loaded. However, this means we need to do changes to the initramfs. I havent got that far yet, but I guess I will try it at some point. ("If it ain't broken, fix it till it is"  ;) ) I havent found any good guides on how to do this either..

chrisbirkinshaw

  • Guru
  • ****
  • Posts: 431
    • View Profile
Re: hibernation would save a lot of time
« Reply #35 on: December 22, 2007, 04:17:06 pm »
Ok, cool.

Do we still think it's worth going for suspend though, when the saving is in the region of about 1 watt and the resume time will be much longer? (shift 1G RAM in and out of HDD)

BTW I had to create a script which killed and restarted the X server after wake from sleep:

Code: [Select]
#!/bin/sh
/usr/sbin/hibernate-ram
/usr/pluto/bin/Stop_X.sh
/usr/pluto/bin/Start_X.sh


The problem I was seeing was that the orbiter seemed to be working, and typing "screen -r" showed all the usual suspects were running, but I could not get video or tv to start. I could still control lights though. I tried doing a quick reload router, and refresh and regen this orbiter, but the messages never reached the core (not sure if they should actually) and nothing happend. Also quitting out to the launch manager and clicking "Start Orbiter" had no effect. In the orbiter log it registered that it had started ok however!


Matthew

  • Douchebag
  • Addicted
  • *
  • Posts: 567
    • View Profile
Re: hibernation would save a lot of time
« Reply #36 on: December 22, 2007, 04:55:19 pm »
If you can’t handle a tongue and cheek comment from someone who doesn’t accept that mankind are a virus out to destroy the planet; maybe there needs to be a disclaimer that states only conformist allowed.

That's "tongue in cheek". Proper idioms are politically correct, English nonconformist! ;)

Personally, I think that the prospect of lowering energy consumption by several percent in any scope of operation is good for everyone. Even those superstitious people who believe that electronic devices last forever.

sambuca

  • Guru
  • ****
  • Posts: 462
    • View Profile
Re: hibernation would save a lot of time
« Reply #37 on: December 23, 2007, 11:57:00 pm »
BTW I had to create a script which killed and restarted the X server after wake from sleep:

Code: [Select]
#!/bin/sh
/usr/sbin/hibernate-ram
/usr/pluto/bin/Stop_X.sh
/usr/pluto/bin/Start_X.sh
Hmm, I have not seen this behaviour on my system. How do you suspend? I switch to a console session before suspending, perhaps you suspend from within your X session? Not sure if this should matter, because I think the suspend script switches to a console session before suspending anyway.

Either way, you could create a script like the lirc module loading/unloading to stop and start your X server. This way, it will be taken care of automatically when hibernating. I suppose a LMCE implementation (from a  menu) would just call hibernate-ram or hibernate-disk, based on user choice. So making a script like this will make this transparent from a LMCE integration's point of view.

I also got hibernation (suspend to disk) to work. I'll do a write-up on this after Christmas, I guess the next days will be a bit busy..

Merry Christmas to all!  :)

sambuca

  • Guru
  • ****
  • Posts: 462
    • View Profile
Re: hibernation would save a lot of time
« Reply #38 on: January 08, 2008, 09:02:58 pm »
Hi all,

As promised before Christmas, I would post information about suspend to disk. I currently have a SATA HDD in my MD from before I started using LMCE, so I am using that as a swap partition (for suspend to disk). I plan on buying a CF card and CF/IDE adapter and test this, but I don't see any reason why this should not work as well. As far as I know, this will just be detected in the kernel as a normal IDE disk (or SATA, if you have a CF/SATA adapter).

Please note that I have been trying a few things before I ended up with this solution, so please tell me if something is not working, and I will try to figure out what I missed in the howto.

The information has been added to the wiki http://wiki.linuxmce.org/index.php/Suspend.

After using suspend for a while, I discovered some problems with playing music after resuming (did not try video or TV). It might be the same problem as you had, chrisbirkinshaw. I also restarted the X server, and all seemed to work again. Not sure why. Anyway, I suppose we need to inform the core about the MD suspending, so it knows that it needs to wake it if it needs to access the MD. Maybe the problem with audio/video is related to the fact that this happens without the core really knowing, and that it somehow messes things up in the Orbiter or Application server.

chrisbirkinshaw

  • Guru
  • ****
  • Posts: 431
    • View Profile
Re: hibernation would save a lot of time
« Reply #39 on: January 22, 2008, 09:12:22 pm »
Well, I'm still actually having problems!

When the MD wakes from sleep the app server is not running. I can't find any clean way to restart it either.

Any ideas?

Cheers,

Chris


sambuca

  • Guru
  • ****
  • Posts: 462
    • View Profile
Re: hibernation would save a lot of time
« Reply #40 on: January 24, 2008, 09:35:24 am »
Chris,

This may well be the same problem I am having, but it appears it sometimes does work when resuming. I have not idea about when it works and when it don't. I was thinking that it may be dependent on the amount of time the MD has been suspended, but this is just a wild idea, I have no knowledge to support it.

Is this consistent with what you see? Or is the AppServer always dead when resuming, no matter how long it was suspended? Or perhaps it is completely random?

I might have time to look into it during the weekend. I will of course post if I discover anything.

sambuca

Matthew

  • Douchebag
  • Addicted
  • *
  • Posts: 567
    • View Profile
Re: hibernation would save a lot of time
« Reply #41 on: January 24, 2008, 05:21:18 pm »
What would it take to package MD hibernation/wakeup into the MD device itself, so it could be controlled from the Floorplan? And then controlling floorplan devices with presence info.

chrisbirkinshaw

  • Guru
  • ****
  • Posts: 431
    • View Profile
Re: hibernation would save a lot of time
« Reply #42 on: January 26, 2008, 01:29:58 am »
Sambuca,

It appears to work fine if I just sleep it for a few minutes when testing. but it's not girlfriend-proof (!). When she turns it on the next day it doesn't work...

So has anyone got wakeup to work reliably? It looks like we may not have cracked this after all. Is waking from suspend to disk any different?

Chris

btw I have another machine which hangs at the unloading modules stage of sleep preparation. Is there a way to debug and find out which module if failing to unload?

sambuca

  • Guru
  • ****
  • Posts: 462
    • View Profile
Re: hibernation would save a lot of time
« Reply #43 on: January 26, 2008, 12:04:58 pm »
Chris,

This seems to be the same behaviour I experience. For me, suspend to disk works the same as suspend to RAM.

So this strengthens my suspicion that the AppServer somehow gets "out of tune" with the core during long periods of sleep. I'll see what I can find out, but I suspect we need to have someone with a better understanding of the AppServer/DCE router stuff to look into it.

Regarding debugging the suspending, I haven't done it myself, but I suggest you read the s2ram article linked from the wiki suspend article. From what I understand, it is often a buggy driver that causes suspend/resume to fail.

Matthew,
I suppose that by "the MD device itself" you mean the LinuxMCE/Orbiter part? (The required software packages are already available in Ubuntu, so its just a matter of installing and configuring them).

As far as integrating it into the floorplan and suspending the MD via the Orbiter (and other similar uses), I suppose one would need to have a DCE command to tell the AppServer to suspend the MD, and to add a suspend button to the Orbiter power menu, and also add a way to suspend a device from the floorplan (I see there is already a power button on the floorplan, what does this do?).

I have no knowledge about the AppServer/Orbiter, so I wouldn't know where to start such an integration, but I am a C++ programmer (rather, I did some C++ a couple of years ago) and I would probably be able to do it, given the right amount of time  ;)

Sambuca

Matthew

  • Douchebag
  • Addicted
  • *
  • Posts: 567
    • View Profile
Re: hibernation would save a lot of time
« Reply #44 on: January 26, 2008, 02:08:16 pm »
I suppose that by "the MD device itself" you mean the LinuxMCE/Orbiter part? (The required software packages are already available in Ubuntu, so its just a matter of installing and configuring them).

I mean the host PC, as controlled by the LMCE (with maybe a GUI to it in its Orbiter). I'd expect the event to work more like Home Automation, sent by a scenario from the Core under control of an Orbiter or a schedule, or maybe by a presence server detecting where people are in the Floorplan and activating MDs/lights/etc like in Get Smart.


As far as integrating it into the floorplan and suspending the MD via the Orbiter (and other similar uses), I suppose one would need to have a DCE command to tell the AppServer to suspend the MD, and to add a suspend button to the Orbiter power menu, and also add a way to suspend a device from the floorplan (I see there is already a power button on the floorplan, what does this do?).

I have no knowledge about the AppServer/Orbiter, so I wouldn't know where to start such an integration, but I am a C++ programmer (rather, I did some C++ a couple of years ago) and I would probably be able to do it, given the right amount of time  ;)

One item in my task list is to help add events to device status in the Floorplan. When I get to that, I'll look at adding a hibernate/restore command to the MD device. I'll tap you if you can help with the C++. I'm a C++ programmer myself, but there's plenty of the coding to go around.