Thursday, May 5, 2011

Linux kernel Suspend Code

After echo "mem" > /sys/power/state directory, it jumps to kernel. start to execute code at /linux-2.6.24/kernel/power/main.c, it execute function

state_store() -> enter_state() ->
1. suspend_prepare()
2. suspend_device_and_enter() // machine stop here, and wakeup here!!!
3. suspend_finish()

remember, all the printk statement you added will be print into /var/log/message.
It doesn't necessary to pint out immediately. For example, printk statement before OS get into S3 state may print out after wakeup OS.
Basically, printk will write to memory first, and then print out to file.

No comments: