Swsusp approaches readiness
[Posted August 5, 2003 by corbet]
Your editor recently replaced his venerable Sony 505-FX laptop. That
machine had a nice feature - hitting a certain magic function key sequence
would cause the APM BIOS to take over, save the contents of memory to disk,
and suspend the system. The Linux APM code would let the kernel trap the
events and do things like flush out disk buffers (before suspending) or
reset the system clock (after). It all "just worked."
The new laptop has the same little "suspend" symbol on the same key, but it
doesn't work. In the modern, ACPI world, it is the operating system which
is responsible for suspending and resuming the system. This change is,
somehow, presented as progress. The version of Windows shipped with the
laptop is able to perform this operation, of course. Strangely, Sony does
not support Linux to the same level. Your editor, it seems, was doomed to
head off to the Kernel Summit and
OLS with a non-suspending
laptop.
Then came the announcement that software
suspend for 2.4, v1.0, was available. LWN has covered the swsusp patch before, but swsusp has
long been in the "almost works" category. For a long time, it appeared
that not much was being done in that area. More recently, the swsusp
effort has picked up steam (as more kernel hackers get new laptops,
perhaps). Thus, the 1.0 release.
The swsusp tarball yielded a series of patches; the user has to decide
which ones to apply depending on what other patches are of interest. For
example, if the target (2.4.21) kernel has the ACPI patches in it (pretty
much mandatory for many laptops), a separate swsusp "option" patch must be
applied as well. The swsusp "Applying" file covers the necessary patches
(and required order) reasonably well - for somebody who is comfortable
messing with highly patched kernels.
The patch also comes with a "hibernate" script which is used to actually
kick off a software suspend operation. This (lengthy) script tries to get
everything into shape for a graceful suspend; in many ways, it behaves like
a partial shutdown. Certain processes are killed off, as many modules as
possible are unloaded, etc. On resume it restores the clock, reconfigures
network interfaces, and, perhaps, engages in some complicated gymnastics in
an effort to get X and the video hardware back in sync.
The bottom line is: it works. On your editor's laptop, an invocation of
hibernate saves state and takes the system to a power-off state in
16 seconds. Returning to a full X display takes a little longer: 34
seconds, after the BIOS finishes its power-on ablutions. To say the
least, this is a nice functionality to have in a laptop, especially when
one is attempting to cover a conference.
The one bit of remaining difficulty is the laptop's Radeon video hardware,
which refuses to come back into any sort of reasonable, useful state.
There is, evidently, a patch for XFree86 which makes this problem go away.
But your editor, who has no trouble with patching a kernel to a pulp, shies
away from patching and installing XFree86. It was far simpler to tell X to
run in the unaccelerated, dumb frame buffer mode, which works just fine.
For those who are interested in 2.4 software suspend, the first swsusp 1.1 release candidate was
announced on August 5. There's a number of useful changes in this
version, but the largest is probably the ability to save system state to
swapfiles (previous versions only worked with swap partitions). Software
suspend support in 2.6 is in more of a state of flux; the power management
changes have still not been merged, and work is being done to make the
swsusp support cleaner, more flexible, and more robust. 2.6 should
eventually have a solid swsusp implementation, though it may still be
stabilizing when 2.6.0 comes out. It is unclear whether swsusp will ever
be merged into the 2.4 kernel; it is a somewhat invasive patch to apply to
a stable series.
(
Log in to post comments)