Back
Software Suspend for Linux 2.2.x
Great news!
I got the
Software Suspend of Gabor Kuti to poperly work on 2.2.13 (compiled with
egcs). Great work, Gabor, thanks!
What it does
Upon Sysrq-D or (optionally) a Suspend event from APM, it does
stop processes, shrink memory, saves hardware state (partially), sync,
writes all data pages into the swap partitions and powers down. When
rebooting, the swapon will cause the kernel to recognize
the image and restore the previous state.
It does work very nicely here! It's not just useful for my
notebook with buggy
APM, but also for desktop. Have you ever seen Linux booting to a fully
restored X session in less then ten seconds, before?
There are a few shortcomings:
- You should patch your sysvinit to use some userspace tools to do some
more hardware restoring, e.g. gpm must be restarted on my laptop.
Some restoring can be done, before swapon -a is called in
/sbin/init.d/boot, e.g. the hdparm settings. But
/usr is not yet mounted ... and should not be (it's not
clean)!
- Not all the hardware state is saved and restored in the kernel. Support
for SCSI, e.g., is missing.
- SMP seems to be not yet working.
- Did not test with BigMem. Should work, though.
- You need to have enough free memory (after shrinking this should
normally be the case) and enough free swap space.
- Some processes may refuse to get stopped and prevent the suspend. At the
moment nscd is one of them. Just don't use it any more ... or stop
it manually.
- The kernel booted to resume must be identical to the one used when
suspending, of course!
- USE IT AT YOUR OWN RISK! THE GPL APPLIES!
Some of your
hardware might malfunction after a resume, because the hardware state is not
restored and might cause kernel crashes, fs corruption or data loss. YOU
HAVE BEEN WARNED!
What I have done ...
I started from the swsusp-v6-2.3.4.gz and swsusp-current of
Gabor and did some changes:
- The counting of the pages has to account for the fact, that there are
several types of pages, now: DMA, NONDMA, BIGMEM.
- The critical sections of the suspend and restore functions had to be
straightened to now get code, which needs to put local variables on the
stack. As the stack will be restored, it would confuse the CPU when
returning from the function.
- The fg console will be changed to vt12, which is hopefully not the one
with X11 running. Otherwise XFree86 would restore the screen correctly.
Linux 2.2.16 ...
Gabor has merged my changes and released a v7 of his patch, whichh applies
cleanly against the plain 2.2.14 kernel.
Due to changes in the APM code of 2.2.16, the patch does not apply cleanly
against a 2.2.16 kernel, but leaves some issues to be resolved manually.
I also created a patch against a 2.2.16-SuSE kernel, which you can find
below, as well.
Download
Get my patches
swsusp-v6a-2213.diff.gz
swsusp-v7a-2216.diff.gz
here.
ENJOY!
(w) by Kurt Garloff, 2000-08-23