Solaris Suspend and Resume: How To!
By randyf on Jan 01, 2008
So, Solaris x86 machine are now capable of suspend and resume. The Ultra 20 is enabled by default, and a simple call via sys-suspend, and the machine will go to sleep in a few seconds. And simply pressing a key on the keyboard and the machine is back where it was left just a few seconds later.
"OK", you say, "this is cool, but I don't have an Ultra 20, will it work on my machine?"
The answer is Maybe!.
As mentioned before, suspend and resume primarily depends on hardware drivers supporting the DDI_SUSPEND/DDI_RESUME commands to their detach(9e)/attach(9e) routines. If these commands are supported on all the drivers on your machine (and the drivers actually restore the hardware state), then your machine just may also suspend and resume.
The first thing to do is to actually enable the feature on your machine. The Ultra 20 is enabled by default, and as other compliant machines are identified, they will be enabled by default. Everyone else that wants to try the feature will need to enable it by adding a line in /etc/power.conf:
And then (as root or via the Administrator role) enter:
This will allow /usr/openwin/bin/sys-suspend to actually try and suspend the machine!
This is the point were we now find out if drivers comply or not. The cpr module will walk the device tree (as well as other things, but that is later) by going out the the leafs and calling their detach(9e) routines with the DDI_SUSPEND command. If the driver complies, it will return a DDI_SUCCESS, and goes to the next leaf (followed afterwards by the nexus driver). If it returns DDI_FAILURE, then we rewind through the list of already suspended devices, calling their attach(9e) routines with the DDI_RESUME command, and then returning a failure. As the late great Chick Hern used to say: "No Harm, No Foul".
If all the devices suspend, the cpr module will enable wakers, and call the ACPI _S3 method and go to sleep! Press a key on the keyboard, the power button (raise the lid, if you happen to have a driver for that event), or even Wake on LAN (BIOS configured WOL NIC's will enable Magic Packet WOL as part of the S3 method), and the machine wakes up.
Another note, OpenSolaris doesn't have the sys-suspend command. This is not a problem, as Gnome has Suspend and Resume support built in. In the "Menu", click on the "Shut Down" item, and if S3-support is enabled (either by the whitelist, or by the methods above), there will now be a "Suspend" button. Clicking on this button will also initiate a suspend/resume cycle.
A quick note of caution: enabling suspend and resume on machines without known compliant drivers can cause problems, including panics. So don't expect miracles. You can, however, file bugs against drivers that don't support suspend and resume. Looking through /var/adm/messages should let you know why a suspend failed, including if a driver failed.
And the nVidia driver that does support suspend and resume requires first that the Xorg server be running, so if you get a framebuffer driver failure and your hardware is using the nvidia driver, make sure that Xorg starts first. This is usually accomplished by just logging in via dt-login.
Also, initial support for suspend and resume disabled the feature if running more than one processor, as there were some interesting MP issues that required a bit more time to work out. So if you are also running 2 processors or a dual core, you will need to disable the second processor/core till this fix is integrated. (This was fixed in snv_82)
Need more information, keep watching this blog. I will post updates and other tricks. You can also follow the OpenSolaris.org Laptop Community's "Suspend and Resume" project, or even post questions to laptop-discuss-AT-opensolaris-DOT-org, driver-discuss-AT-opensolaris.org, or check out information in the Power Management Community.
Till then, how about a Gordon Birch "Winterbock". A nice malt body with a dark copper color and strong caramel flavor, with a spicy hop bitterness and alcohol content that will warm anyone on a cold winter night.
This seasonal lager will soon be gone, so stock up for the new year, and see if your x86 laptop will sleep while you enjoy this fine winter lager.