How to get s2ram working

2006 Linus Torvalds2006 Pavel Machek

  1. Check suspend.sf.net, program s2ram there has long whitelist of“known ok” machines, along with tricks to use on each one.
  2. If that does not help, try reading tricks.txt andvideo.txt. Perhaps problem is as simple as broken module, andsimple module unload can fix it.
  3. You can use Linus’ TRACE_RESUME infrastructure, described below.

Using TRACE_RESUME

I’ve been working at making the machines I have able to STR, and almostalways it’s a driver that is buggy. Thank God for the suspend/resumedebugging - the thing that Chuck tried to disable. That’s often the _only_way to debug these things, and it’s actually pretty powerful (buttime-consuming - having to insert TRACE_RESUME() markers into the devicedriver that doesn’t resume and recompile and reboot).

Anyway, the way to debug this for people who are interested (have amachine that doesn’t boot) is:

  • enable PM_DEBUG, and PM_TRACE

  • use a script like this:

    #!/bin/shsyncecho 1 > /sys/power/pm_traceecho mem > /sys/power/state

    to suspend

  • if it doesn’t come back up (which is usually the problem), reboot byholding the power button down, and look at the dmesg output for thingslike:

    Magic number: 4:156:725hash matches drivers/base/power/resume.c:28hash matches device 0000:01:00.0

    which means that the last trace event was just before trying to resumedevice 0000:01:00.0. Then figure out what driver is controlling thatdevice (lspci and /sys/devices/pci* is your friend), and see if you canfix it, disable it, or trace into its resume function.

    If no device matches the hash (or any matches appear to be false positives),the culprit may be a device from a loadable kernel module that is not loadeduntil after the hash is checked. You can check the hash against the currentdevices again after more modules are loaded using sysfs:

    cat /sys/power/pm_trace_dev_match

For example, the above happens to be the VGA device on my EVO, which Iused to run with “radeonfb” (it’s an ATI Radeon mobility). It turns outthat “radeonfb” simply cannot resume that device - it tries to set thePLL’s, and it just _hangs_. Using the regular VGA console and letting Xresume it instead works fine.

NOTE

pm_trace uses the system’s Real Time Clock (RTC) to save the magic number.Reason for this is that the RTC is the only reliably available piece ofhardware during resume operations where a value can be set that willsurvive a reboot.

pm_trace is not compatible with asynchronous suspend, so it turnsasynchronous suspend off (which may work around timing orordering-sensitive bugs).

Consequence is that after a resume (even if it is successful) your systemclock will have a value corresponding to the magic number instead of thecorrect date/time! It is therefore advisable to use a program like ntp-dateor rdate to reset the correct date/time from an external time source whenusing this trace option.

As the clock keeps ticking it is also essential that the reboot is donequickly after the resume failure. The trace option does not use the secondsor the low order bits of the minutes of the RTC, but a too long delay willcorrupt the magic value.