Software Suspend
OLD HOMEPAGE... INFORMATION HERE IS OBSOLETE!
This page only exists for historical reference and nostalgia. The patches on this page
are years old and nobody will save you if you have problems with them.
Unless you were looking for a source of out of date information, please visit the
new website at http://www.suspend2.net/
|
Enables the possibilty of suspendig machine. It doesn't need APM. You may suspend your machine by either pressing Sysrq-d. It creates an image which is saved in your active swaps. By next booting kernel detects the saved image and restores memory.
Right now you may boot without resuming and then later resume but
cannot use those swap partitions/files which were involved in
suspending. Also, there is a risk that buffers on disk won't match
with saved ones.
Download a version from list below.
Patch (possibly) proper version of kernel.
# cd /usr/src/linux; zcat ../swsusp-x.y.gz | patch -p1
Or netscape might download the patch unzipped in this case:
# cd /usr/src/linux; patch -p1 < ../swsusp-x.y
For more information take a look at Documentation/swsusp.txt and it is
a good idea to look into kernel/swsusp.c.
I have set up a mailing list which doesn't have big volume. Write to
swsusp-request@lister.fornax.hu with subscription request to get on the list or you may subscribe on the html page.
I'd like to ask everyone to write to the swsusp-list instead of directly to me because it is more like to get answer. On the other hand I'm sure people out there in the world might know more than me about suspending :) Also here you might check the archive.
For overall description of current patch look here.
WARNING! This version is still against only arch i386. The code is _aimed_ to be arch independent however there must be some arch dependent routines that need to be realized if you'd like that this patch work on other architectures. You may find those functions by grepping on "arch\/i386" in patch file.
Check this project page at
Current version(s) can be downloaded at:
| Version |
Kernel version |
Remark |
Author |
| swsusp-v7 |
linux-2.2.14 |
|
|
| swsusp-v7a |
linux-2.2.16 |
against SUSE released kernel
This is against 2.2.16 but actually 2.2.16-SuSE, which is rather similar to a 2.2.17-pre1x. |
Kurt Garloff |
| swsusp-v7b |
linux-2.2.18-pre9 |
|
Andreas Mohr
|
| swsusp-v7c |
linux-2.2.18 |
Current usable version - read notes about compilation! |
Jose' Manuel Pereira
|
| swsusp-v8pre1 |
linux-2.4.0 |
NOT TESTED! MIGHT NOT WORK. STILL DOESN'T WORK WHEN COMPILED WITH EGCS (gcc-2.95.3) |
|
| swsusp-v8pre2 |
linux-2.4.0 |
Okay, I played around a bit. kernel-2.4.0 no longer can be compiled with the old gcc-2.7.2. Should be compiled with gcc-2.91.66. We should definitely fix resuming.. This version has the diff between v7 and v7b (I've made the mistake not taking the latest version..). Has some APM support but that one should be revised. Read TODOs in the header of kernel/swsusp.c
|
|
| swsusp-v8pre3 |
linux-2.4.3 |
Ok, finally managed to compile it. And it _works_. Some
'minor' problem it has so it's still a pre. Look for futher
info in ChangeLog below.
PLEASE mail me if you work on the patch, I'd like to know. And
share your ideas too :))
|
|
| swsusp-v8pre4 |
linux-2.4.9 |
Small fixes. Trying to fix the runaway init problem.
|
Seasons |
| swsusp-v8 |
linux-2.4.10 |
|
Pavel |
| swsusp-v8 |
linux-2.5.1 |
|
Pavel |
| Florent Chabaud's page |
|
|
This page has newer version(s) |
| Pavel Machek's page |
(does it exist?) |
|
The patch is maintained by Pavel in the 2.5 source tree |
| patch for sysvinit |
sysvinit-2.76 |
(optional) |
Probably no longer needed |
or all versions can be revised here.
Also you may want to check out Florent Chabaud's page.
Read useful letters from the swsusp list or mailed to me.
Look up useful but not yet applied patches.
ChangeLog:
- swsusp-v8-2.5.1:
- ChangeLog should be nice here..
- swsusp-v8-2.4.10:
- ChangeLog should come here
- swsusp-v8pre4-2.4.9:
- Added warning about reiserfs possible fs inconsistency
- Trying to skip kernel threads from suspending but including init.
Maybe runaway init gets fixed if it also sent to sleep..
"Sometimes, when I returned from suspend, I was finding init in state
'Running' and 80% cpu usage. After many experiments and recompiling
init in debug-mode I found that sometimes init was waking up durring
swsusp's writing to swap! Invariably, on the next resume, it was hung
in a loop eating all cpu. My solution is to also suspend init in
prepare_suspend_processes(), and naturally restart it on resume. I
see no reason why not to suspend init, so if it doesn't break
anything, it's probably the best solution." (Alex Badea <vampire@go.ro>)
- New address of mailing list is shown up in MAINTAINERS
- Warning added about PCMCIA cards to Documentation/swsusp.txt
- swsusp-v8pre3-2.4.3:
Ok, finally managed to compile it with gcc-2.91.66. And I'm glad
it works (many, many things were broken applying a 2.2.x patch..).
Minor problems I detected (tested about 15 minutes including fscking ;):
- eth0 has a kernel thread if up and at the moment I don't know how to detect kernel threads so I simply don't touch PIDs less than ten (and this thread gets a PID ca. 70). It's definitely not a solution. Going to ask on linux-mm how to detect.
- If X is running and it isn't the active tty then resuming crashes (?!)
- After resuming gpm has to be restarted though I compiled in restore hw state.
- We should add APM support what is missing at the moment (do we?)
- Apply differences between v7b and v7c
- swsusp-v8pre2-2.4.0:
Applied diffs between v7 and v7b. Added some APM support but that
one definitely should be revised. Should be compiled with gcc-2.91.66.
We must find some solution resuming to work.
Read header notes in kernel/swsusp.c. THIS VERSION WILL NOT WORK!
- swsusp-v8pre1-2.4.0:
Many-many work after several months of being idle -- seems that the
whole kernel is nearly 're-written'. This version is patched and
compiling on kernel 2.4.0 but unfortunately untested since I did
not install GCC-2.7.2. This patch still won't work when compiled
with EGCS (gcc-2.95.3).. _Unfortunately_. Should figure out why.. Any ideas?
No APM support is yet ported.
- swsusp-v7a-2.2.16 (Kurt Garloff):
There were many changes in apm.c that broke your v7 patch.
- swsusp-v7-2.2.14:
Applied to 2.2.14 (official kernel)
- swsusp-v6a-2.2.13:
EGCS bug got fixed (I have not tested it yet)
- swsusp-v6-2.3.6-ac1
- Simplied task stopping (by Alan Cox)
- CONFIG_SWSUSP_OVERRIDE_APM (by John Harper )
- 1. On resumption from a software suspend, queue an APM resume event
- 2. If CONFIG_SWSUSP_OVERRIDE_APM is set, any calls to the APM
suspend() function will actually invoke softare_suspend()
This means that suspending using the normal APM triggers
(i.e. `apm -s' or hardware hotkey) will notify apmd then
call the software suspend.
- swsusp-v6pre1-2.2.7:
- Network device state saving/restoring
- Change virtual console so running X and svgalib programs may survive,
however my X console went blank when I tried to suspend while running
X and tried to restore text screen resolution by svgatextmode.
- Documentation update
- Introduced DEBUG_SLOW #define
- Fixed DEBUG macros
- Modified SAVE/RESTORE registers. No need for saving e[a-d]x but
I use mb() now. Maybe this will fix the bug what egcs causes.
- Updated 'things to implement' section in
Documentation/sw_suspend.tex
- suspend.* renamed to swsusp.*
- Fixed screen saving/restoring
- Code cleanup
- swsusp-v5-2.2.1:
Ok, this is getting cooler and working smoother. Because of the
'almost' ready support we don't get the proper screen back by resuming
for the actual console..not a big problem. Except for this I would say
that it's getting usable. It's against 2.2.1 but should apply to 2.2.2
with some offsets.. Debug messages are initally turned off. Many
delays've been taken out, it really works fast.
- pre1:
- Support for suspend using shutdown (also patch for sysvinit)
We no more depend on sysrq
- Preliminary(?) support for SMP.. don't know if it works..
- pre2:
- tasks has TASK_STOPPED state got into "INTERESTING" macro
- shrink_free_inodes() got deactivated.. ineffective and seems
to have some incompatibilities with 2.2.1.. Will remove it..
- For tasks to stop we wait 10 seconds (and starting to ignore
UNINTERRUPTIBLE ones after 5 seconds). This time is more likely
to be enough for tasks to stop but not 'forever' which could be
unhealthy..
- Documentation update
- v5:
- We track the allocated pagedir with a new bit in page's flags so
we no more depend on actual memory management implementation.
- Support hardware state restore (many event handlers yet to be written..)
(Thanx to Steve Dodd)
- We try to power down instead of rebooting.
- sysvinit documentation update
- time warping by resume is fixed ('stole' support from APM)
- support for the possibility to resume hardware from userland
(through init) - see 'resume' action of sysvinit patch
- Debug messages are optional so suspend/resume can be done silently
without messing up the console..
- Documentation update for sysvinit
- Almost ready support for screen restoration
- swsusp-v4-2.2.0pre7:
It seems we have to save our image to swapspace otherwise we cannot
guaratee 100% fs consistency. In this version a new signal is also
introduced so processes won't run and release their locks.
Work of Pavel Machek, these are major diffs:
- image is saved onto swap-space labeled with a special flag
in its first block
- sending hopefully all 'interesting' processes the
SIGSTOP_SUSPEND signal so they release their locks.
my work:
- ported to 2.2.0pre7
- Code cleanup (e.g. no need for swap_guard)
- fix in write_suspend_image, there was a swap page leak
(which actually did not count :-)
- moved SIGSTOP_SIGNAL to be nr.32. When we've overwritten SIGUNUSED,
klogd ignored that signal. Also has changed send_sig to force_sig
to be sure. It can now suspend with even sys/klogd enabled.
- (Note: Even mp3playing survives now if it's been stopped by
scroll-lock. (Stopping it with ^Z doesn't work even without
suspending).
X seems to survive, we get back to graphics mode by mode-switching
(grey+) but doesn't fresh screen. Ctrl got stuck by this try..)
- resume= option is optional -- sys_swapon() realizes that we have to
resume and calls us resume_machine() (so it is triggered by swapon -a)
- We avoid touching init and kernel_threads by stopping processes
- Started to support more than one swapfiles. Ought to work, did not
test is heavily.
- Documentation update
Words of Pavel:
This is second version without design bugs. (There are some real bugs,
through :-) - signal SIGSTOP_SUSPEND should be prevented from reaching
userland. This way, it kills ssh. Next bug is that machine dies
horrible way when there are not enough pages.)
- swsusp-v3-2.1.131:
Those dirty buffers had nothing common with memory shrinking. It was [and maybe
is] syslogd/klogd which causes the problem. That rt priority isn't needed
maybe.. We 'simply' should not sleep, because we can have any high priority if
get deleted from runqueue :(.. Fs inconsistency is gone without syslogd, but
still no other running process may exist [e.g. mpg123], causes deadlock by
memory shrinking.. I still don't have the code for occupying mem pages and then
use them.. I think I've done this way as it is because I couldn't decide by
duplicating wheter it is a freshly allocated page [we should define a new bit
for it].
- ported to 2.1.131
(Work of Pavel Machek):
- smaller functions for reading/writing (using sys_open, sys_write)
- We check if reading/writing image is o.k.
- calling do_emergency_sync() directly, we don't need to queue it since
we're already in process bdflush
- after aggressively shrinking memory we sync (this could
have caused dirty buffers when we called revalidate_buffers() by
resuming. (No, it hasn't :)
- swapper_pg_dir is (shamelessly) is sitting in code segment, we save it
also (hopefully no other surprises will arise).
- guarding swap space so we detect if sg tries to change its state after
we have duplicated pages
- calling sync_old_buffers() after each page writeout, reducing the risk
of running out of psychical memory while writing the image
(my work):
- Until resolving the problem that other processes get scheduled while
suspending we must test with syslogd/klogd stopped. Otherwise it
causes unwanted swapping and dirty buffers. The swap_guard may look
cruel -- but since it really should _not_ happen while it is set --
it is reasonable (at least until the code gets ready)
- More proper spinlocking
- We don't call wait_on_buffer anymore (we don't want to sleep),
- have do_suspend_sync() function
- rt priority given to suspend but does not help. Probably will
be removed.
- swsusp-v2-2.1.125:
- Documentation/sw_suspend.tex
- Configure.help
- swsusp-v1-2.1.125:
The first draft version is ready and testers are welcome.
It is against 2.1.125, upgrade to the newest kernel is to be here soon.
Small filesystem inconsistency is possible while testing [basically it
calls Sysrq-SUB] but I did not have any serious problems. So don't
worry. But of course - no warranty :).