OpenBSD Journal

Hibernation support added!

Contributed by jj on from the gentlemen-stop-your-engines dept.

Mike Larkin just committed support for hibernation on OpenBSD. Only i386 using wd(4) disks at this moment, but still a big step forward.
On a recent posting on tech@, mlarkin@ sets up the rules for playing this game:
Hibernate support (suspend-to-disk) will be shortly enabled for i386 + wd
machines.

Some FAQs, before I commit the change to turn it on:

1. If you have anything other than i386 + wd, it won't work. Don't report it.
Other archs + disk types are being worked on now that i386 + wd is working.
This means, *FOR NOW*, it works on combinations like this:

wd0 at pciide0 channel 0 drive 0: 

.. NOT this:

ahci0 at pci0 dev 31 function 2 "Intel 82801I AHCI" rev 0x03: msi, AHCI 1.2
scsibus0 at ahci0: 32 targets
sd0 at scsibus0 targ 0 lun 0:  SCSI3 0/direct



2. Hibernate writes to swap (at the end of your swap). If you have too small
a swap, it won't work, or if there are swap pages in use at the end of your
swap that overlap with what we want. You need at least "size of mem + 64MB"
of swap at the end of swap, free, at the time of hibernate.

3. We do *not* do encryption of the hibernated image, even if you have turned
on encrypted swap.

4. If you change your memory size/layout or change your kernel, we will detect
this and abort any hibernate resumes. The resume will be a normal boot then.

5. It will be very slow for the time being - this is a known problem that
I am working on fixing, but for now, we will wastefully write all memory, 
even pages that are not in use. This will be fixed, so please don't report 
that "it's slow". On my machine with 1.5GB ram, it takes a few minutes to write
everything out, and about 30s to read it back in on resume.

6. Hibernate can be triggered via 'ZZZ' in -current (capital 'Z's for hibernate,
lowercase 'z' for suspend).

7. Right now, there is no unwind support for errors. This means that just
about every failure case will result in a panic or reboot. This too is being
worked on.

If you have a supported (see #1) configuration and want to test it, let us
know if it works (or doesn't). There won't be a diff posted here, it will just
get enabled, probably sometime later tonight or tomorrow.

-ml
Of course finding other device types (like ahci(4)) and make them work without side-effects is a top priority now, to include more machines which can hibernate, as well as other architectures.

(Comments are closed)


Comments
  1. By Noryungi (noryungi) noryungi@yahoo.com on

    That's very nice... I don't suppose we will see full hibernation in 5.2?

Credits

Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original deadly.org with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]