Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Suspend/Hibernate on the PPC: swsusp2 vs. pmdisk
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Gentoo on PPC
View previous topic :: View next topic  
Author Message
DiskBreaker
Apprentice
Apprentice


Joined: 07 Oct 2003
Posts: 224

PostPosted: Thu Jul 15, 2004 12:12 pm    Post subject: Suspend/Hibernate on the PPC: swsusp2 vs. pmdisk Reply with quote

I was wondering if any other brave souls out there are experimenting with getting their Powerbooks/iBook to suspend... So far I've had some limited success, so if your're interested here is the latest status:

1. What is this all about?
Suspending is a feature most commonly known from Windows PCs & Laptops (a.k.a. Hibernate, Suspend-to-Disk). This is not to be confused with the sleep mode (a.k.a Suspend-to-RAM) that works very well on most Macs.

When suspending, all relevant contents of the RAM are written out on disk (either onto your swap partition or into a swap file) and the PC is powered down completely. The next time you boot everything is restored from Disk. Since loading some data from disk into memory is much faster than actually executing all the programs that you want to have running, suspending offers much faster boot times. Plus you can leave all your documents and stuff you are working on open and can easily resume work later.

2. The Implementations
On Linux there are currently three different implementations: swsusp, swsusp2 and pmdisk. You can find a very good comparison between the three here: http://swsusp.sourceforge.net/features.html Since they are all still experimental no final verdict has been made yet as to which one will be merged into the main 2.6 tree sometime in the future (it has been discussed a couple of times on lkml).

* swsusp aka Software Suspend - Pavel's original software suspend implementation was ACPI-dependant and would only run on limited hardware. Deprecated.
* swsusp2 aka Software Suspend 2 - Currently the most actively developed one, with Nigel Cunningham making freqent updates. It can compress the image before it is written to disk, supports swapfiles and integrates nicely with bootsplash. It also provides scripts for handling problems with driver (un)loading, partition (un)mounting etc.
http://swsusp.sourceforge.net
* pmdisk aka Suspend-to-disk - Since this was patched by benh a while ago to support ppc it is the most likely one to work but offers less features than swsusp2. It is also currently unmaintained.

3. Getting them to work

We will only consider swsusp2 and pmdisk, since swsusp is hardware dependant and deprecated. The process of getting these to work is mostly the same and requires patching your kernel. From my own experiences, pmdisk is more likely to work but swsusp2 certainly is worth a try.

Pmdisk

* Patch your kernel with the latest patch for 2.6.7
http://honk.physik.uni-konstanz.de/~agx/linux-ppc/kernel/pmdisk-2.6.7-rc2.diff
* Enable in your kernel configuration:
Code:
Platform Options --->
         [*]       Power Management suport
         [*]           Suspend-to-Disk Support
         (pmdisk=/dev/hdaXX)
                        Default Resume partition

* Compile & install the kernel, then append the following to your yaboot.conf kernel image options:
Code:
append="pmdisk=/dev/hdaXX"

(replace XX with your swap partition)
* Reboot and do a "dmesg|grep PM" to see if pmdisk is up & running
* To suspend do:
Code:
$ echo -n "disk" > /sys/power/state

(put in a shellscript and call it suspend or hibernate if you want)
* The computer should power down. When you boot it, select the same kernel image in yaboot that you suspended under and everything should restore fine.

It works quite well with my PowerBook and I can even suspend and resume under X with audio and network still working. I have noticed though that the system is a lot slower after a suspend... I will have to investigate that further. Also, now that we have bootsplash on PPC it's a shame to suspend and not have a nice bootsplash.
For reference, this is my dmesg as pmdisk suspends:
Code:
subfs exiting.
usbcore: deregistering driver usbfs
usbcore: deregistering driver hub
Stopping tasks: ====================================|
Freeing memory: ..|
eth0: suspending, WakeOnLan disabled
aty128fb: suspending...
PM: Attempting to suspend to disk.

