How does suspend work on Linux:
Step1: suspend on Userspace pm-suspend is shell script, which attempts to prepare the system for suspend. For example, it will tell NetworkManager to shut down networking, and use vbetool (run code at video option ROM) to save VGA state. Finally, it wil echo string “mem” to /sys/power/state. This jumps to kernel, and the userspace is stopped.
Detailed info:
pm-suspend: /usr/lib/pm-utils/bin/pm-action
functions: /usr/lib/pm-utils/functions
10NetworkManager: /usr/lib/pm-utils/sleep.d/10NetwrokManager
20video: /usr/lib/pm-utils/sleep.d/20video
After run “echo -n mem > /sys/power/state”, the kernel goes through the device tree and calls suspend method on each bound driver. In the mean while, kernel execute couple of ACPI methods acpi_enter_sleep_state_prep() and acpi_enter_sleep_state(). In this method, kernel will set the SLP_TYP register at south-bridge, which tell BIOS to wakeup from sleep state next time.
Detailed info:
acpi_enter_sleep_state_prep(): /linuxsrc/drivers/acpi/hardware/hwsleep.c
acpi_enter_sleep_state(): /linuxsrc/drivers/acpi/hardware/hwsleep.c
main.c /linux/src/drivers/acpi/sleep/main.c
Userspace: 1.5 seconds
Kenerl: 1 second
1 comment:
nice. lol
Post a Comment