s2ram.rst 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. ========================
  2. How to get s2ram working
  3. ========================
  4. 2006 Linus Torvalds
  5. 2006 Pavel Machek
  6. 1) Check suspend.sf.net, program s2ram there has long whitelist of
  7. "known ok" machines, along with tricks to use on each one.
  8. 2) If that does not help, try reading tricks.txt and
  9. video.txt. Perhaps problem is as simple as broken module, and
  10. simple module unload can fix it.
  11. 3) You can use Linus' TRACE_RESUME infrastructure, described below.
  12. Using TRACE_RESUME
  13. ~~~~~~~~~~~~~~~~~~
  14. I've been working at making the machines I have able to STR, and almost
  15. always it's a driver that is buggy. Thank God for the suspend/resume
  16. debugging - the thing that Chuck tried to disable. That's often the _only_
  17. way to debug these things, and it's actually pretty powerful (but
  18. time-consuming - having to insert TRACE_RESUME() markers into the device
  19. driver that doesn't resume and recompile and reboot).
  20. Anyway, the way to debug this for people who are interested (have a
  21. machine that doesn't boot) is:
  22. - enable PM_DEBUG, and PM_TRACE
  23. - use a script like this::
  24. #!/bin/sh
  25. sync
  26. echo 1 > /sys/power/pm_trace
  27. echo mem > /sys/power/state
  28. to suspend
  29. - if it doesn't come back up (which is usually the problem), reboot by
  30. holding the power button down, and look at the dmesg output for things
  31. like::
  32. Magic number: 4:156:725
  33. hash matches drivers/base/power/resume.c:28
  34. hash matches device 0000:01:00.0
  35. which means that the last trace event was just before trying to resume
  36. device 0000:01:00.0. Then figure out what driver is controlling that
  37. device (lspci and /sys/devices/pci* is your friend), and see if you can
  38. fix it, disable it, or trace into its resume function.
  39. If no device matches the hash (or any matches appear to be false positives),
  40. the culprit may be a device from a loadable kernel module that is not loaded
  41. until after the hash is checked. You can check the hash against the current
  42. devices again after more modules are loaded using sysfs::
  43. cat /sys/power/pm_trace_dev_match
  44. For example, the above happens to be the VGA device on my EVO, which I
  45. used to run with "radeonfb" (it's an ATI Radeon mobility). It turns out
  46. that "radeonfb" simply cannot resume that device - it tries to set the
  47. PLL's, and it just _hangs_. Using the regular VGA console and letting X
  48. resume it instead works fine.
  49. NOTE
  50. ====
  51. pm_trace uses the system's Real Time Clock (RTC) to save the magic number.
  52. Reason for this is that the RTC is the only reliably available piece of
  53. hardware during resume operations where a value can be set that will
  54. survive a reboot.
  55. pm_trace is not compatible with asynchronous suspend, so it turns
  56. asynchronous suspend off (which may work around timing or
  57. ordering-sensitive bugs).
  58. Consequence is that after a resume (even if it is successful) your system
  59. clock will have a value corresponding to the magic number instead of the
  60. correct date/time! It is therefore advisable to use a program like ntp-date
  61. or rdate to reset the correct date/time from an external time source when
  62. using this trace option.
  63. As the clock keeps ticking it is also essential that the reboot is done
  64. quickly after the resume failure. The trace option does not use the seconds
  65. or the low order bits of the minutes of the RTC, but a too long delay will
  66. corrupt the magic value.