and the dmesg upon resuming:
Code:
PM: snapshotting memory.
pmdisk: Counting pages to copy.
[nosave c02b9000]
pmdisk: (pages needed: 19669 + 512 free: 144170)
[nosave c02b9000]
PM: Image restored successfully.
Freeing prev allocated pagedir
aty128fb: resumed !
eth0: resuming
ide_pmac: Set UDMA timing for mode 4, reg: 0x0c50032b
hda: Enabling Ultra DMA 4
hdc: MDMA, cycleTime: 120, accessTime: 90, recTime: 30
hdc: Set MDMA timing for mode 2, reg: 0x00011d26
hdc: Enabling MultiWord DMA 2
Restarting tasks... done


Swsusp2

A) Official Patchset
* Patch your kernel with the latest patch for 2.6.7
http://sourceforge.net/project/showfiles.php?group_id=25964
The current version is 2.0.0.98. Download the patches, extract and then do:
Code:
/usr/src/linux $ for I in software-suspend-2.0.0.98-for-2.6.7/*;
do patch -p1 < $I; done

* Enable in your kernel configuration:
Code:
Processor --->
         [*]  Power Management suport
         [  ]    Sofware Supend (EXPERIMENTAL) <-- disable old swsusp
                 Software Supend 2 --->
                  --- Image Storage
                  [*] Swap Writer
                  --- Page Transformers
                  [*] LZF image compression
                  --- General Options
                  [*] Compile in debugging output <-- useful on first try
                  (swap:/dev/hdaXX)
                        Default resume device name

* Compile & install the kernel, then append the following to your yaboot.conf kernel image options:
Code:
append="resume2=swap:/dev/hdaXX"

(replace XX with your swap partition)
* Reboot and do a "dmesg|grep -i susp" to see if swsusp2 is up & running
* Download the suspend script: http://sourceforge.net/project/showfiles.php?group_id=25964&package_id=123426
Running it will extract a /etc/suspend.conf (you will want to edit this) and a /usr/local/sbin/hibernate script.
* You may want to "echo 9 > /proc/swsusp/default_console_level to get all the debugging info if something goes wrong
* Run /usr/local/sbin/hibernate and pray that it will work :)

On my system it hibernates fine, but on resuming the system starts to resume but then somehow goes to sleep and stays there.
Code:
Reading kernel & process data....
suspend pmu
current is 0xc19ff900
mediabay0: powering down
eth0: suspending, WakeOnLan disabled


B) Hugang's patchset
Hugang is maintaing his own patchsets of the 2.6.4 and 2.6.7 trees with swsusp2 and it seems to be working fine on his Powerbook G4. Check out his howto here:
http://swsusp.sourceforge.net/wiki/DebianStable
and his patches here:
http://soulinfo.com/~hugang/swsusp2/
I've tried them all but with the same result as above. Actually the latest 2.0.0.98 patchset seems to have incororated all the fixes that Hugang submitted to the list. There is even a "Using Software suspend replace broken sleep funtion" specifically for PPC now under Device Drivers -> Macintosh Device Drivers in all recent versions of swsusp2 that you might want to look into if even sleep is not working on your PowerBook.

4. Resources
* There has been quite a lot of discussion on this on the debian-ppc mailing list... just browse through the archives for the past few months. I wonder why this hasn't really been discussed on the gentoo ppc forum yet 8O
* For a nice user report on how he got pmdisk to work on his ibook G4 check this email to the debian-ppc list: http://lists.debian.org/debian-powerpc/2004/06/msg00464.html
* The Swsusp2 Howto, with a good troubleshooting section:
http://swsusp.sourceforge.net/Software-suspend.html
* Hugang's Howto on how to get Swsusp2 working on a PB G4: http://swsusp.sourceforge.net/wiki/DebianStable
* Swsusp2 Mailing List: http://sourceforge.net/mailarchive/forum.php?forum=swsusp-devel
* Big Gentoo Swsusp2 support thread: https://forums.gentoo.org/viewtopic.php?t=170548
* A detailed description of swsusp2's inner workings: http://kerneltrap.org/node/view/3118

I would be really interested if it works for you guys.

DiskBreaker
Back to top
View user's profile Send private message
scoobydu
Veteran
Veteran


Joined: 16 Feb 2003
Posts: 1076
Location: 'Mind the Gap'

PostPosted: Wed Aug 10, 2005 8:23 pm    Post subject: Reply with quote

Nice post DiskBreaker,

Just bought a 5,6 powerbook 15". and have pbbuttonsd working great for suspend to ram. Do you know if this suspend to disk works with pbbuttonsd? ie are they compatible?

Thanks

scooby
_________________
Tyan Tiger K8W, 2xOpteron 240,Powerbook5,6 15" 1.5g, Macbook Black 2g, Mac Mini 1g, Ipod P60g.
| Linux - From a windows user perspective|
Back to top
View user's profile Send private message
gringo
Advocate
Advocate


Joined: 27 Apr 2003
Posts: 3793

PostPosted: Thu Aug 11, 2005 10:55 am    Post subject: Reply with quote

yes, very nice post, thanx very much, didnt know about pmdisk !

How well does suspend to disk work for you guys ?? I have tried several things (not pmdisk yet) and only default kernels suspend to disk seems to work well, suspend2 does not recover the image, and simply hangs while booting when using it combined with the dyntick thingy ( from hugangs stuff).

Quote:
Do you know if this suspend to disk works with pbbuttonsd?


didnt tried myself yet but it *should* as pbbuttonsd can be configured to call suspend to disk after some time.

One thing i noticed since 2.6.12 is heavy cpu-usage from pbbuttonsd after recover form sleeping, restarting pbbuttons solves it. Didnt tried rc6 though.

cheers
Back to top
View user's profile Send private message
scoobydu
Veteran
Veteran


Joined: 16 Feb 2003
Posts: 1076
Location: 'Mind the Gap'

PostPosted: Thu Aug 11, 2005 9:38 pm    Post subject: Reply with quote

gringo wrote:
yes, very nice post, thanx very much, didnt know about pmdisk !

How well does suspend to disk work for you guys ?? I have tried several things (not pmdisk yet) and only default kernels suspend to disk seems to work well, suspend2 does not recover the image, and simply hangs while booting when using it combined with the dyntick thingy ( from hugangs stuff).

Quote:
Do you know if this suspend to disk works with pbbuttonsd?


didnt tried myself yet but it *should* as pbbuttonsd can be configured to call suspend to disk after some time.

One thing i noticed since 2.6.12 is heavy cpu-usage from pbbuttonsd after recover form sleeping, restarting pbbuttons solves it. Didnt tried rc6 though.

cheers


Hi gringo

Bit confused, you say suspend to disk works well,but then say it hangs? is that suspend2?

cheers
scooby
_________________
Tyan Tiger K8W, 2xOpteron 240,Powerbook5,6 15" 1.5g, Macbook Black 2g, Mac Mini 1g, Ipod P60g.
| Linux - From a windows user perspective|
Back to top
View user's profile Send private message
gringo
Advocate
Advocate


Joined: 27 Apr 2003
Posts: 3793

PostPosted: Fri Aug 12, 2005 8:42 am    Post subject: Reply with quote

Quote:
Bit confused, you say suspend to disk works well,but then say it hangs? is that suspend2?


yes, sorry if ive not been that clear -> suspend2 does not work here; suspend form kernel does work ;)

cheers
Back to top
View user's profile Send private message
DiskBreaker
Apprentice
Apprentice


Joined: 07 Oct 2003
Posts: 224

PostPosted: Fri Aug 12, 2005 1:28 pm    Post subject: Reply with quote

gringo wrote:
suspend2 does not work here; suspend form kernel does work ;)

:?: What is suspend from kernel?
_________________
There's too much blood in my coffeine system...
Back to top
View user's profile Send private message
gringo
Advocate
Advocate


Joined: 27 Apr 2003
Posts: 3793

PostPosted: Fri Aug 12, 2005 2:15 pm    Post subject: Reply with quote

Quote:
What is suspend from kernel?


suspend to disk included in vanila kernel.

cheers
Back to top
View user's profile Send private message
scoobydu
Veteran
Veteran


Joined: 16 Feb 2003
Posts: 1076
Location: 'Mind the Gap'

PostPosted: Sat Aug 13, 2005 8:17 am    Post subject: Reply with quote

gringo wrote:
Quote:
What is suspend from kernel?


suspend to disk included in vanila kernel.

cheers


Just for me gringo, which setting is that in the kernel? SOFTWARE_SUSPEND?

Thx
_________________
Tyan Tiger K8W, 2xOpteron 240,Powerbook5,6 15" 1.5g, Macbook Black 2g, Mac Mini 1g, Ipod P60g.
| Linux - From a windows user perspective|
Back to top
View user's profile Send private message
gringo
Advocate
Advocate


Joined: 27 Apr 2003
Posts: 3793

PostPosted: Sat Aug 13, 2005 8:53 am    Post subject: Reply with quote

in your kernel .config youll find these lines:

Code:
CONFIG_SOFTWARE_SUSPEND=y
CONFIG_PM_STD_PARTITION=""


its available in the menu too, Platform options.

cheers
Back to top
View user's profile Send private message
scoobydu
Veteran
Veteran


Joined: 16 Feb 2003
Posts: 1076
Location: 'Mind the Gap'

PostPosted: Sat Aug 13, 2005 10:03 am    Post subject: Reply with quote

gringo wrote:
in your kernel .config youll find these lines:

Code:
CONFIG_SOFTWARE_SUSPEND=y
CONFIG_PM_STD_PARTITION=""


its available in the menu too, Platform options.

cheers


Yes, they are the ones I've set. Thanks for the clarification.
_________________
Tyan Tiger K8W, 2xOpteron 240,Powerbook5,6 15" 1.5g, Macbook Black 2g, Mac Mini 1g, Ipod P60g.
| Linux - From a windows user perspective|
Back to top
View user's profile Send private message
scoobydu
Veteran
Veteran


Joined: 16 Feb 2003
Posts: 1076
Location: 'Mind the Gap'

PostPosted: Mon Aug 22, 2005 8:14 pm    Post subject: Reply with quote

Anyone got latest 2.6.13rc6 patch working at all?

Patches ok, but won't build..possibly acpi problem ... :-/
_________________
Tyan Tiger K8W, 2xOpteron 240,Powerbook5,6 15" 1.5g, Macbook Black 2g, Mac Mini 1g, Ipod P60g.
| Linux - From a windows user perspective|
Back to top
View user's profile Send private message
gringo
Advocate
Advocate


Joined: 27 Apr 2003
Posts: 3793

PostPosted: Tue Aug 23, 2005 8:41 am    Post subject: Reply with quote

Quote:
Anyone got latest 2.6.13rc6 patch working at all?


what patch do you mean ?

cheers
Back to top
View user's profile Send private message
scoobydu
Veteran
Veteran


Joined: 16 Feb 2003
Posts: 1076
Location: 'Mind the Gap'

PostPosted: Tue Aug 23, 2005 7:17 pm    Post subject: Reply with quote

gringo wrote:
Quote:
Anyone got latest 2.6.13rc6 patch working at all?


what patch do you mean ?

cheers


This one gringo (well I tried the one prior to this, but same thing!) ->

Quote:

http://www.suspend2.net/downloads/all/software-suspend-2.2-rc1-for-2.6.13-rc6.tar.bz2


Applying it to the vanilla 2.6.13-rc6 kernel in portage works ok, but build fails nearly immediately with what looks like acpi issues ..... need to check further, but just wondered if others had tried with any success?
_________________
Tyan Tiger K8W, 2xOpteron 240,Powerbook5,6 15" 1.5g, Macbook Black 2g, Mac Mini 1g, Ipod P60g.
| Linux - From a windows user perspective|
Back to top
View user's profile Send private message
gringo
Advocate
Advocate


Joined: 27 Apr 2003
Posts: 3793

PostPosted: Wed Aug 24, 2005 7:32 am    Post subject: Reply with quote

sorry, didnt playied with software suspend2 for a while, as it never worked fine here.
Anyway ... an acpi error on ppc sounds a bit scary, doesnt it ?

cheers
Back to top
View user's profile Send private message
scoobydu
Veteran
Veteran


Joined: 16 Feb 2003
Posts: 1076
Location: 'Mind the Gap'

PostPosted: Wed Aug 24, 2005 9:26 am    Post subject: Reply with quote

gringo wrote:
sorry, didnt playied with software suspend2 for a while, as it never worked fine here.
Anyway ... an acpi error on ppc sounds a bit scary, doesnt it ?

cheers


The building seems to be fixed in the latest patchset, so just rebooting to try :)
_________________
Tyan Tiger K8W, 2xOpteron 240,Powerbook5,6 15" 1.5g, Macbook Black 2g, Mac Mini 1g, Ipod P60g.
| Linux - From a windows user perspective|
Back to top
View user's profile Send private message
gringo
Advocate
Advocate


Joined: 27 Apr 2003
Posts: 3793

PostPosted: Wed Aug 24, 2005 9:44 am    Post subject: Reply with quote

Quote:
The building seems to be fixed in the latest patchset, so just rebooting to try


great :D, pls let me know how well it works for you !
rc7 is out btw, and i will have a look to it today ... possibly with software suspend2 too ;)

thanx
Back to top
View user's profile Send private message
scoobydu
Veteran
Veteran


Joined: 16 Feb 2003
Posts: 1076
Location: 'Mind the Gap'

PostPosted: Wed Aug 24, 2005 11:35 am    Post subject: Reply with quote

gringo wrote:
Quote:
The building seems to be fixed in the latest patchset, so just rebooting to try


great :D, pls let me know how well it works for you !
rc7 is out btw, and i will have a look to it today ... possibly with software suspend2 too ;)

thanx


Works perfect! ;)

Just can't figure out to get pbbuttonsd to call the hibernate script when set to suspend-to-disk :roll:

Manually running hibernate works great though .. and restores fine 8)

Thx for the info on the update ... will update when rc7 gets into portage.
_________________
Tyan Tiger K8W, 2xOpteron 240,Powerbook5,6 15" 1.5g, Macbook Black 2g, Mac Mini 1g, Ipod P60g.
| Linux - From a windows user perspective|
Back to top
View user's profile Send private message
gringo
Advocate
Advocate


Joined: 27 Apr 2003
Posts: 3793

PostPosted: Wed Aug 24, 2005 7:12 pm    Post subject: Reply with quote

Quote:
Manually running hibernate works great though .. and restores fine


same as previous versiones here, it resumes but after recovering it does a normal startup, says swap partition is corrupted and thats it ... i triple-checked the config and i think its ok. Are there any special settings for powerbooks or something ? what am i doing wrong ?

cheers
Back to top
View user's profile Send private message
scoobydu
Veteran
Veteran


Joined: 16 Feb 2003
Posts: 1076
Location: 'Mind the Gap'

PostPosted: Wed Aug 24, 2005 8:23 pm    Post subject: Reply with quote

gringo wrote:
Quote:
Manually running hibernate works great though .. and restores fine


same as previous versiones here, it resumes but after recovering it does a normal startup, says swap partition is corrupted and thats it ... i triple-checked the config and i think its ok. Are there any special settings for powerbooks or something ? what am i doing wrong ?

cheers


Is your swap big enough? Do you have compression on? and did you put the hibernate-cleanup script in you default runlevel?
_________________
Tyan Tiger K8W, 2xOpteron 240,Powerbook5,6 15" 1.5g, Macbook Black 2g, Mac Mini 1g, Ipod P60g.
| Linux - From a windows user perspective|
Back to top
View user's profile Send private message
gringo
Advocate
Advocate


Joined: 27 Apr 2003
Posts: 3793

PostPosted: Thu Aug 25, 2005 7:32 am    Post subject: Reply with quote

Quote:
Is your swap big enough?


256 mb ... should be enough, am i right ?

Quote:
Do you have compression on?


have the lzf compiled as module, so i guess i dont. Its disabled in the conf anyway. Will try with lzf builtin and enabled, maybe that helps.

Quote:
and did you put the hibernate-cleanup script in you default runlevel?


yes i have it in the boot runlevel, and here it says another weird message, something like " /dev/hda doesnt has a supported partion table" 8O

thanx
Back to top
View user's profile Send private message
scoobydu
Veteran
Veteran


Joined: 16 Feb 2003
Posts: 1076
Location: 'Mind the Gap'

PostPosted: Thu Aug 25, 2005 8:04 am    Post subject: Reply with quote

Well 256 is not alot of space if you have alot of memory used and nocompression on :wink:

Its likely the image won't fit in swap so what is in there is half an image which it sees as corrupt when you try and wake ...

Try with compression first, then directly to a file, as the file will grow as needed.


Yes I get that same error re hda and can't seem to set config to get rid of it :roll:
_________________
Tyan Tiger K8W, 2xOpteron 240,Powerbook5,6 15" 1.5g, Macbook Black 2g, Mac Mini 1g, Ipod P60g.
| Linux - From a windows user perspective|
Back to top
View user's profile Send private message
gringo
Advocate
Advocate


Joined: 27 Apr 2003
Posts: 3793

PostPosted: Thu Aug 25, 2005 7:47 pm    Post subject: Reply with quote

Quote:
Try with compression first


youre the man, that did it !! Software suspend2 running here, i suspended the beast three or four times and it looks great so far !
I just activated the lzf as builtin, recompiled the kernel and reconfigured. That was it :D

many thanx for the tip !
Back to top
View user's profile Send private message
scoobydu
Veteran
Veteran


Joined: 16 Feb 2003
Posts: 1076
Location: 'Mind the Gap'

PostPosted: Thu Aug 25, 2005 8:56 pm    Post subject: Reply with quote

gringo wrote:
Quote:
Try with compression first


youre the man, that did it !! Software suspend2 running here, i suspended the beast three or four times and it looks great so far !
I just activated the lzf as builtin, recompiled the kernel and reconfigured. That was it :D

many thanx for the tip !


Excellent! :)

So now all we need to figure out is how to get it to interact with pbbutonsd, so that it hibernates when sleep-to-disk is set in pbbuttonsd.conf!!
_________________
Tyan Tiger K8W, 2xOpteron 240,Powerbook5,6 15" 1.5g, Macbook Black 2g, Mac Mini 1g, Ipod P60g.
| Linux - From a windows user perspective|
Back to top
View user's profile Send private message
gringo
Advocate
Advocate


Joined: 27 Apr 2003
Posts: 3793

PostPosted: Sat Aug 27, 2005 11:21 pm    Post subject: Reply with quote

Quote:
So now all we need to figure out is how to get it to interact with pbbutonsd


i did it the other way, take a look here http://gentoo-wiki.com/HOWTO_Use_Multimedia_Keys and you should be able to map the call to the hibernate script to any button you wish, i mapped it to F12 ;)

And i looked to the wired hibernate-cleanup script message ( unknown partition table blabla) If you look to the script youll see it calling fdisk, which obviously cannot work. Change this to mac-fdisk.

How well does the script work for you BTW, its masked for ppc and maybe its time to post a bugreport for unmasking it ;)

cheers
Back to top
View user's profile Send private message
fourhead
l33t
l33t


Joined: 03 Sep 2003
Posts: 875
Location: Cologne, Germany

PostPosted: Sun Sep 18, 2005 11:20 am    Post subject: Reply with quote

I'd also like to know how to integrate the hibernate script with pbbuttonsd. Currently pbbuttonsd is configured to do suspend-to-ram, but I'd like it to do suspend-to-disk on an emergencyaction (if the battery is critical low). pbbuttonsd has it's own suspend-to-disk script, but I've configured hibernate-script to work very well (sound, graphics, network, all for fine) so I'd like to use that...

Tom
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on PPC All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum